3
我試圖使用Android-OpenSSLibraries進行AES解密的簡單測試程序。編譯器/鏈接器向我顯示一個錯誤。編譯:Android NDK編譯器openssl發生錯誤
error: undefined reference to 'AES_set_encrypt_key'
error: undefined reference to 'AES_encrypt'
error: undefined reference to 'AES_set_decrypt_key'
這是我的Android.mk文件,
LOCAL_PATH := $(call my-dir)
$(info $(LOCAL_PATH))
include $(CLEAR_VARS)
LOCAL_MODULE := demo
LOCAL_CFLAGS := -I/some/include/path
LOCAL_LDLIBS := \
-llog \
-lz \
-lm \
LOCAL_SRC_FILES := \
aes_api.c \
io_module.cpp \
jni_native.cpp \
JniConstants.cpp \
JNIHelp.cpp \
libcrypto.so \
PosixFile.cpp \
LOCAL_C_INCLUDES := \
$(LOCAL_PATH)/include \
$(LOCAL_PATH)/include/openssl
$(info $(LOCAL_C_INCLUDES))
LOCAL_SHARED_LIBRARIES := \
$(LOCAL_PATH)/libcrypto.so
include $(BUILD_SHARED_LIBRARY)
是的,你是right.But我照你說的,編譯器顯示我的另一個錯誤此鏈接:LOCAL_SRC_FILES應指向一個文件結尾「.a」以下文件不受支持:/libcrypto.so – user4073982 2014-09-24 09:47:58
@ user4073982這很奇怪,我使用它,而且'PREBUILT_SHARED_LIBRARY'的文檔明確地說:「與'BUILD_SHARED_LIBRARY'和'BUILD_STATIC_LIBRARY'不同,'LOCAL_SRC_FILES '必須是預建的共享庫的單一路徑(例如, 'foo/libfoo.so'),而不是源文件。「 – JBL 2014-09-24 09:52:12
是的,LOCAL_SRC_FILES是共享庫的路徑,在mk文件中是LOCAL_SRC_FILES:= $(LOCA_PATH)/libcrypto.so,但我不知道在哪裏 – user4073982 2014-09-24 09:59:56