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

查看:35
本文介绍了通过 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

应用程序.mk

setenv-android.sh 使用 cryptopp 5.6.3 创建 libcryptopp.a 和 .so 时

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] 可执行文件:源文件

[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: error: undefined reference to '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.aranlib>.不幸的是,我不知道如何告诉 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

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

脚本 setenv-android.sh 使用 STLport,因为 GNU 许可保留.您的 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++、[Favorite library] 必须使用相同的 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 中有一个 README 讨论它.我认为它称为 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天全站免登陆