5

BACKGROUND: I want to use Obfuscator-llvm-8.0 version of clang and clang++ with AndroidStudio on Windows7; so i get the Obfuscator-llvm-8.0 source code and compile it with success, then I put "clang.exe, clang++.exe, clang-check.exe, clang-format.exe" to the original ndk toolchains, which is "xxx\ndk-bundle\toolchains\llvm\prebuilt\windows-x86_64\bin"; if you build apk now, you will get "Build command failed." because some .h file need copy too, so i copyed them;

TROUBLE SITUATION: Build apk again, will report error(see below); so i just copy the "clang++ complie str" and execute it on windows terminal directly, it executes successfully and generated th .o file, and even i copy the cmake arguments and execute it i get the .so file;

TROUBLE: I can not build it on the Android Studio IDE, and i can not get any detail error message to fix it; Is there anything i missed? Or there anyway to find detail message about "ninja: build stopped: subcommand failed."?

I have tried search "ninja: build stopped: subcommand failed." on google, and just get some information about complie the AndroidOs, and just tell you do something to fix it but not tell you why.

Here is the full error message:

Build command failed.
Error while executing process D:\Android\Sdk\cmake\3.10.2.4988404\bin\cmake.exe with arguments {--build C:\Users\Administrator\AndroidStudioProjects\OllvmTest\app\.externalNativeBuild\cmake\debug\armeabi-v7a --target native-lib}
[1/2] Building CXX object CMakeFiles/native-lib.dir/native-lib.cpp.o
FAILED: CMakeFiles/native-lib.dir/native-lib.cpp.o 
D:\Android\Sdk\ndk-bundle\toolchains\llvm\prebuilt\windows-x86_64\bin\clang++.exe --target=armv7-none-linux-androideabi19 --gcc-toolchain=D:/Android/Sdk/ndk-bundle/toolchains/llvm/prebuilt/windows-x86_64 --sysroot=D:/Android/Sdk/ndk-bundle/toolchains/llvm/prebuilt/windows-x86_64/sysroot  -Dnative_lib_EXPORTS  -g -DANDROID -fdata-sections -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -fno-addrsig -march=armv7-a -mthumb -Wa,--noexecstack -Wformat -Werror=format-security   -O0 -fno-limit-debug-info  -fPIC -MD -MT CMakeFiles/native-lib.dir/native-lib.cpp.o -MF CMakeFiles\native-lib.dir\native-lib.cpp.o.d -o CMakeFiles/native-lib.dir/native-lib.cpp.o -c C:/Users/Administrator/AndroidStudioProjects/OllvmTest/app/src/main/cpp/native-lib.cpp
ninja: build stopped: subcommand failed.
wizdzz
  • 81
  • 1
  • 1
  • 7
  • Please, do not tend to wrap *everything* into the code formatting. This formatting perfectly fit for the code, command lines, logs. It helps when used for code-like designations for highlight them. It can be used for filenames (like `cool_program.exe`), part of files (`.so`) or file-like names (`Obfuscator-llvm-8.0`), while some people oppose such usage. But using code formatting for phrases in natural language (like `report error(see below)`) is definitely **misused** - please, do not do that. Also, names like "Windows7" and "Android Studio IDE" do not require code formatting. – Tsyvarev Jun 14 '19 at 13:33
  • sorry for that, fixed now. – wizdzz Jun 17 '19 at 02:25
  • Strangely, all the thing is right now, i don't know why. – wizdzz Jun 17 '19 at 11:39

1 Answers1

2

I had this issue building in Yocto. Solution was to decrease number of threads used for the parallel build.