Reputation: 824
When I try to compile .so to a bibiliotek, I receive an error that the way is incorrect and instead of the local way expected by me I see a way to NDK, in what a problem, here 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 that I receive on an 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)
Upvotes: 5
Views: 7528
Reputation: 57173
LOCAL_PATH := $(call my-dir)
must be the first thing your Android.mk file does. This call extracts the path of the latest included makefile, and after include $(CLEAR_VARS)
, it will get the path of $(CLEAR_VARS)
file (ndk/build/core) instead of your jni directory.
As @alijandro points out, LOCAL_PATH is explicitly absent from the long list of LOCAL_ variables that are reset by include $(CLEAR_VARS)
.
Upvotes: 1
Reputation: 12147
In order to let LOCAL_PATH
point to the right location, you have to assign at the top of Android.mk
file, before include $(CLEAR_VARS)
, CLEAR_VARS
doesn't clear LOCAL_PATH
, see the documentation.
The CLEAR_VARS variable points to a special GNU Makefile that clears many LOCAL_XXX variables for you, such as LOCAL_MODULE, LOCAL_SRC_FILES, and LOCAL_STATIC_LIBRARIES. Note that it does not clear LOCAL_PATH. This variable must retain its value because the system parses all build control files in a single GNU Make execution context where all variables are global.
Upvotes: 0