Error building android-sqlcipher, tips like this :sqlite3_android.h:26:32: error: 'sqlite3' was not declared in this scope


#1

HI EveryOne

I try to build android-sqlcipher on,so I download android -ndk and android -sdk on ubuntu 12.04 .

I use command "git clone " to download sqlcipher,then i use command "make init " to download the submodule.

It seems that all goes well,but when I use the last command “make”,I failed ,the tips like this:

sqlite3_android.h:26:32: error: ‘sqlite3’ was not declared in this scope

could someone helpme?how can I fix it?

Thanks Everyone
.


#2

Hello @pan

Can you upload the exact build output on your machine, that would help in resolving the specific issue you are seeing. Thanks!


#3

Hello, I have the same situation when build sqlcipher for android project. my environment is below:

  1. os: centos 6.5
  2. android-ndk: r9d
  3. android-sdk: r24.4.1. and download android 4.4.2(r19)
  4. java 7 update 80

and here is my build output.

Please help me to build sqlcipher project.
Thank you.


#4

Hello @cchuang4

It looks as if the value from faketime may be causing an issue with your build. Could you try removing faketime from your PATH and attempt a new build?


#5

Hello,
Thank you for reply this issue. I removed faketime and errors were still there. and here is my build output after removing faketime.


#6

Hi @cchuang4

Did you previously run make init before you execute make?


#7

Hello,
I ran ‘make init’ before ‘make’. ‘make init’ would download some library at external directory.below is the info of my external directory.

[adminuser@localhost external] ls -al total 104 drwxrwxr-x. 11 adminuser adminuser 4096 Dec 23 17:44 . drwxr-xr-x. 9 adminuser adminuser 4096 Dec 28 13:59 .. drwxrwxr-x. 5 adminuser adminuser 4096 Dec 18 15:48 android-libs -rw-rw-r--. 1 adminuser adminuser 19410 Dec 18 15:48 Android.mk drwxr-xr-x. 5 adminuser adminuser 4096 Dec 23 11:36 android-sqlite drwxr-xr-x. 16 adminuser adminuser 4096 Dec 23 11:42 dalvik drwxr-xr-x. 16 adminuser adminuser 4096 Dec 23 12:09 icu4c drwxrwxr-x. 3 adminuser adminuser 4096 Dec 18 15:48 includes drwxr-xr-x. 23 adminuser adminuser 4096 Dec 23 17:15 openssl drwxr-xr-x. 31 adminuser adminuser 4096 Dec 23 17:01 platform-frameworks-base drwxr-xr-x. 33 adminuser adminuser 4096 Dec 23 17:08 platform-system-core drwxr-xr-x. 14 adminuser adminuser 4096 Dec 23 17:29 sqlcipher -rw-rw-r--. 1 adminuser adminuser 15291 Dec 18 15:48 String16.cpp -rw-rw-r--. 1 adminuser adminuser 23019 Dec 18 15:48 String8.cpp [adminuser@localhost external] pwd
/home/adminuser/Documents/sqlcipher/android-database-sqlcipher/external


#8

Hello @cchuang4

Can you run specific sub tasks? What is the output from executing make build-external? Do you have a specific need for building SQLCipher for Android from source, or is the distributed .aar package acceptable?


#9

Hello,
Below is the output of executing ‘make build-external’.
Because our APP using sqlcipher crashed at Android 6.0, so we try to find the latest version of sqlcipher, but there is no binary file to download from sqlcipher official website.
What is the distributed .aar package? Could you give me some infomation about this.

Many thanks

which: no faketime in (/usr/local/rvm/gems/ruby-1.9.3-p547/bin:/usr/local/rvm/gems/ruby-1.9.3-p547@global/bin:/usr/local/rvm/rubies/ruby-1.9.3-p547/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin:/usr/local/rvm/bin:/home/adminuser/bin:/home/adminuser/Documents/sqlcipher/jdk1.7.0_80/bin:/home/adminuser/Documents/sqlcipher/android-ndk-r9d:/home/adminuser/Documents/sqlcipher/android-sdk-linux/build-tools/23.0.2:/home/adminuser/Documents/sqlcipher/android-sdk-linux/tools)
cd /home/adminuser/Documents/sqlcipher/android-database-sqlcipher/external &&
make -f Android.mk build-local-hack &&
ndk-build NDK_LIBS_OUT=/home/adminuser/Documents/sqlcipher/android-database-sqlcipher/external/libs &&
make -f Android.mk copy-libs-hack
make[1]: Entering directory /home/adminuser/Documents/sqlcipher/android-database-sqlcipher/external' make[1]: Nothing to be done forbuild-local-hack’.
make[1]: Leaving directory /home/adminuser/Documents/sqlcipher/android-database-sqlcipher/external' Android NDK: WARNING:/home/adminuser/Documents/sqlcipher/android-database-sqlcipher/external/Android.mk:icui18n: LOCAL_LDLIBS is always ignored for static libraries Android NDK: WARNING:/home/adminuser/Documents/sqlcipher/android-database-sqlcipher/external/Android.mk:icui18n: non-system libraries in linker flags: -lpthread Android NDK: This is likely to result in incorrect builds. Try using LOCAL_STATIC_LIBRARIES Android NDK: or LOCAL_SHARED_LIBRARIES instead to list the library dependencies of the Android NDK: current module Android NDK: WARNING:/home/adminuser/Documents/sqlcipher/android-database-sqlcipher/external/Android.mk:icuuc: LOCAL_LDLIBS is always ignored for static libraries Android NDK: WARNING:/home/adminuser/Documents/sqlcipher/android-database-sqlcipher/external/Android.mk:icuuc: non-system libraries in linker flags: -lpthread Android NDK: This is likely to result in incorrect builds. Try using LOCAL_STATIC_LIBRARIES Android NDK: or LOCAL_SHARED_LIBRARIES instead to list the library dependencies of the Android NDK: current module Android NDK: WARNING:/home/adminuser/Documents/sqlcipher/android-database-sqlcipher/external/Android.mk:sqlcipher: LOCAL_LDFLAGS is always ignored for static libraries make[1]: Entering directory/home/adminuser/Documents/sqlcipher/android-database-sqlcipher/external’
/home/adminuser/Documents/sqlcipher/android-database-sqlcipher/external/Android.mk:16: warning: overriding commands for target sqlcipher/sqlite3.c' /home/adminuser/Documents/sqlcipher/android-database-sqlcipher/external/Android.mk:16: warning: ignoring old commands for targetsqlcipher/sqlite3.c’
/home/adminuser/Documents/sqlcipher/android-database-sqlcipher/external/Android.mk:20: warning: overriding commands for target copy-libs-hack' /home/adminuser/Documents/sqlcipher/android-database-sqlcipher/external/Android.mk:20: warning: ignoring old commands for targetcopy-libs-hack’
Android NDK: WARNING:/home/adminuser/Documents/sqlcipher/android-database-sqlcipher/external/Android.mk:icui18n: LOCAL_LDLIBS is always ignored for static libraries
Android NDK: WARNING:/home/adminuser/Documents/sqlcipher/android-database-sqlcipher/external/Android.mk:icui18n: non-system libraries in linker flags: -lpthread
Android NDK: This is likely to result in incorrect builds. Try using LOCAL_STATIC_LIBRARIES
Android NDK: or LOCAL_SHARED_LIBRARIES instead to list the library dependencies of the
Android NDK: current module
Android NDK: WARNING:/home/adminuser/Documents/sqlcipher/android-database-sqlcipher/external/Android.mk:icuuc: LOCAL_LDLIBS is always ignored for static libraries
Android NDK: WARNING:/home/adminuser/Documents/sqlcipher/android-database-sqlcipher/external/Android.mk:icuuc: non-system libraries in linker flags: -lpthread
Android NDK: This is likely to result in incorrect builds. Try using LOCAL_STATIC_LIBRARIES
Android NDK: or LOCAL_SHARED_LIBRARIES instead to list the library dependencies of the
Android NDK: current module
Android NDK: WARNING:/home/adminuser/Documents/sqlcipher/android-database-sqlcipher/external/Android.mk:sqlcipher: LOCAL_LDFLAGS is always ignored for static libraries
/home/adminuser/Documents/sqlcipher/android-database-sqlcipher/external/Android.mk:16: warning: overriding commands for target sqlcipher/sqlite3.c' /home/adminuser/Documents/sqlcipher/android-database-sqlcipher/external/Android.mk:16: warning: ignoring old commands for targetsqlcipher/sqlite3.c’
/home/adminuser/Documents/sqlcipher/android-database-sqlcipher/external/Android.mk:20: warning: overriding commands for target copy-libs-hack' /home/adminuser/Documents/sqlcipher/android-database-sqlcipher/external/Android.mk:20: warning: ignoring old commands for targetcopy-libs-hack’
Android NDK: WARNING:/home/adminuser/Documents/sqlcipher/android-database-sqlcipher/external/Android.mk:icui18n: LOCAL_LDLIBS is always ignored for static libraries
Android NDK: WARNING:/home/adminuser/Documents/sqlcipher/android-database-sqlcipher/external/Android.mk:icui18n: non-system libraries in linker flags: -lpthread
Android NDK: This is likely to result in incorrect builds. Try using LOCAL_STATIC_LIBRARIES
Android NDK: or LOCAL_SHARED_LIBRARIES instead to list the library dependencies of the
Android NDK: current module
Android NDK: WARNING:/home/adminuser/Documents/sqlcipher/android-database-sqlcipher/external/Android.mk:icuuc: LOCAL_LDLIBS is always ignored for static libraries
Android NDK: WARNING:/home/adminuser/Documents/sqlcipher/android-database-sqlcipher/external/Android.mk:icuuc: non-system libraries in linker flags: -lpthread
Android NDK: This is likely to result in incorrect builds. Try using LOCAL_STATIC_LIBRARIES
Android NDK: or LOCAL_SHARED_LIBRARIES instead to list the library dependencies of the
Android NDK: current module
Android NDK: WARNING:/home/adminuser/Documents/sqlcipher/android-database-sqlcipher/external/Android.mk:sqlcipher: LOCAL_LDFLAGS is always ignored for static libraries
[armeabi] Compile++ thumb: sqlcipher_android <= sqlite3_android.cpp
In file included from /home/adminuser/Documents/sqlcipher/android-database-sqlcipher/external/android-sqlite/android/sqlite3_android.cpp:30:0:
/home/adminuser/Documents/sqlcipher/android-database-sqlcipher/external/android-sqlite/android/sqlite3_android.h:26:32: error: ‘sqlite3’ was not declared in this scope
/home/adminuser/Documents/sqlcipher/android-database-sqlcipher/external/android-sqlite/android/sqlite3_android.h:26:42: error: ‘handle’ was not declared in this scope
/home/adminuser/Documents/sqlcipher/android-database-sqlcipher/external/android-sqlite/android/sqlite3_android.h:26:50: error: expected primary-expression before ‘int’
/home/adminuser/Documents/sqlcipher/android-database-sqlcipher/external/android-sqlite/android/sqlite3_android.h:26:66: error: expression list treated as compound expression in initializer [-fpermissive]
/home/adminuser/Documents/sqlcipher/android-database-sqlcipher/external/android-sqlite/android/sqlite3_android.h:28:34: error: ‘sqlite3’ was not declared in this scope
/home/adminuser/Documents/sqlcipher/android-database-sqlcipher/external/android-sqlite/android/sqlite3_android.h:28:43: error: ‘handle’ was not declared in this scope
/home/adminuser/Documents/sqlcipher/android-database-sqlcipher/external/android-sqlite/android/sqlite3_android.h:28:51: error: expected primary-expression before ‘const’
/home/adminuser/Documents/sqlcipher/android-database-sqlcipher/external/android-sqlite/android/sqlite3_android.h:28:77: error: expected primary-expression before ‘int’
/home/adminuser/Documents/sqlcipher/android-database-sqlcipher/external/android-sqlite/android/sqlite3_android.h:28:93: error: expression list treated as compound expression in initializer [-fpermissive]
/home/adminuser/Documents/sqlcipher/android-database-sqlcipher/external/android-sqlite/android/sqlite3_android.cpp:80:5: error: variable or field ‘get_phonebook_index’ declared void
/home/adminuser/Documents/sqlcipher/android-database-sqlcipher/external/android-sqlite/android/sqlite3_android.cpp:80:5: error: ‘sqlite3_context’ was not declared in this scope
/home/adminuser/Documents/sqlcipher/android-database-sqlcipher/external/android-sqlite/android/sqlite3_android.cpp:80:23: error: ‘context’ was not declared in this scope
/home/adminuser/Documents/sqlcipher/android-database-sqlcipher/external/android-sqlite/android/sqlite3_android.cpp:80:32: error: expected primary-expression before ‘int’
/home/adminuser/Documents/sqlcipher/android-database-sqlcipher/external/android-sqlite/android/sqlite3_android.cpp:80:42: error: ‘sqlite3_value’ was not declared in this scope
/home/adminuser/Documents/sqlcipher/android-database-sqlcipher/external/android-sqlite/android/sqlite3_android.cpp:80:59: error: ‘argv’ was not declared in this scope
make[1]: *** [/home/adminuser/Documents/sqlcipher/android-database-sqlcipher/obj/local/armeabi/objs/sqlcipher_android/android-sqlite/android/sqlite3_android.o] Error 1
make[1]: Leaving directory `/home/adminuser/Documents/sqlcipher/android-database-sqlcipher/external’
make: *** [build-external] Error 2


#10

Hi @cchuang4

The community version is now distributed as an AAR package. More information about our latest release using AAR can be found here. Would you try deleting the SQLCipher for Android directory and clone it again, to verify there wasn’t an issue with the initial clone? I’m wondering if there was an issue when you initialized the submodules.


#11

Hello,
Thank you for your reply. I clean all file and try make init, make again. This time it works. Finally it outputs the files we want. I guess at my first time, the build procedure is failed many times and I just add the missing library like glibc, ant etc. and try again.

Now I have another problem, when I build a sqlcipher sample project , it will work perfectly. But my app will load two NDK library, one is sqlcipher, the other is a VoIP library. In my project sqlcipher still have the same error below. Could you have any idea to help me to solve this situation?

java.lang.UnsatisfiedLinkError: dlopen failed: cannot locate symbol “_ZN7android25gDarwinCantLoadAllObjectsE” referenced by “/data/app/com.cht.chtphone-1/lib/arm/libsqlcipher_android.so”…

Many thanks