Issue
I'm trying to get this sample project to build with ndk-build, but for some reason it doesn't find the libraries. This is the error message I get:
build-binary.mk:688: Android NDK: Module fastcvFeatDetect depends on undefined modules: log GLESv2
I don't know enough about ndk to know how to check if these libraries are available and if I'm pointing to their path correctly.
There's this master make file at the top level:
# 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)
Followed by these make files in the sub-directories:
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)
I've tried changing some things based on googling around, but so far nothing has worked. Does anyone have any advice?
Solution
LOCAL_PRELINK_MODULE:= false
This isn't an NDK sample. This is platform code. It is built with the AOSP build system, not the NDK. See https://source.android.com/setup/build/building for more information on that.
If you're trying to find NDK samples, see https://github.com/googlesamples/android-ndk.
If you really do need to build this non-NDK project with the NDK, read on.
Grepping for the error message in $NDK/build
is often a good way to find more information:
$(call __ndk_warning,Module $(LOCAL_MODULE) depends on undefined modules: $(undefined_libs))
# https://github.com/android-ndk/ndk/issues/208
# ndk-build didn't used to fail the build for a missing dependency. This
# seems to have always been the behavior, so there's a good chance that
# there are builds out there that depend on this behavior (as of right now,
# anything using libc++ on ARM has this problem because of libunwind).
#
# By default we will abort in this situation because this is so completely
# broken. A user may define APP_ALLOW_MISSING_DEPS to "true" in their
# Application.mk or on the command line to revert to the old, broken
# behavior.
ifneq ($(APP_ALLOW_MISSING_DEPS),true)
$(call __ndk_error,Aborting (set APP_ALLOW_MISSING_DEPS=true to allow missing dependencies))
endif
This used to be silently ignored and it is now an error. It's pointing out the following bugs:
LOCAL_SHARED_LIBRARIES := liblog
This line does nothing. Delete it. System libraries are linked with LOCAL_LDLIBS
, not LOCAL_SHARED_LIRBARIES
. There will be a similar line somewhere else causing the error for GLESv2.
Answered By - Dan Albert
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.