【发布时间】:2019-09-11 19:03:59
【问题描述】:
我正在尝试使用 ndk-build 构建此示例项目,但由于某种原因它找不到库。这是我收到的错误消息:
build-binary.mk:688:Android NDK:模块 fastcvFeatDetect 依赖于未定义的模块: 登录 GLESv2
我对 ndk 的了解不够,不知道如何检查这些库是否可用以及我是否正确地指向了它们的路径。
顶层有这个主make文件:
# An Android.mk file must begin with the definition of the LOCAL_PATH variable.
# It is used to locate source files in the development tree. In this example,
# the macro function 'my-dir', provided by the build system, is used to return
# the path of the current directory (i.e. the directory containing the
# Android.mk file itself).
#
LOCAL_PATH := $(call my-dir)
JNI_DIR := $(LOCAL_PATH)
UTILS_DIR := $(LOCAL_PATH)/utils
# The function "$(call all-subdir-makefiles)" returns a list of Android.mk
# files located in all sub-directories of the current 'my-dir' path.
# This function can be used to provide deep-nested source directory
# hierarchies to the build system.
#
include $(call all-subdir-makefiles)
随后是子目录中的这些 make 文件:
LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
LOCAL_PRELINK_MODULE:= false
# This variable determines the OpenGL ES API version to use:
# If set to true, OpenGL ES 1.1 is used, otherwise OpenGL ES 2.0.
USE_OPENGL_ES_1_1 := false
# Set OpenGL ES version-specific settings.
ifeq ($(USE_OPENGL_ES_1_1), true)
OPENGLES_LIB := -lGLESv1_CM
OPENGLES_DEF := -DUSE_OPENGL_ES_1_1
else
OPENGLES_LIB := -lGLESv2
OPENGLES_DEF := -DUSE_OPENGL_ES_2_0
endif
# An optional set of compiler flags that will be passed when building
# C ***AND*** C++ source files.
#
# NOTE: flag "-Wno-write-strings" removes warning about deprecated conversion
# from string constant to 'char*'
LOCAL_CFLAGS := -Wno-write-strings $(OPENGLES_DEF)
# The list of additional linker flags to be used when building your
# module. This is useful to pass the name of specific system libraries
# with the "-l" prefix.
LOCAL_LDLIBS := \
-llog $(OPENGLES_LIB)
LOCAL_LDFLAGS:= -Wl,--no-fix-cortex-a8
LOCAL_MODULE := libfastcvFeatDetect
LOCAL_CFLAGS := -Werror
LOCAL_SRC_FILES := ../About.cpp Corner.cpp
LOCAL_STATIC_LIBRARIES := libfastcv libfastcvUtils
LOCAL_SHARED_LIBRARIES := liblog
LOCAL_C_INCLUDES += $(JNI_DIR)/fastcv
LOCAL_C_INCLUDES += $(JNI_DIR)
LOCAL_MODULE_OWNER := qcom
LOCAL_PROPRIETARY_MODULE := true
include $(BUILD_SHARED_LIBRARY)
我尝试根据谷歌搜索更改一些内容,但到目前为止没有任何效果。有人有什么建议吗?
【问题讨论】:
-
尝试使用
V=1运行ndk-build,这将显示实际执行的链接命令。希望这将提供一些见解。
标签: android-ndk