0

我在 android omapl138 board 上运行了 dsplink 应用程序。我可以在终端中运行该应用程序。我已将 dsplink 应用程序包含在 ndk 中,并尝试使用以下方法进行编译Android.mk

LOCAL_PATH:= $(call my-dir)

include $(CLEAR_VARS)

LOCAL_LDLIBS += $(LOCAL_PATH)/dsplink.a

LOCAL_C_INCLUDES += C:\dsplink_1_65_01_05_eng\dsplink\gpp\export\INCLUDE\Linux\OMAPL138\sys
LOCAL_C_INCLUDES += C:\dsplink_1_65_01_05_eng\dsplink\gpp\export\INCLUDE\Linux\OMAPL138\usr
LOCAL_C_INCLUDES += C:\dsplink_1_65_01_05_eng\dsplink\gpp\inc\sys\linux
LOCAL_C_INCLUDES += C:\dsplink_1_65_01_05_eng\dsplink\gpp\src\api
LOCAL_C_INCLUDES += C:\dsplink_1_65_01_05_eng\dsplink\gpp\export\INCLUDE\Linux\OMAPL138\internal
LOCAL_C_INCLUDES += C:\dsplink_1_65_01_05_eng\dsplink\gpp\export\INCLUDE\Linux\OMAPL138\sys\arch

LOCAL_MODULE    := libdsp-message
LOCAL_SRC_FILES := message.c message_os.c

include $(BUILD_SHARED_LIBRARY)

在编译时,我收到以下错误

"Compile thumb : dsp-message <= message.c

"Compile thumb : dsp-message <= message_os.c

SharedLibrary  : libdsp-message.so

C:/NDK/android-ndk-r8/samples/two-libs//jni/dsplink.a(dsplink.o): In
function `DRV_Initialize':
_sync_usr.c:(.text+0xb10): undefined reference to `getpagesize' C:/NDK/android-ndk-r8/samples/two-libs//jni/dsplink.a(dsplink.o): In
function `DRV_ProtectInit':
**_sync_usr.c:(.text+0x24b4): undefined reference to `semget'**
_sync_usr.c:(.text+0x24d4): undefined reference to `__errno_location'
_sync_usr.c:(.text+0x24f4): undefined reference to `semget'
_sync_usr.c:(.text+0x2538): undefined reference to `semctl' C:/NDK/android-ndk-r8/samples/two-libs//jni/dsplink.a(dsplink.o): In
function `DRV_ProtectExit':
_sync_usr.c:(.text+0x25dc): undefined reference to `semctl' C:/NDK/android-ndk-r8/samples/two-libs//jni/dsplink.a(dsplink.o): In
function `DRV_ProtectEnter':
_sync_usr.c:(.text+0x26b4): undefined reference to `semop'
_sync_usr.c:(.text+0x26c4): undefined reference to `__errno_location' C:/NDK/android-ndk-r8/samples/two-libs//jni/dsplink.a(dsplink.o): In
function `DRV_ProtectLeave':
_sync_usr.c:(.text+0x2800): undefined reference to `semop' C:/NDK/android-ndk-r8/samples/two-libs//jni/dsplink.a(dsplink.o): In
function `DRV_installCleanupRoutines':
_sync_usr.c:(.text+0x2898): undefined reference to `sigemptyset'
_sync_usr.c:(.text+0x28a4): undefined reference to `sigfillset' C:/NDK/android-ndk-r8/samples/two-libs//jni/dsplink.a(dsplink.o): In
function `NOTIFY_eventWorker':
_sync_usr.c:(.text+0x7ee4): undefined reference to `sigfillset' C:/NDK/android-ndk-r8/samples/two-libs//jni/dsplink.a(dsplink.o): In
function `_SYNC_USR_init':
_sync_usr.c:(.text+0x13ca8): undefined reference to `semget'
_sync_usr.c:(.text+0x13d30): undefined reference to `semctl' C:/NDK/android-ndk-r8/samples/two-libs//jni/dsplink.a(dsplink.o): In
function `_SYNC_USR_exit':
_sync_usr.c:(.text+0x13e34): undefined reference to `semget'
_sync_usr.c:(.text+0x13e84): undefined reference to `semctl' C:/NDK/android-ndk-r8/samples/two-libs//jni/dsplink.a(dsplink.o): In
function `_SYNC_USR_createCS':
_sync_usr.c:(.text+0x14008): undefined reference to `semget'
_sync_usr.c:(.text+0x14020): undefined reference to `__errno_location' C:/NDK/android-ndk-r8/samples/two-libs//jni/dsplink.a(dsplink.o): In
function `_SYNC_USR_enterCS':
_sync_usr.c:(.text+0x14358): undefined reference to `semop'
_sync_usr.c:(.text+0x14368): undefined reference to `__errno_location' C:/NDK/android-ndk-r8/samples/two-libs//jni/dsplink.a(dsplink.o): In
function `_SYNC_USR_leaveCS':
_sync_usr.c:(.text+0x144a0): undefined reference to `semop' collect2: ld returned 1 exit status 

make: ***
[C:/NDK/android-ndk-r8/samples/two-libs//obj/local/armeabi/libdsp-message.so]
Error 1
4

1 回答 1

1

去年 2 月,当我尝试为控制台构建 dsplink 示例时,我曾抱怨过 semget。我的错误看起来类似于您未定义的引用。我发现我的错误是由于我尝试使用标准 Android 划艇项目提供的 libc 构建 dsplink。当我用 TI DSP 源中的 libc 替换 Gingerbread 2.3.4 源分发中的仿生 libc 时,它解决了我所有的 libc 参考错误。从这个经验来看,与 DSP 代码库一起使用的 C 库中对信号量的支持似乎比基本的 Android 仿生库中的支持更多。

建议:我会确保您的 Android.mk 构建指向的用于链接的 C 库是为 DSP 项目提供的 C 库,而不是默认的 Android 仿生 libc。

这应该可以解决您的部分或大部分未定义引用,但我不确定您的 Android.mk 中是否还有其他问题。

于 2012-09-15T14:04:06.710 回答