android.mk -l 外部库,警告:…/Android.mk:链接器标志中的非系统库

我在运行$ANDROID_NDK_ROOT / ndk-build时收到此警告.

Android.mk在下面.

$$ANDROID_NDK_ROOT/ndk-build

WARNING:/Users/jwalton/Android-CryptoPP/jni/Android.mk:prng:

non-system libraries in linker flags: -lcryptopp -lstlport_shared

This is likely to result in incorrect builds. Try using LOCAL_STATIC_LIBRARIES

or LOCAL_SHARED_LIBRARIES instead to list the library dependencies of the

current module

...

但是,当我按照说明从LOCAL_LDLIBS中删除-lcryptopp -lstlport_shared时,我会收到与libstlport_shared.so中的符号相关的链接错误. Android.mk文件后面显示了错误示例.

确切地说,ndk-build如何设置Android.mk?

为什么我必须将$(STLPORT_INCL)添加到LOCAL_C_INCLUDES,将$(STLPORT_LIB)添加到LOCAL_LDFLAGS?为什么APP_STL:= stlport_shared没有正确设置STL?

LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)

TARGET_ARCH_ABI := armeabi

TARGET_ABI := android-9-armeabi

CRYPTOPP_INCL := /usr/local/cryptopp-android-9/include

CRYPTOPP_LIB := /usr/local/cryptopp-android-9/lib

STLPORT_INCL := /opt/android-ndk-r9/sources/cxx-stl/stlport/stlport

STLPORT_LIB := /opt/android-ndk-r9/sources/cxx-stl/stlport/libs/armeabi

APP_STL := stlport_shared

APP_MODULES := stlport_shared cryptopp

LOCAL_CPP_FEATURES := rtti exceptions

LOCAL_C_INCLUDES := $(CRYPTOPP_INCL) $(CRYPTOPP_INCL)/cryptopp $(STLPORT_INCL)

LOCAL_LDFLAGS := -L $(CRYPTOPP_LIB) -L $(STLPORT_LIB)

LOCAL_LDLIBS := -lcryptopp -lstlport_shared -llog -landroid

# LOCAL_LDLIBS := -llog -landroid

# LOCAL_SHARED_LIBRARIES := -lcryptopp -lstlport_shared

LOCAL_MODULE := prng

LOCAL_SRC_FILES := libprng.cpp

include $(BUILD_SHARED_LIBRARY)

以下是尝试通过从LOCAL_LDLIBS中删除本地库来遵循建议时的错误示例:

$$ANDROID_NDK_ROOT/ndk-build

Android NDK: WARNING: APP_PLATFORM android-14 is larger than android:minSdkVersion 9 in /Users/jwalton/Android-CryptoPP/AndroidManifest.xml

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

Gdbsetup : libs/armeabi/gdb.setup

Compile++ thumb : prng <= libprng.cpp

SharedLibrary : libprng.so

/opt/android-ndk-r9/toolchains/arm-linux-androideabi-4.6/prebuilt/darwin-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld: /Users/jwalton/Android-CryptoPP/obj/local/armeabi/objs-debug/prng/libprng.o: in function std::__node_alloc::allocate(unsigned int&):/opt/android-ndk-r9/sources/cxx-stl/stlport/stlport/stl/_alloc.h:158: error: undefined reference to 'std::__node_alloc::_M_allocate(unsigned int&)'

/opt/android-ndk-r9/toolchains/arm-linux-androideabi-4.6/prebuilt/darwin-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld: /Users/jwalton/Android-CryptoPP/obj/local/armeabi/objs-debug/prng/libprng.o: in function std::__node_alloc::deallocate(void*, unsigned int):/opt/android-ndk-r9/sources/cxx-stl/stlport/stlport/stl/_alloc.h:161: error: undefined reference to 'std::__node_alloc::_M_deallocate(void*, unsigned int)'

/opt/android-ndk-r9/toolchains/arm-linux-androideabi-4.6/prebuilt/darwin-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld: /Users/jwalton/Android-CryptoPP/obj/local/armeabi/objs-debug/prng/libprng.o: in function std::ios_base::_M_check_exception_mask():/opt/android-ndk-r9/sources/cxx-stl/stlport/stlport/stl/_ios_base.h:193: error: undefined reference to 'std::ios_base::_M_throw_failure()'

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值