gpt4 book ai didi

android - 构建链接到其他非标准共享库的共享库

转载 作者:塔克拉玛干 更新时间:2023-11-02 20:51:56 26 4
gpt4 key购买 nike

我有两个共享库和它们的 header 。我想使用前两个库中的函数构建第三个共享库。我认为 makefile 有问题。当我尝试构建时收到这个:

Android NDK: /cygdrive/d/.../jni/Android.mk: Cannot find module with tag 'shared1' in import pathAndroid NDK: Are you sure your NDK_MODULE_PATH variable is properly defined ?Android NDK: The following directories were searched:Android NDK:/cygdrive/d/.../jni/Android.mk:36: *** Android NDK: Aborting.    .  Stop.

structure of my project:

jni/ - myfile.c - Android.mk   jni/dec/     - lot of header files   jni/enc/     - lot of header fileslibs/armeabi/ - shared1.so - shared2.so

also Android.mk sourse:

LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)

LOCAL_C_INCLUDES := \
$(LOCAL_PATH)/dec \
$(LOCAL_PATH)/enc

LOCAL_SHARED_LIBRARIES := shared1 shared2

LOCAL_MODULE := mylib
LOCAL_SRC_FILES := myfile.c
LOCAL_LDLIBS += -lOpenSLES
LOCAL_LDLIBS += -llog
LOCAL_LDLIBS += -landroid

include $(BUILD_SHARED_LIBRARY)

$(call import-module, shared1)
$(call import-module, shared2)

最佳答案

看看这个问题:Android JNI APK Packing

您需要为 libs/armeabi/ 文件夹指定另一个名称以避免与 NDK 构建冲突,并在 include $(CLEAR_VARS) 语句之前添加以下代码:

include $(CLEAR_VARS)
LOCAL_MODULE:=shared1
LOCAL_SRC_FILES:=3rdparty_libs/shared1.so
include $(PREBUILT_SHARED_LIBRARY)

include $(CLEAR_VARS)
LOCAL_MODULE:=shared2
LOCAL_SRC_FILES:=3rdparty_libs/shared2.so
include $(PREBUILT_SHARED_LIBRARY)

关于android - 构建链接到其他非标准共享库的共享库,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9517679/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com