4
我有一個預建的共享庫,名爲「tshark.so」,我試圖鏈接每當我建立另一個共享庫(libwireshark_helper.so)。 libtshark.so位於$(LOCAL_PATH)中。這裏是我的Android.mk未定義的引用鏈接Android中的預構建共享庫與NDK
LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
NDK_MODULE_PATH := $(LOCAL_PATH)
LOCAL_SRC_FILES:= wireshark_helper.c
LOCAL_MODULE := libwireshark_helper
LOCAL_PREBUILT_LIBS := libtshark.so
LOCAL_C_INCLUDES += jni/libusb-compat/libusb jni/wispy jni/libpcap jni/libwireshark jni/libglib jni/libglib/glib jni/libglib/android jni/libwireshark/epan jni/libwireshark/epan/dissectors
LOCAL_SHARED_LIBRARIES := libc libusb libusb-compat libwispy libpcap libglib-2.0 libgmodule-2.0 libnl libtshark
LOCAL_LDLIBS := -L$(SYSROOT)/usr/lib -L$(LOCAL_PATH) -llog -ltshark -lgcc -lz
include $(BUILD_SHARED_LIBRARY)
例如,「tshark的」庫包含了該方法的tshark_log_handler「這裏所示:
$ arm-eabi-nm libtshark.so | grep tshark_log_handler
005d298c t tshark_log_handler
然而,當我試圖打造,我得到的錯誤:
SharedLibrary : libwireshark_helper.so
/Users/gnychis/Documents/android-ndk-r5b/toolchains/arm-linux-androideabi-4.4.3/prebuilt/darwin-x86/bin/arm-linux-androideabi-g++ -Wl,-soname,libwireshark_helper.so -shared --sysroot=/Users/gnychis/Documents/android-ndk-r5b/platforms/android-9/arch-arm /Users/gnychis/Documents/workspace/CoexiSyst/obj/local/armeabi/objs-debug/wireshark_helper/wireshark_helper.o /Users/gnychis/Documents/workspace/CoexiSyst/obj/local/armeabi/libusb.so /Users/gnychis/Documents/workspace/CoexiSyst/obj/local/armeabi/libusb-compat.so /Users/gnychis/Documents/workspace/CoexiSyst/obj/local/armeabi/libwispy.so /Users/gnychis/Documents/workspace/CoexiSyst/obj/local/armeabi/libpcap.so /Users/gnychis/Documents/workspace/CoexiSyst/obj/local/armeabi/libglib-2.0.so /Users/gnychis/Documents/workspace/CoexiSyst/obj/local/armeabi/libgmodule-2.0.so /Users/gnychis/Documents/workspace/CoexiSyst/obj/local/armeabi/libnl.so /Users/gnychis/Documents/android-ndk-r5b/platforms/android-9/arch-arm/usr/lib/libc.so /Users/gnychis/Documents/android-ndk-r5b/platforms/android-9/arch-arm/usr/lib/libstdc++.so /Users/gnychis/Documents/android-ndk-r5b/platforms/android-9/arch-arm/usr/lib/libm.so -Wl,--no-undefined -Wl,-z,noexecstack -L/Users/gnychis/Documents/android-ndk-r5b/platforms/android-9/arch-arm/usr/lib -L/Users/gnychis/Documents/android-ndk-r5b/platforms/android-9/arch-arm/usr/lib -L/Users/gnychis/Documents/workspace/CoexiSyst/jni/libwireshark -llog -ltshark -lgcc -lz -Wl,-rpath-link=/Users/gnychis/Documents/android-ndk-r5b/platforms/android-9/arch-arm/usr/lib -lsupc++ -o /Users/gnychis/Documents/workspace/CoexiSyst/obj/local/armeabi/libwireshark_helper.so
/Users/gnychis/Documents/workspace/CoexiSyst/obj/local/armeabi/objs-debug/wireshark_helper/wireshark_helper.o: In function `Java_com_gnychis_coexisyst_CoexiSyst_wiresharkHello':
/Users/gnychis/Documents/workspace/CoexiSyst/jni/libwireshark/wireshark_helper.c:124: undefined reference to `tshark_log_handler'
爲什麼我應該得到一個未定義的參考?它在我的共享庫中,並且在我的gcc命令中有一個「-ltshark」。我沒有得到一個錯誤,它無法找到這個庫。