【问题标题】:SQLite: trouble building FTS5 loadable extensionSQLite:构建 FTS5 可加载扩展时遇到问题
【发布时间】:2017-10-17 15:38:45
【问题描述】:

我在 Mac 上尝试将 FTS5 构建为可加载扩展。

我已经下载了SQLite源码,成功执行./configuremake fts5,获得fts5.{c,h}文件。

现在,当我尝试为我得到的扩展构建动态​​库时:

gcc -g -fPIC -dynamiclib -o fts5.dylib fts5.c
In file included from fts5Int.h:18:0:
fts5_storage.c: In function 'sqlite3Fts5StorageOpen':
fts5_storage.c:305:9: error: 'sqlite3_api_routines' has no member named '__builtin___snprintf_chk'
In file included from /usr/include/secure/_string.h:33:0,
                 from /usr/include/string.h:192,
                 from fts5Int.h:21:
fts5_storage.c:305:26: warning: passing argument 1 of '__builtin_object_size' makes pointer from integer without a cast
fts5_storage.c:305:26: note: expected 'const void *' but argument is of type 'int'
In file included from fts5Int.h:18:0:
fts5_storage.c:308:11: error: 'sqlite3_api_routines' has no member named '__builtin___snprintf_chk'
In file included from /usr/include/secure/_string.h:33:0,
                 from /usr/include/string.h:192,
                 from fts5Int.h:21:
fts5_storage.c:308:28: warning: passing argument 1 of '__builtin_object_size' makes pointer from integer without a cast
fts5_storage.c:308:28: note: expected 'const void *' but argument is of type 'int'

我做错了什么?

我在 macOS 上尝试了 MacPorts 的 gcc 4.9 和 5.5


有趣的是,在 Linux(和 gcc5)上我收到了这个错误:

❯ gcc -g -fPIC -shared -o fts5.so fts5.c
fts5.h:24:21: fatal error: sqlite3.h: No such file or directory
compilation terminated.

果然在源目录的根目录中没有 sqlite3.h,尽管我希望它应该在 make 步骤中创建? 我当然可以安装 libsqlite3-dev 但我已经拥有了所有的 sqlite 源,我为什么要安装?

【问题讨论】:

    标签: c sqlite


    【解决方案1】:

    感谢 SQLite 开发团队的 Dan Kennedy,问题现已解决。

    第一个问题似乎是在 macOS 上编译时 SQLite 源代码的实际问题,现在已在此处修复:http://www.sqlite.org/src/info/cd0471ca9f75e7c8

    第二个问题是没有生成头文件,因为它需要单独的 make 步骤。所以完整的构建指令实际上是这样的:

    ./configure
    make fts5.c sqlite3.h sqlite3ext.h
    gcc -O2 -fPIC -shared fts5.c -o fts5.dylib
    

    【讨论】:

      猜你喜欢
      • 2021-10-06
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-10-14
      • 1970-01-01
      • 1970-01-01
      • 2021-08-02
      相关资源
      最近更新 更多