Heya, 我無法構建我開發的ndk/jni共享庫。我希望重新使用平臺附帶的libjpeg(/system/lib/libjpeg.so),但是我無法獲得它的鏈接。當我建立我的共享庫,我得到...未能鏈接到jni/ndk共享庫中的libjpeg.so
/home/blink/workspace_android2/HackBitmapJNI/jni/jnijpeg/JNIBmp.cpp:94: undefined reference to `jpeg_std_error(jpeg_error_mgr*)'
/home/blink/workspace_android2/HackBitmapJNI/jni/jnijpeg/JNIBmp.cpp:96: undefined reference to `jpeg_CreateDecompress(jpeg_decompress_struct*, int, unsigned int)'
/home/blink/workspace_android2/HackBitmapJNI/jni/jnijpeg/JNIBmp.cpp:98: undefined reference to `jpeg_stdio_src(jpeg_decompress_struct*, __sFILE*)'
/home/blink/workspace_android2/HackBitmapJNI/jni/jnijpeg/JNIBmp.cpp:100: undefined reference to `jpeg_read_header(jpeg_decompress_struct*, int)'
/home/blink/workspace_android2/HackBitmapJNI/jni/jnijpeg/JNIBmp.cpp:102: undefined reference to `jpeg_start_decompress(jpeg_decompress_struct*)'
/home/blink/workspace_android2/HackBitmapJNI/jni/jnijpeg/JNIBmp.cpp:124: undefined reference to `jpeg_read_scanlines(jpeg_decompress_struct*, unsigned char**, unsigned int)'
/home/blink/workspace_android2/HackBitmapJNI/jni/jnijpeg/JNIBmp.cpp:130: undefined reference to `jpeg_destroy_decompress(jpeg_decompress_struct*)'
collect2: ld returned 1 exit status
make: *** [/home/blink/workspace_android2/HackBitmapJNI/obj/local/armeabi/libjnijpeg.so] Error 1*
基本上是每一個符號,我需要解決了在運行時libjpeg.so的...
我已經libjpeg.so複製過的我的模擬器和我的項目目錄下的'lib'。當我在libjpeg.so的副本上運行'arm-eabi-readelf -s'時,我可以看到上面定義的所有符號(我看不到方法簽名..只是名稱..是否有方法來轉儲簽名/命名空間??)
我Android.mk是如下...
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_C_INCLUDES := /opt/android_src/dalvik/libnativehelper/include/nativehelper \
/opt/android_src/frameworks/base/include \
/opt/android_src/system/core/include \
/opt/android_src/dalvik/libnativehelper/include \
/opt/android_src/external/stlport/stlport \
/opt/android_src/external/jpeg \
/opt/android_src/bionic
LOCAL_LDFLAGS += -Llib
LOCAL_MODULE := jnijpeg
LOCAL_SRC_FILES := JNIBmp.cpp
LOCAL_LDLIBS := -lm -llog -ljpeg -landroid_runtime
include $(BUILD_SHARED_LIBRARY)
謝謝各位大大的幫助!
我無法在SDK或NDK目錄中找到libjpeg.so。它到底在哪裏?我會嘗試將「.so」文件放入適當的\ ndk \ build \ platforms \ \ arch-arm \ usr \ lib目錄中。項目\ libs目錄可能只是爲了構建java系統。 –
BitBank
2011-03-06 19:20:34
你有沒有得到你的答案?因爲我也有這種錯誤。 – 2011-08-26 14:01:15