tursodatabase / libsql

libSQL is a fork of SQLite that is both Open Source, and Open Contributions.
https://turso.tech/libsql
MIT License
9.55k stars 252 forks source link

Unable to build bottomless extension, unknown type name 'LIBSQL_EXTENSION_INIT1' #1485

Open xqzhou opened 3 months ago

xqzhou commented 3 months ago

Detailed log

bottomless $ LIBSQL_DIR=~/Workspace/database/libsql make release
cargo build -p bottomless -j1   --quiet --release && \
        clang -fPIC -shared -DLIBSQL_ENABLE_BOTTOMLESS_WAL bottomless.c -I/Users/bytedance/Workspace/database/libsql ../target/release/libbottomless.a \
        -o ../target/release/bottomless.so
bottomless.c:5:1: error: unknown type name 'LIBSQL_EXTENSION_INIT1'
LIBSQL_EXTENSION_INIT1
^
bottomless.c:17:9: error: unknown type name 'libsql_api_routines'; did you mean 'sqlite3_api_routines'?
  const libsql_api_routines *pLibsqlApi
        ^~~~~~~~~~~~~~~~~~~
        sqlite3_api_routines
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sqlite3.h:1267:37: note: 'sqlite3_api_routines' declared here
typedef struct sqlite3_api_routines sqlite3_api_routines;
                                    ^
bottomless.c:28:3: error: call to undeclared function 'LIBSQL_EXTENSION_INIT2'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
  LIBSQL_EXTENSION_INIT2(pLibsqlApi);
  ^
bottomless.c:32:37: error: call to undeclared function 'libsql_wal_methods_find'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
  struct libsql_wal_methods *orig = libsql_wal_methods_find(0);
                                    ^
bottomless.c:32:30: warning: incompatible integer to pointer conversion initializing 'struct libsql_wal_methods *' with an expression of type 'int' [-Wint-conversion]
  struct libsql_wal_methods *orig = libsql_wal_methods_find(0);
                             ^      ~~~~~~~~~~~~~~~~~~~~~~~~~~
bottomless.c:39:14: error: call to undeclared function 'libsql_wal_methods_register'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
    int rc = libsql_wal_methods_register(methods);
             ^
1 warning and 5 errors generated.
make: *** [release] Error 1
levydsa commented 3 months ago

I think you are missing sqlite3ext.h. Try:

$ cd libsql-sqlite3/
$ ./configure
$ make sqlite3ext.h

Then include libsql-sqlite3/.