Why does $ (call my-dir) in the Android.mk file return the wrong path?

When I try to compile .so in bibiliotek, I get an error that the path is incorrect and instead of the local path I expect, I see the NDK method, what’s the problem, here is my MK file:

include $(CLEAR_VARS)

LOCAL_PATH := $(call my-dir)
@echo "Local path = $LOCAL_PATH"

SCRIPT := $(LOCAL_PATH)/LuaJIT/build.sh
ECHO_RESULT1 := $(shell $(SCRIPT))
#ECHO_RESULT := $(shell ($(LOCAL_PATH)/LuaJit/build.sh))
@echo "ECHO_RESULT1=$(ECHO_RESULT1)"

include $(CLEAR_VARS)
LOCAL_MODULE    := libluajit
LOCAL_SRC_FILES := $(LOCAL_PATH)/jnlua/src/libluajit.a
include $(PREBUILT_STATIC_LIBRARY)

include $(CLEAR_VARS)
LOCAL_MODULE := libjnlua
LOCAL_C_INCLUDES += $(LOCAL_PATH)/LuaJit/src
LOCAL_SRC_FILES := $(LOCAL_PATH)/jnlua/src/jnlua.c
LOCAL_LDLIBS := -llog
LOCAL_CFLAGS := -O2 -Wall -DLUA_COMPAT_ALL
#LOCAL_SHARED_LIBRARIES := libjavavm 
LOCAL_STATIC_LIBRARIES := libluajit

# POSIX as we're on linux, and compatibility mode in case you'll be running scripts written for LUA <5.2

include $(BUILD_SHARED_LIBRARY)

Here is what I get in the output:

11:30:47 **** Incremental Build of configuration Default for project jnlua-android ****
"C:\\Users\\Dev1\\Downloads\\android-ndk-r10e-windows-x86_64\\android-ndk-r10e\\ndk-build.cmd" V=1 all all 
Android NDK: ERROR:jni/Android.mk:luajit: LOCAL_SRC_FILES points to a missing file    
process_begin: CreateProcess(NULL, C:/Users/Dev1/Downloads/android-ndk-r10e-windows-x86_64/android-ndk-r10e/build/core/LuaJIT/build.sh, ...) failed.
C:/Users/Dev1/Downloads/android-ndk-r10e-windows-x86_64/android-ndk-r10e/build/core/prebuilt-library.mk:45: *** Android NDK: Aborting    .  Stop.
Android NDK: Check that C:/Users/Dev1/Downloads/android-ndk-r10e-windows-x86_64/android-ndk-r10e/build/core/jnlua/src/libluajit.a exists  or that its path is correct   

11:30:47 Build Finished (took 122ms)
+4
source share
3 answers

cd to the directory jniand call ndk-buildthat worked for me.

0
source

To LOCAL_PATHpoint to the right place, you need to assign at the top of the file Android.mk, before include $(CLEAR_VARS), CLEAR_VARSit is not cleared LOCAL_PATH, see the documentation .

CLEAR_VARS GNU Makefile, LOCAL_XXX, LOCAL_MODULE, LOCAL_SRC_FILES LOCAL_STATIC_LIBRARIES. , LOCAL_PATH. , ​​ GNU Make make, .

0
LOCAL_PATH := $(call my-dir)

, Android.mk. make , include $(CLEAR_VARS) $(CLEAR_VARS) (ndk/build/core) jni.

@alijandro, LOCAL_PATH LOCAL _, reset include $(CLEAR_VARS).

0
source

Source: https://habr.com/ru/post/1629126/


All Articles