gpt4 book ai didi

android - ndk 在 android.mk 文件中构建时出现错误

转载 作者:行者123 更新时间:2023-12-02 10:22:05 24 4
gpt4 key购买 nike

我在 ndk 构建期间遇到错误。我的项目中只有一个 android.mk 文件和一个 Application.mk 文件
Android NDK:尝试在/home/parag.j/AndroidArm//jni/Android.mk 中定义本地模块“protobuf”。
Android NDK:但是这个模块已经被/home/parag.j/AndroidArm//jni/Android.mk 定义了。


这是我的 Android.mk 文件

LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE=ndktest
LOCAL_SRC_FILES=ndktest.cpp
include $(CLEAR_VARS)
LOCAL_MODULE := c++_shared
LOCAL_SRC_FILES := $(LOCAL_PATH)/inc/build/libc++_shared.so
include $(PREBUILT_SHARED_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := armnn
LOCAL_SRC_FILES := $(LOCAL_PATH)/inc/build/libarmnn.so
include $(PREBUILT_SHARED_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := armnnTfParser
LOCAL_SRC_FILES := $(LOCAL_PATH)/inc/build/libarmnnTfParser.so
include $(PREBUILT_SHARED_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := protobuf
LOCAL_SRC_FILES := $(LOCAL_PATH)/inc/build/libprotobuf.so
include $(PREBUILT_SHARED_LIBRARY)
LOCAL_LDLIBS += -lm -llog -landroid
LOCAL_CFLAGS += -DARM_NEON_64BIT -O3 -mfpu=neon -mcpu=kryo -std=c++14 -pie
LOCAL_SHARED_LIBRARIES := opencv_java3 armnn armnnTfParser protobuf c++_shared
LOCAL_C_INCLUDES := $(LOCAL_PATH)/inc/include\
include $(BUILD_SHARED_LIBRARY)

这是我的 Application.mk 文件
APP_ABI:=arm64-v8a 
APP_CFLAGS += -Ofast
APP_OPTIM := release
APP_STL := gnustl_static
APP_CPPFLAGS := -frtti -fexceptions
APP_PLATFORM := android-22
ANDROID_TOOLCHAIN_NAME := clang++

最佳答案

您忘记(重新)设置 LOCAL_MODULE对于你的makefile的最后一部分。我认为最后几行应该是:

LOCAL_MODULE=ndktest
LOCAL_SRC_FILES=ndktest.cpp
LOCAL_LDLIBS += -lm -llog -landroid
LOCAL_CFLAGS += -DARM_NEON_64BIT -O3 -mfpu=neon -mcpu=kryo -std=c++14 -pie
LOCAL_SHARED_LIBRARIES := opencv_java3 armnn armnnTfParser protobuf c++_shared
LOCAL_C_INCLUDES := $(LOCAL_PATH)/inc/include
include $(BUILD_SHARED_LIBRARY)

(当然,去掉文件开头的 ndktest 行)

关于android - ndk 在 android.mk 文件中构建时出现错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59660321/

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