问题
Here i am trying to build libcryptopp.a through ndk-build but i getting error as shown below.
Android.mk
Application.mk
setenv-android.sh its while creating libcryptopp.a and .so by using cryptopp 5.6.3
Error produced in terminal as below
$ /Users/kasbahapple/Documents/AndroidDocs/AndroidADT/adt-bundle-mac-x86_64-20140702/sdk/ndk-bundle/ndk-build
[armeabi] Gdbserver : [arm-linux-androideabi-4.8] libs/armeabi/gdbserver
[armeabi] Gdbsetup : libs/armeabi/gdb.setup
[armeabi-v7a] Gdbserver : [arm-linux-androideabi-4.8] libs/armeabi-v7a/gdbserver
[armeabi-v7a] Gdbsetup : libs/armeabi-v7a/gdb.setup
[x86] Gdbserver : [x86-4.8] libs/x86/gdbserver
[x86] Gdbsetup : libs/x86/gdb.setup
[armeabi] Executable : source_file
/Users/kasbahapple/Documents/AndroidDocs/AndroidADT/adt-bundle-mac-x86_64-20140702/sdk/ndk-bundle/toolchains/arm-linux-androideabi-4.8/prebuilt/darwin-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.8/../../../../arm-linux-androideabi/bin/ld: error: jni/nativelib/libcryptopp.a: no archive symbol table (run ranlib)
/Users/kasbahapple/Documents/AndroidDocs/AndroidADT/adt-bundle-mac-x86_64-20140702/sdk/ndk-bundle/platforms/android-8/arch-arm/usr/lib/crtbegin_dynamic.o:crtbrand.c:function _start: error: undefined reference to 'main'
collect2: error: ld returned 1 exit status
I really struggling to build c++ static library through NDK.
I looking for solution. Give me a complete steps if i doing wrong.
回答1:
no archive symbol table (run ranlib) while building libcryptopp.a through ndk-build
After you build the Crypto++ library through Android.mk
, you need to run ranlib
on libcryptopp.a
. Unfortunately, I don't know how to tell Android.mk to run ranlib.
I'm guessing - and its purely a guess - that you have to do this in two steps in Android.mk. You cannot cut to the chase and build the shared object directly from sources.
- build
libcryptopp.a
, runningranlib
- build
libcryptopp.so
fromlibcryptopp.a
setenv-android.sh its while creating libcryptopp.a and .so by using cryptopp 5.6.3
...
APP_STL = gnustl_static
The script setenv-android.sh
uses STLport because of GNU licensing encumbrances. Your Android.mk
uses GNU's STL.
You should probably also use the same C++ runtime libraries. Additionally, all libraries must use the same runtime. That means OpenGL, Crypto++, [Favorite library], must use the same C++ runtime, and there's no mixing and matching. In addition, because multiple libraries are using the C++ runtime, you must use the shared object, and not the static version.
There's a README in the NDK somewhere that discusses it. I think its called CPP-README or similar.
Also, when you invoke the setenv-android.sh
, you must include a leading dot. Then you run the GNUmakefile-cross
:
. ./setenv-android.sh
make -f GNUmakefile-cross static dynamic cryptest.exe
Finally, please don't post pictures. I can barely read them because my eyes are old. Usually, appeasing one user does not matter. In this case, I'm the guy who wrote the scripts and the wiki pages, so you want to make it easy on me, and not hard on me :)
来源:https://stackoverflow.com/questions/34043538/no-archive-symbol-table-run-ranlib-while-building-libcryptopp-a-through-ndk-bu