LOCAL_SRC_FILES points to a missing file

泪湿孤枕 提交于 2019-12-10 12:37:55

问题


i'm doing an augemented reality program. i was handed this project and im new to cygwin and android programming. i have to use cygwin to compile one of my cpp file. however when i do a ndk-build on cygwin this error comes out:

$ ndk-build
Android NDK: ERROR:/cygdrive/c/project/jni/Android.mk:QCAR-prebuilt: LOCAL_SRC_FILES points to a missing file   
Android NDK: Check that /cygdrive/c/project/jni//../../../build/lib/armeabi/libQCAR.so exists  or that its path is correct
/cygdrive/c/android-ndk-r8b/build/core/prebuilt-library.mk:43: *** Android NDK: Aborting    .  Stop.

and this are my android.mk codes:

LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)
LOCAL_MODULE := QCAR-prebuilt
LOCAL_SRC_FILES = /../../../build/lib/$(TARGET_ARCH_ABI)/libQCAR.so
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/../../../build/include
include $(PREBUILT_SHARED_LIBRARY)
include $(CLEAR_VARS)

LOCAL_MODULE := ImageTargets
# The TARGET_PLATFORM defines the targetted Android Platform API level
TARGET_PLATFORM := android-5
# 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

LOCAL_CFLAGS := -Wno-write-strings $(OPENGLES_DEF)

LOCAL_LDLIBS := \
    -llog $(OPENGLES_LIB)



LOCAL_SHARED_LIBRARIES := QCAR-prebuilt

LOCAL_SRC_FILES := ImageTargets.cpp SampleUtils.cpp Texture.cpp

LOCAL_ARM_MODE := arm

include $(BUILD_SHARED_LIBRARY)**

I'm not a pro at programming so i would like some guidance.


回答1:


Had same problem, tried multiple paths but dint work. Finally solved it problem by simply copying the sample project in the Development\Android\vuforia-sdk-android-2-0-30\samples folder and then executing ndk-build through cygwin. Hope that helps :-)




回答2:


Apparently, default Android.mk presumes that the ImageTargets folder is located at ../vuforia-sdk-android-x-x-xx/samples/ImageTargets-x-x-x, but after I had downloaded the samples and extracted them to the samples directory, the location was the following: ../vuforia-sdk-android-x-x-xx/samples/vuforia-sampleapps-android-x-x-xx/ImageTargets-x-x-x. So it turned out that there was an additional subdirectory and this is why the build failed. To make it work I edited the Android.mk as follows:

LOCAL_SRC_FILES = /../../../build/lib/$(TARGET_ARCH_ABI)/libQCAR.so
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/../../../build/include

should be changed to

LOCAL_SRC_FILES = /../../../../build/lib/$(TARGET_ARCH_ABI)/libQCAR.so
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/../../../../build/include 

, where the additional set of /.. takes care of that additional subfolder. This solution worked for me.




回答3:


step 1 : copy sample into C:\Development\Android\vuforia-sdk-android-2-0-31\samples

step 2 : open command prompt

write commnad 1 : cd C:\Development\Android\vuforia-sdk-android-2-0-31\samples\ImageTargets-2-0-7

write commnad 2 : ndk-build

step 3 : import project into eclipses

step 4 : https://developer.vuforia.com/resources/dev-guide/step-3-compiling-running-vuforia-sample-app

so build successfully. Don't forgot to set path of ndk in Environment Variables.




回答4:


I had the similar problem, I put the variable NDK_TOOLCHAIN_VERSION as r9, while it had to be either 4.8 or 4.4. I changed it to 4.8 and it worked.

PS: Checking if the missing file actually exists or not will help.




回答5:


Just contributing to the list of working solutions, just in case all the above did not work.

In my case, it turned out that there was a space in my path. Cygwin does not like spaces in paths very much. Removing the spaces in my path fixed the issue.

As a tip, you may wish to have your working directory in a path like C:\projects\MyNativeProject and your Android SDK and NDK on paths without spaces.




回答6:


I would like to add my 2c, just in case it helps out some poor soul. In my case, the ndk did not like the leading back slash. i.e. changing from

LOCAL_SRC_FILES := /foo/foo.so

to

LOCAL_SRC_FILES := foo/foo.so

solved my issue.




回答7:


use relative dir path works on Mac:

-LOCAL_SRC_FILES := $(LOCAL_PATH)/lib/$(ARCH_PATH)/lib.so
+LOCAL_SRC_FILES := ./lib/$(ARCH_PATH)/lib.so


来源:https://stackoverflow.com/questions/12419093/local-src-files-points-to-a-missing-file

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!