通过ndk-build构建libcryptopp.a时没有存档符号表(运行ranlib) [英] no archive symbol table (run ranlib) while building libcryptopp.a through ndk-build

查看:437
本文介绍了通过ndk-build构建libcryptopp.a时没有存档符号表(运行ranlib)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在这里,我试图通过ndk-build来构建libcryptopp.a,但是出现如下所示的错误.

Here i am trying to build libcryptopp.a through ndk-build but i getting error as shown below.

Android.mk

Android.mk

Application.mk

Application.mk

setenv-android.sh

setenv-android.sh its while creating libcryptopp.a and .so by using cryptopp 5.6.3

在终端中产生以下错误

$/Users/kasbahapple/Documents/AndroidDocs/AndroidADT/adt-bundle-mac-x86_64-20140702/sdk/ndk-bundle/ndk-build

$ /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] Gdbserver : [arm-linux-androideabi-4.8] libs/armeabi/gdbserver

[armeabi] Gdbsetup:libs/armeabi/gdb.setup

[armeabi] Gdbsetup : libs/armeabi/gdb.setup

[armeabi-v7a] Gdbserver:[arm-linux-androideabi-4.8] libs/armeabi-v7a/gdbserver

[armeabi-v7a] Gdbserver : [arm-linux-androideabi-4.8] libs/armeabi-v7a/gdbserver

[armeabi-v7a] Gdbsetup:libs/armeabi-v7a/gdb.setup

[armeabi-v7a] Gdbsetup : libs/armeabi-v7a/gdb.setup

[x86] Gdbserver:[x86-4.8] libs/x86/gdbserver

[x86] Gdbserver : [x86-4.8] libs/x86/gdbserver

[x86] Gdbsetup:libs/x86/gdb.setup

[x86] Gdbsetup : libs/x86/gdb.setup

[armeabi]可执行文件:source_file

[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:错误:jni/nativelib/libcryptopp.a:没有存档符号表(运行ranlib)

/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:错误:未定义对"main"的引用

/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:错误:ld返回1个退出状态

collect2: error: ld returned 1 exit status

我真的很努力通过NDK构建c ++静态库.

I really struggling to build c++ static library through NDK.

我正在寻找解决方案.如果我做错了,请给我完整的步骤.

I looking for solution. Give me a complete steps if i doing wrong.

推荐答案

在通过ndk-build构建libcryptopp.a时没有存档符号表(运行ranlib)

no archive symbol table (run ranlib) while building libcryptopp.a through ndk-build

通过 Android.mk 构建Crypto ++库后,需要在libcryptopp.a上运行ranlib.不幸的是,我不知道如何告诉Android.mk运行ranlib .

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.

我正在猜测-纯粹是猜测-您必须在Android.mk中分两步执行此操作.您无法直接追逐并直接从源代码构建共享库.

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.

  • 构建libcryptopp.a,运行ranlib
  • libcryptopp.a
  • 构建libcryptopp.so
  • build libcryptopp.a, running ranlib
  • build libcryptopp.so from libcryptopp.a

setenv-android.sh,同时使用cryptopp 5.6.3创建libcryptopp.a和.so
...
APP_STL = gnustl_static

setenv-android.sh its while creating libcryptopp.a and .so by using cryptopp 5.6.3
...
APP_STL = gnustl_static

由于GNU许可限制,脚本setenv-android.sh使用STLport.您的Android.mk使用GNU的STL.

The script setenv-android.sh uses STLport because of GNU licensing encumbrances. Your Android.mk uses GNU's STL.

您可能还应该使用相同的C ++运行时库.此外,所有库必须使用相同的运行时.这意味着OpenGL,Crypto ++,[收藏夹库]必须使用相同的C ++运行时,并且没有混合和匹配.另外,由于多个库正在使用C ++运行时,因此必须使用共享库,而不是静态库.

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.

NDK的某个地方有一个自述文件对此进行了讨论.我认为它叫CPP-README或类似名称.

There's a README in the NDK somewhere that discusses it. I think its called CPP-README or similar.

此外,当您调用setenv-android.sh时,您 必须 包含一个前导点.然后运行GNUmakefile-cross:

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


最后,请不要发布图片.因为我的眼睛老了,我几乎看不懂它们.通常,取悦一个用户并不重要.在这种情况下,我是编写脚本和Wiki页面的人,所以您想让我轻松一点,而不是让我很难:)


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 :)

这篇关于通过ndk-build构建libcryptopp.a时没有存档符号表(运行ranlib)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆