链接Android上的OpenSSL和未定义的引用

时间:2016-07-04 21:30:41

标签: android android-ndk openssl

我尝试在我的项目中编译openssl 1.0.2h

我已经使用了Openssl

这些步骤

要将库作为预构建的静态库添加到我的项目中,我在我的jni目录下创建了一个openssl文件夹,其中包含lib /(包含我支持的体系结构的.a文件),include /包含必要的包含(你可以在你下载的openssl版本和Android.mk下找到,其中包含以下内容:

include $(CLEAR_VARS) 
LOCAL_MODULE := libssl
LOCAL_SRC_FILES := lib/$(TARGET_ARCH_ABI)/libssl.a
include $(PREBUILT_STATIC_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := libcrypto
LOCAL_SRC_FILES := lib/$(TARGET_ARCH_ABI)/libcrypto.a
include $(PREBUILT_STATIC_LIBRARY)

然后,要在另一个jni模块中使用该库,我将以下内容添加到其Android.mk文件中:

LOCAL_C_INCLUDES := $(LOCAL_PATH)/../openssl/include
LOCAL_STATIC_LIBRARIES := libssl libcrypto

我得到了这个:

jni/openssl/lib/armeabi-v7a/libcrypto.a(armcap.o):armcap.c:function OPENSSL_cpuid_setup: error: undefined reference to 'sigfillset'
jni/openssl/lib/armeabi-v7a/libcrypto.a(armcap.o):armcap.c:function OPENSSL_cpuid_setup: error: undefined reference to 'sigdelset'
jni/openssl/lib/armeabi-v7a/libcrypto.a(armcap.o):armcap.c:function OPENSSL_cpuid_setup: error: undefined reference to 'sigdelset'
jni/openssl/lib/armeabi-v7a/libcrypto.a(armcap.o):armcap.c:function OPENSSL_cpuid_setup: error: undefined reference to 'sigdelset'
jni/openssl/lib/armeabi-v7a/libcrypto.a(armcap.o):armcap.c:function OPENSSL_cpuid_setup: error: undefined reference to 'sigdelset'
jni/openssl/lib/armeabi-v7a/libcrypto.a(ui_openssl.o):ui_openssl.c:function open_console: error: undefined reference to 'tcgetattr'
jni/openssl/lib/armeabi-v7a/libcrypto.a(ui_openssl.o):ui_openssl.c:function read_string_inner: error: undefined reference to 'signal'
jni/openssl/lib/armeabi-v7a/libcrypto.a(ui_openssl.o):ui_openssl.c:function read_string_inner: error: undefined reference to 'tcsetattr'
jni/openssl/lib/armeabi-v7a/libcrypto.a(ui_openssl.o):ui_openssl.c:function read_string_inner: error: undefined reference to 'tcsetattr'
collect2: error: ld returned 1 exit status
make[1]: *** [obj/local/armeabi-v7a/libpjsipjni.so] Error 1
make[1]: *** Waiting for unfinished jobs....
jni/openssl/lib/armeabi/libcrypto.a(ui_openssl.o):ui_openssl.c:function open_console: error: undefined reference to 'tcgetattr'
jni/openssl/lib/armeabi/libcrypto.a(ui_openssl.o):ui_openssl.c:function read_string_inner: error: undefined reference to 'signal'
jni/openssl/lib/armeabi/libcrypto.a(ui_openssl.o):ui_openssl.c:function read_string_inner: error: undefined reference to 'tcsetattr'
jni/openssl/lib/armeabi/libcrypto.a(ui_openssl.o):ui_openssl.c:function read_string_inner: error: undefined reference to 'tcsetattr'
collect2: error: ld returned 1 exit status
make[1]: *** [obj/local/armeabi/libpjsipjni.so] Error 1
jni/openssl/lib/x86/libcrypto.a(ui_openssl.o):ui_openssl.c:function open_console: error: undefined reference to 'tcgetattr'
jni/openssl/lib/x86/libcrypto.a(ui_openssl.o):ui_openssl.c:function read_string_inner: error: undefined reference to 'signal'
jni/openssl/lib/x86/libcrypto.a(ui_openssl.o):ui_openssl.c:function read_string_inner: error: undefined reference to 'tcsetattr'
jni/openssl/lib/x86/libcrypto.a(ui_openssl.o):ui_openssl.c:function read_string_inner: error: undefined reference to 'tcsetattr'
collect2: error: ld returned 1 exit status
make[1]: *** [obj/local/x86/libpjsipjni.so] Error 1
jni/openssl/lib/mips/libcrypto.a(ui_openssl.o): In function `open_console':
ui_openssl.c:(.text.open_console+0xb4): undefined reference to `tcgetattr'
jni/openssl/lib/mips/libcrypto.a(ui_openssl.o): In function `read_string_inner':
ui_openssl.c:(.text.read_string_inner+0xf0): undefined reference to `signal'
ui_openssl.c:(.text.read_string_inner+0x2c0): undefined reference to `tcsetattr'
ui_openssl.c:(.text.read_string_inner+0x39c): undefined reference to `tcsetattr'
collect2: error: ld returned 1 exit status

请,我需要帮助

0 个答案:

没有答案