I use .PHONY in android makefile,but when i use "make xx",it can not link "xx",how cause this?
here is my code
.PHONY: test
test: $(compatibility) vtslab adb echoTEST
$(call dist-for-goals,test,$(compatibility))
echoTEST:
#echo "2222"
why I can not use a make test?
it builds with error unknown target 'test',
Related
i am trying to build android R but getting the following error in the kernel makefile
kernel/exynos/AndroidKernel.mk:155: error: writing to readonly directory: "/data/home/sumkumar/work/workspace/R/out/../out/target/product/**/obj/KERNEL_OBJ/arch/arm64/boot/Image"
this was handled in Android Q by using the flag "BUILD_BROKEN_PHONY_TARGETS=true" but in R this is depreciated hence cannot use the same.
after looking at following link given for phony rules changes from google for android R
https://android.googlesource.com/platform/build/+/master/Changes.md#phony_targets
i have updated my Makefile as follows by removing the "../" in the erronous path and past the previous error ,
#KERNEL_OUT ?= $(if $(filter /% ~%,$(TARGET_OUT_INTERMEDIATES)),,$(realpath $(OUT_DIR))/../)$(TARGET_OUT_INTERMEDIATES)/KERNEL_OBJ
KERNEL_OUT ?= $(TARGET_OUT_INTERMEDIATES)/KERNEL_OBJ
but now i am getting errors with phony-rebuild as mentioned below
kernel/exynos/AndroidKernel.mk:139: error: real file "out/target/product/**/obj/KERNEL_OBJ/.config" depends on PHONY target "phony-rebuild"
14:21:04 ckati failed with: exit status 1
i understood as phony targets are always dirty hence every file will be rebuild which depends on that phony, but in my case this rebuilding is required .
Attaching a snap of the file depicting the same
KERNEL_CONFIG := $(KERNEL_OUT)/.config
KERNEL_CONFIG := $(KERNEL_OUT)/.config
.PHONY: phony-rebuild
$(KERNEL_CONFIG): phony-rebuild
$(show) echo "make $(KERNEL_DEFCONFIG)"
$(MAKE_CONFIG_CMD)
$(info MAKE_CONFIG_CMD is $(MAKE_CONFIG_CMD))
Please let me know if there is any way to avoid using phony-rebuild and replace it with an alternate mechanism.
Regards,
I have multiple static libs that are built using jni. I have a scheme that includes other mk files, etc to allow me to share compile settings, include files from other dependent projects, etc.
I have set it up successfully on the mac and have been building it. However, when I tried to do the same in windows under cygwin I'm running into issues...
Here is my jni/Android.mk file..
LOCAL_PATH := $(call my-dir)
INJ_PROJECT_PATH := $(PWD)
include $(INJ_PROJECT_PATH)/jni/Project.mk
The problem I'm seeing is that ndk-build is complaining about the Project.mk file. Here is what I'm seeing..
shammi#SHAMMIDEV /cygdrive/c/projects/injitiProjects/injitiEngine/Engine/Core
$ ndk-build.cmd NDK_APP_OUT=../../build/Android/Engine/release
jni/Android.mk:5: /cygdrive/c/projects/injitiProjects/injitiEngine/Engine/Core/jni/Project.mk: No such file or directory
jni/Android.mk:5: /cygdrive/c/projects/injitiProjects/injitiEngine/Engine/Core/jni/Project.mk: No such file or directory
jni/Android.mk:5: /cygdrive/c/projects/injitiProjects/injitiEngine/Engine/Core/jni/Project.mk: No such file or directory
jni/Android.mk:5: /cygdrive/c/projects/injitiProjects/injitiEngine/Engine/Core/jni/Project.mk: No such file or directory
C:/projects/Android/sdk/ndk-bundle/build//../build/core/build-all.mk:89: Android NDK: WARNING: There are no modules to build in this project!
make: *** No rule to make target `/cygdrive/c/projects/injitiProjects/injitiEngine/Engine/Core/jni/Project.mk'. Stop.
I have confirmed that /cygdrive/c/projects/injitiProjects/injitiEngine/Engine/Core/jni/Project.mk does exist, and I am the owner and it has read permissions for user/group/other.
Again, this exact same setup works absolutely fine on the mac. I'm just looking at having a portable dev environment.
What am I missing here..?
I guess I forgot that ndk-build.cmd was a windows shell batch script (DOH).
The answer was that I was able to call /build/ndk-build which is a sh script that is comfortable running in cygwin.
You probably need to use LOCAL_PATH instead of PWD. I'm not really sure how PWD gets set (I think it's a make builtin?), but we actually have control over LOCAL_PATH and can make sure it gets set in the right way for cygwin.
Instead of include what if you define it to be APP_BUILD_SCRIPT?
for ex.
APP_BUILD_SCRIPT := jni/Android.mk
Also Id try $(shell $pwd) instead of $(PWD) if the above doesn't work, usually ndk doesn't interpret shell commands for me if I don't use the shell in the parenthesis.
Cocos2d-x 3.7.1 + ndk r10e project on Mac trying to debug in Eclipse. Days pass and the errors keep coming...
I can build and run using cocos compile and cocos run with -p android -m debug --ndk-mode NDK_DEBUG=1 from the terminal in proj.android.
My app runs Ok (eventually) on my x86 emulator no problem.
Typing 'ndk-gdb' in the terminal from ./proj.android and I get the error
ERROR: Could not find gdb.setup under ./libs/
BUT the file gdb.setup (and gdbserver & libcocos2dcpp.so) can be seen in ./proj.android/libs/x86 !?
My AndroidManifest.xml includes android:debuggable="true"
My jni/Application.mk includes APP_ABI := x86 (only)
If anyone can tell me how I can diagnose or fix this problem then I guess I owe them a beer (in Yorkshire btw)
UPDATE: I have tried running up GDB using the --verbose flag. The output shows
Using gdb setup init: ./libs/armeabi/gdb.setup
Using app out directory: ./obj/local/armeabi
Guess I need to change to settings/init file somewhere??
I ran into the same problem. It seems something changed in recent version of Android Build tools.
The trick is:
ERROR: Could not find gdb.setup under ./libs/
It expects gdb.setup is in the directory libs but NOT libs/armeabi
so the simple workground is to copy gdb.setup and gdbserver from "libs/cpu" to "libs" and it works like a magic!
This is a bug caused by adb from android sdk.Issue 191085: ndk-gdb issue - Could not find gdb.setup under ./libs/ (even though it's there)
Currently previewl channel's adb whose version is 1.0.35 still has the same problem.
Without revert adb to 1.0.31.A simple workaround would be modify ndk-gdb a little: change the line if [ $? = 0 ]; then which is below adb_var_shell BCFILES run-as $PACKAGE_NAME /system/bin/sh -c "ls lib/*.bc" to if [ $? = 1 ]; then
I was getting 'Unable to detect application ABI's' when trying to natively debug in Eclipse. I didn't get anywhere so I tried ndk-gdb (ndk-gdb.py as I am on Windows).
But using ndk-gdb gives me :
ERROR: The device does not support the application's targetted CPU ABIs!
Device supports: armeabi-v7a armeabi
Package supports: .
This happens because the ndk-gdb.py function :
def get_build_var(var):
global GNUMAKE_CMD, GNUMAKE_FLAGS, NDK, PROJECT
text = subprocess.check_output([GNUMAKE_CMD,
'--no-print-dir',
'-f',
NDK+'/build/core/build-local.mk',
'-C',
PROJECT,
'DUMP_'+var] + GNUMAKE_FLAGS
)
# replace('\r', '') due to Windows crlf (\r\n)
# ...universal_newlines=True causes bytes to be returned
# rather than a str
return text.decode('ascii').replace('\r', '').splitlines()[0]
returns a '.' when asked for APP_ABI. I have dummped the subprocess make call parameters and when I execute the make call from the command line I get the correct response of 'armeabi-v7a armeabi'
I don't think this is to do with python as the error is so similar to my Eclipse only problem.
Try to run ndk-build DUMP_APP_ABI and make sure the output is clean. Check you Application.mk for weird encoding and/or CRLFs.
All use of $(info …) or $(__ndk_info), etc. should be disabled for this target.
I am following the steps on http://developer.android.com/sdk/ndk/overview.html to build the hello-jni sample, however when I get to Step 2 to run
cd $NDK-ROOT/samples/hello-jni
$NDK-ROOT/ndk-build
in the Cygwin command prompt, I receive the following error messages:
/bin/sh: -c: line 0: unexpected EOF while looking for matching `''
/bin/sh: -c: line 1: syntax error: unexpected end of file
Android NDK: Host awk tool is outdated. Please define HOST_AWK to point to Gawk
or Nawk !
I have Cygwin 1.7.9, Gnu Make 3.8.2, and Gawk 3.1.8 on my Windows machine, along with the r5b release of the Android NDK.
I also have set the HOST_AWK environment variable, which points to my Gawk folder.
Unfortunatley the sample cannot run successfully without this step, (if I run hello-jni, I immediately receive an UnsatisfiedLinkError exception).
Below is the portion of the init.mk file on my machine (found in NDK_ROOT/build/core) which creates this error:
# Location of all awk scripts we use
BUILD_AWK := $(NDK_ROOT)/build/awk
AWK_TEST := $(shell $(HOST_AWK) -f $(BUILD_AWK)/check-awk.awk)
$(call ndk_log,Host awk test returned: $(AWK_TEST))
ifneq ($(AWK_TEST),Pass)
$(call __ndk_info,Host awk tool is outdated. Please define HOST_AWK to point to Gawk or Nawk !)
$(call __ndk_error,Aborting.)
endif
Thank-you for your help
Try updating your awk tool. Seems to an an outdated version (perhaps). Also ensure that NDK root is defined to where you have your NDK source and ensure that your awk tool is located in the build directory of your NDK Source.
NDK_ROOT
Try settings this environment variable to where your NDK root is. Whenever this is defined (Typically at the top)
Instead of HOST_AWK=gawk.exe, just do HOST_AWK=gawk
It turns out there was an apostrophe in my HOST_AWK path, which was causing the problem.
reference
https://stackoverflow.com/q/8121153/411522
mine worked fine now.what to do is: just rename the prebuilt awk in ndk