Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: error: use of undeclared identifier 'sqlite3_key' #2

Open
cschanaj opened this issue May 29, 2022 · 1 comment
Open

Error: error: use of undeclared identifier 'sqlite3_key' #2

cschanaj opened this issue May 29, 2022 · 1 comment
Labels
question Further information is requested

Comments

@cschanaj
Copy link

I tried ./gradlew assembleRelease and it seems that sqlite3_key is undefined even if -DSQLITE_HAS_CODEC is present.

Android SDK: API 32

> Task :sqlcipher:externalNativeBuildDebug FAILED
Build sqlcipher_armeabi-v7a
SQLCipher LOCAL_CFLAGS:-DSQLITE_HAS_CODEC -DSQLCIPHER_CRYPTO_OPENSSL -DSQLITE_TEMP_STORE=2 -DSQLITE_THREADSAFE=1 -DSQLITE_ENABLE_COLUMN_METADATA -DSQLITE_ENABLE_FTS3_PARENTHESIS -DSQLITE_ENABLE_FTS4 -DSQLITE_ENABLE_FTS4_UNICODE61 -DSQLITE_ENABLE_FTS5 -DSQLITE_ENABLE_MEMORY_MANAGEMENT -DSQLITE_ENABLE_UNLOCK_NOTIFY -DSQLITE_ENABLE_RTREE -DSQLITE_SOUNDEX -DHAVE_USLEEP -DSQLITE_ENABLE_LOAD_EXTENSION -DSQLITE_ENABLE_STAT3 -DSQLITE_ENABLE_STAT4 -DSQLITE_ENABLE_JSON1 -DSQLITE_ENABLE_EXPLAIN_COMMENTS -DSQLITE_DEFAULT_WAL_SYNCHRONOUS=1 -DSQLITE_MAX_VARIABLE_NUMBER=99999 -DSQLITE_DEFAULT_JOURNAL_SIZE_LIMIT=1048576 -DSQLITE_ENABLE_SESSION -DSQLITE_ENABLE_PREUPDATE_HOOK -DSQLITE_ENABLE_DBSTAT_VTAB
[armeabi-v7a] Compile++ thumb: sqlcipher <= android_database_SQLiteConnection.cpp
/home/user/sqlcipher-android/sqlcipher/src/main/jni/sqlcipher/android_database_SQLiteConnection.cpp:149:14: error: use of undeclared identifier 'sqlite3_key'
        rc = sqlite3_key(connection->db, key, size);
             ^
/home/user/sqlcipher-android/sqlcipher/src/main/jni/sqlcipher/android_database_SQLiteConnection.cpp:170:18: error: use of undeclared identifier 'sqlite3_rekey'; did you mean 'sqlite3_trace'?
            rc = sqlite3_rekey(connection->db, key, size);
                 ^~~~~~~~~~~~~
                 sqlite3_trace
/home/user/sqlcipher-android/sqlcipher/src/main/jni/sqlcipher/sqlite3.h:3218:36: note: 'sqlite3_trace' declared here
SQLITE_API SQLITE_DEPRECATED void *sqlite3_trace(sqlite3*,
                                   ^
/home/user/sqlcipher-android/sqlcipher/src/main/jni/sqlcipher/android_database_SQLiteConnection.cpp:170:48: error: cannot initialize a parameter of type 'void (*)(void *, const char *)' with an lvalue of type 'jbyte *' (aka 'signed char *')
            rc = sqlite3_rekey(connection->db, key, size);
                                               ^~~
/home/user/sqlcipher-android/sqlcipher/src/main/jni/sqlcipher/sqlite3.h:3219:10: note: passing argument to parameter 'xTrace' here
   void(*xTrace)(void*,const char*), void*);
         ^
3 errors generated.
make: *** [/home/user/Android/Sdk/ndk/23.0.7599858/build/core/build-binary.mk:478: /home/user/sqlcipher-android/sqlcipher/build/intermediates/ndkBuild/debug/obj/local/armeabi-v7a/objs-debug/sqlcipher/android_database_SQLiteConnection.o] Error 1

Execution failed for task ':sqlcipher:externalNativeBuildDebug'.
> Build command failed.
  Error while executing process /home/user/Android/Sdk/ndk/23.0.7599858/ndk-build with arguments {NDK_PROJECT_PATH=null APP_BUILD_SCRIPT=/home/user/sqlcipher-android/sqlcipher/src/main/jni/Android.mk NDK_APPLICATION_MK=/home/user/sqlcipher-android/sqlcipher/src/main/jni/Application.mk APP_ABI=armeabi-v7a NDK_ALL_ABIS=armeabi-v7a NDK_DEBUG=1 APP_PLATFORM=android-16 NDK_OUT=/home/user/sqlcipher-android/sqlcipher/build/intermediates/ndkBuild/debug/obj NDK_LIBS_OUT=/home/user/sqlcipher-android/sqlcipher/build/intermediates/ndkBuild/debug/lib sqlcipher}
  SQLCipher LOCAL_CFLAGS:-DSQLITE_HAS_CODEC -DSQLCIPHER_CRYPTO_OPENSSL -DSQLITE_TEMP_STORE=2 -DSQLITE_THREADSAFE=1 -DSQLITE_ENABLE_COLUMN_METADATA -DSQLITE_ENABLE_FTS3_PARENTHESIS -DSQLITE_ENABLE_FTS4 -DSQLITE_ENABLE_FTS4_UNICODE61 -DSQLITE_ENABLE_FTS5 -DSQLITE_ENABLE_MEMORY_MANAGEMENT -DSQLITE_ENABLE_UNLOCK_NOTIFY -DSQLITE_ENABLE_RTREE -DSQLITE_SOUNDEX -DHAVE_USLEEP -DSQLITE_ENABLE_LOAD_EXTENSION -DSQLITE_ENABLE_STAT3 -DSQLITE_ENABLE_STAT4 -DSQLITE_ENABLE_JSON1 -DSQLITE_ENABLE_EXPLAIN_COMMENTS -DSQLITE_DEFAULT_WAL_SYNCHRONOUS=1 -DSQLITE_MAX_VARIABLE_NUMBER=99999 -DSQLITE_DEFAULT_JOURNAL_SIZE_LIMIT=1048576 -DSQLITE_ENABLE_SESSION -DSQLITE_ENABLE_PREUPDATE_HOOK -DSQLITE_ENABLE_DBSTAT_VTAB
  [armeabi-v7a] Compile++ thumb: sqlcipher <= android_database_SQLiteConnection.cpp

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
@developernotes
Copy link
Member

Hi @cschanaj

-DSQLITE_HAS_CODEC must be defined when generating the amalgamation. Did you do that? If you are copying an amalgamation that you did not create, that may be the case.

@developernotes developernotes added the question Further information is requested label May 31, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants