0

I bought a new laptop (preinstalled with macOS Catalina) and i'm setting up an existing android project, and installed the same version of ndk and kept all the settings same.

I tried to build the project, then got couple of macOS catalina security prompts related to clang and other ndk binaries, resolved all of them.

Then did a clean build and got this error.

Error while executing process /Users/eshwar/Library/Android/sdk/ndk/21.2.6472646/ndk-build with arguments {NDK_PROJECT_PATH=null APP_BUILD_SCRIPT=/Users/eshwar/workspace/project/frameworks/runtime-src/proj.android-studio/app/jni/Android.mk NDK_APPLICATION_MK=/Users/eshwar/workspace/project/frameworks/runtime-src/proj.android-studio/app/jni/Application.mk APP_ABI=arm64-v8a NDK_ALL_ABIS=arm64-v8a NDK_DEBUG=1 APP_PLATFORM=android-21 NDK_OUT=/Users/eshwar/workspace/project/frameworks/runtime-src/proj.android-studio/app/build/intermediates/ndkBuild/debug/obj NDK_LIBS_OUT=/Users/eshwar/workspace/project/frameworks/runtime-src/proj.android-studio/app/build/intermediates/ndkBuild/debug/lib NDK_TOOLCHAIN_VERSION=clang -j16 NDK_DEBUG=1 /Users/eshwar/workspace/project/frameworks/runtime-src/proj.android-studio/app/build/intermediates/ndkBuild/debug/obj/local/arm64-v8a/libcocos2djs.so}
[arm64-v8a] Compile++      : cocos2djs_shared <= AppDelegate.cpp

make: execvp: /Users/eshwar/Library/Android/sdk/ndk/21.2.6472646/toolchains/llvm/prebuilt/darwin-x86_64/bin/clang++: Permission denied
make: *** [/Users/eshwar/Library/Android/sdk/ndk/21.2.6472646/build/core/build-binary.mk:478: /Users/eshwar/workspace/project/frameworks/runtime-src/proj.android-studio/app/build/intermediates/ndkBuild/debug/obj/local/arm64-v8a/objs-debug/cocos2djs_shared/__/__/__/Classes/AppDelegate.o] Error 127

Tried couple of times and got errors in different files.

Tried:

  1. reinstalling NDK
  2. trying different version of NDK
  3. chmod -755 on the entire ndk folder

None of them succeeded.

Then wanted to check if the issue is related to my laptop or the project. So, installed a ndk sample project and tried to build, it worked successfully.

$ /Users/eshwar/Library/Android/sdk/ndk/21.2.6472646/ndk-build NDK_PROJECT_PATH=null APP_BUILD_SCRIPT=/Users/eshwar/workspace/ndk-samples/other-builds/ndkbuild/hello-neon/app/Android.mk APP_ABI=armeabi-v7a NDK_ALL_ABIS=armeabi-v7a NDK_DEBUG=1 APP_PLATFORM=android-16 NDK_OUT=/Users/eshwar/workspace/ndk-samples/other-builds/ndkbuild/hello-neon/app/build/intermediates/ndkBuild/arm7Debug/obj NDK_LIBS_OUT=/Users/eshwar/workspace/ndk-samples/other-builds/ndkbuild/hello-neon/app/build/intermediates/ndkBuild/arm7Debug/lib hello-neon  
[armeabi-v7a] Compile thumb  : hello-neon <= helloneon.c
[armeabi-v7a] Compile thumb  : hello-neon <= helloneon-intrinsics.c
[armeabi-v7a] Compile thumb  : cpufeatures <= cpu-features.c
[armeabi-v7a] StaticLibrary  : libcpufeatures.a
[armeabi-v7a] SharedLibrary  : libhello-neon.so

then checked the ndk-build command in sample project, it didn't have the -j16 flag when it was getting built. Then manually added -j16 flag to the sample project and got the same error.

$ /Users/eshwar/Library/Android/sdk/ndk/21.2.6472646/ndk-build NDK_PROJECT_PATH=null APP_BUILD_SCRIPT=/Users/eshwar/workspace/ndk-samples/other-builds/ndkbuild/hello-neon/app/Android.mk APP_ABI=armeabi-v7a NDK_ALL_ABIS=armeabi-v7a NDK_DEBUG=1 APP_PLATFORM=android-16 NDK_OUT=/Users/eshwar/workspace/ndk-samples/other-builds/ndkbuild/hello-neon/app/build/intermediates/ndkBuild/arm7Debug/obj NDK_LIBS_OUT=/Users/eshwar/workspace/ndk-samples/other-builds/ndkbuild/hello-neon/app/build/intermediates/ndkBuild/arm7Debug/lib -j16 hello-neon
[armeabi-v7a] Compile thumb  : hello-neon <= helloneon.c
make: execvp: /Users/eshwar/Library/Android/sdk/ndk/21.2.6472646/toolchains/llvm/prebuilt/darwin-x86_64/bin/clang: Permission denied
make: *** [/Users/eshwar/Library/Android/sdk/ndk/21.2.6472646/build/core/build-binary.mk:476: /Users/eshwar/workspace/ndk-samples/other-builds/ndkbuild/hello-neon/app/build/intermediates/ndkBuild/arm7Debug/obj/local/armeabi-v7a/objs-debug/hello-neon//Users/eshwar/workspace/ndk-samples/hello-neon/app/src/main/cpp/helloneon.o] Error 127
make: *** Waiting for unfinished jobs....
[armeabi-v7a] StaticLibrary  : libcpufeatures.a
[armeabi-v7a] Compile thumb  : hello-neon <= helloneon-intrinsics.c

Then manually run the ndk-build of my project without -j16 and its building.

FYI: my old laptop(updated to macOS Catalina) works fine with -j16 flag

What is the significance of -j16 flag. How do I know from where its is getting added and how to remove it.

edit: found using the ndk help

-j [N], --jobs[=N]          Allow N jobs at once; infinite jobs with no arg.

Tried with multiple j values. It fails with anything more than 2 on a 8 core processor. Is there any settings which controls this?

eshwar ms
  • 73
  • 1
  • 7
  • See https://stackoverflow.com/questions/15289250/make-j4-or-j8/15295032 – Michael Aug 30 '20 at 11:59
  • @Michael just tried with different j values. It is failing with anything with 3 or greater on my 8 core i9 laptop. Any ideas why it could be happening – eshwar ms Aug 30 '20 at 12:17

0 Answers0