本文介绍了连接故障使用Android NDK R5B静态库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

最近升级到NDK R5B,并构建失败,未定义的引用到位于静态库函数。

下面是误差

<$p$p><$c$c>/home/brian/workspace/VoiceEngineDemo/obj/local/armeabi-v7a/objs-debug/voiceenginejni/voice_engine_jni.o:在功能上`initVE:
/home/brian/workspace/VoiceEngineDemo/jni/voice_engine_jni.c:944:未定义的引用`VE_ADT_create

这似乎链接过程没有加载,即使它是在Android.mk定义的静态模块如下:

  LOCAL_PATH:= $(叫我-DIR)包括$(CLEAR_VARS)LOCAL_MODULE:= voiceenginejniLOCAL_SRC_FILES:= voice_engine_jni.c printing.c jaudio.c etime.cLOCAL_CFLAGS:= -D __arm -D ANDROID -D USE_AEC_DEFAULTS -D USE_EC_DEFAULTS -D _DEBUG -D EC_VARIANT = EC_VARIANT_NEC -D AECG1_5_ENABLELOCAL_STATIC_LIBRARIES:= libvoiceengine libcpufeatures libaecg2LOCAL_LDLIBS:= -llog -ldl包括$(BUILD_SHARED_LIBRARY)$(呼叫进口模块,cpufeatures)

该VE_ADT_create函数位于libvoiceengine.a,已被放在/ OBJ /本地/ armeabi-V7A /目录。

我倒是AP preciate它,如果任何人都可以在此提供一些线索给我。谢谢!


解决方案

好像每个库需要将自己的prebuilt模块,如图:的

Recently upgraded to NDK r5b, and the build fails with "undefined reference" to functions located in a static library.

Here is the error

/home/brian/workspace/VoiceEngineDemo/obj/local/armeabi-v7a/objs-debug/voiceenginejni/voice_engine_jni.o: In function `initVE':
/home/brian/workspace/VoiceEngineDemo/jni/voice_engine_jni.c:944: undefined reference to `VE_ADT_create'

It seem the link process is not loading the static module even though it is defined in the Android.mk as follows:

LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)

LOCAL_MODULE               := voiceenginejni

LOCAL_SRC_FILES            := voice_engine_jni.c printing.c jaudio.c etime.c

LOCAL_CFLAGS               := -D __arm  -D ANDROID -D USE_AEC_DEFAULTS -D USE_EC_DEFAULTS -D _DEBUG -D EC_VARIANT=EC_VARIANT_NEC -D AECG1_5_ENABLE

LOCAL_STATIC_LIBRARIES     := libvoiceengine libcpufeatures libaecg2

LOCAL_LDLIBS               := -llog -ldl

include $(BUILD_SHARED_LIBRARY)

$(call import-module,cpufeatures)

The VE_ADT_create function is located in libvoiceengine.a, which has been placed in the /obj/local/armeabi-v7a/ directory.

I'd appreciate it if anyone can shed some light on this for me. Thanks!

解决方案

Seems each library needs to be its own prebuilt module as shown in: Linking thirdparty libs (libs.a) with NDK

这篇关于连接故障使用Android NDK R5B静态库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-06 19:45