gpt4 book ai didi

c - SQLite:构建 FTS5 可加载扩展时遇到问题

转载 作者:太空宇宙 更新时间:2023-11-04 03:20:37 24 4
gpt4 key购买 nike

我在 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 源,我为什么要安装?

最佳答案

感谢 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

关于c - SQLite:构建 FTS5 可加载扩展时遇到问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46793988/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com