2017-10-17 57 views
0

我在Mac上試圖構建FTS5作爲可加載擴展。SQLite:構建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' 

我在做什麼錯?

我試過GCC 4.9和5.5的MacPorts從在MacOS


有趣的是,在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資源,爲什麼要這樣?

回答

0

感謝來自SQLite開發團隊的Dan Kennedy,現在問題已解決。

的第一個問題似乎是與SQLite的源代碼中的實際問題,在MacOS編譯的時候,而現在它固定在這裏:http://www.sqlite.org/src/info/cd0471ca9f75e7c8

的第二個問題是關於不生成的頭文件,因爲它需要一個單獨的製備步驟。所以完整的構建指令實際上看起來像這樣:

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