darvincisec / DetectFrida

Detect Frida for Android
MIT License
665 stars 138 forks source link

Error while trying to build project #6

Closed WeeslaX closed 3 years ago

WeeslaX commented 3 years ago

Hi, I encountered this problem while trying to build the externalNativeBuildDebug:

Build command failed. Error while executing process C:\Users\Usr\AppData\Local\Android\Sdk\cmake\3.10.2.4988404\bin\ninja.exe with arguments {-C D:\Android Projects\DetectFrida-master\app.cxx\cmake\debug\armeabi-v7a native-lib} ninja: Entering directory `D:\Android Projects\DetectFrida-master\app.cxx\cmake\debug\armeabi-v7a' [1/2] Building C object CMakeFiles/native-lib.dir/native-lib.c.o FAILED: CMakeFiles/native-lib.dir/native-lib.c.o "D:\Android Projects\DetectFrida-master\app\src\main\c..........\build\bin\clang" --target=armv7-none-linux-androideabi21 --gcc-toolchain=C:/Users/Usr/AppData/Local/Android/Sdk/ndk-bundle/toolchains/llvm/prebuilt/windows-x86_64 --sysroot=C:/Users/Usr/AppData/Local/Android/Sdk/ndk-bundle/toolchains/llvm/prebuilt/windows-x86_64/sysroot -D_32_BIT -Dnative_lib_EXPORTS -I"D:/Android Projects/DetectFrida-master/app/src/main/c/arch/armeabi-v7a" -g -DANDROID -fdata-sections -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -D_FORTIFY_SOURCE=2 -march=armv7-a -mthumb -Wformat -Werror=format-security -mllvm -sub -mllvm -bcf -mllvm -fla -O0 -fno-limit-debug-info -fPIC -MD -MT CMakeFiles/native-lib.dir/native-lib.c.o -MF CMakeFiles\native-lib.dir\native-lib.c.o.d -o CMakeFiles/native-lib.dir/native-lib.c.o -c "D:/Android Projects/DetectFrida-master/app/src/main/c/native-lib.c" CreateProcess failed: The system cannot find the file specified. ninja: build stopped: subcommand failed.

Any idea how I can resolve this? Thanks.

darvincisec commented 3 years ago

I have not provided o-llvm for windows, hence the issue. You can avoid overriding with ollvm tool chain and instead use the default one..Also remove the ollvm flags to get a successful build.

darvincisec commented 3 years ago

Refer CMakeListsts to comment the lines not required for non-obfuscated builds

ankitk93 commented 2 years ago

@darvincisec @WeeslaX I am getting the same issue, even if i have commented out the o-llvm code obfuscation lines from CMakeList Error : /Users/ankitkumar/Library/Android/sdk/ndk/21.4.7075529/toolchains/llvm/prebuilt/darwin-x86_64/bin/aarch64-linux-android-strip: '/Users/ankitkumar/Desktop/Projects/kli_flutter/SmartSell/app/src/main/cpp/../../../build/intermediates/cmake/Debug/obj/arm64-v8a/libnative-lib.so': No such file ninja: build stopped: subcommand failed.

The Updated CMakeLists.txt :

Screenshot 2022-07-12 at 5 55 40 PM

and when i build it always fails with the same error, while building the project the build file do not have autogenerated cmake folder, hence the error

can you Please help.

glrahulborah commented 1 year ago

@darvincisec @WeeslaX I am getting the same issue, even if i have commented out the o-llvm code obfuscation lines from CMakeList Error : /Users/ankitkumar/Library/Android/sdk/ndk/21.4.7075529/toolchains/llvm/prebuilt/darwin-x86_64/bin/aarch64-linux-android-strip: '/Users/ankitkumar/Desktop/Projects/kli_flutter/SmartSell/app/src/main/cpp/../../../build/intermediates/cmake/Debug/obj/arm64-v8a/libnative-lib.so': No such file ninja: build stopped: subcommand failed.

The Updated CMakeLists.txt : Screenshot 2022-07-12 at 5 55 40 PM

and when i build it always fails with the same error, while building the project the build file do not have autogenerated cmake folder, hence the error

can you Please help.

Same issue

glrahulborah commented 1 year ago

Commenting out the following code in CMakeLists.txt file works and build is generated successfully.

#add_custom_command( TARGET native-lib
#        POST_BUILD
#        COMMAND "${ANDROID_TOOLCHAIN_PREFIX}strip" -R .comment -g -S -d --strip-unneeded ${CMAKE_HOME_DIRECTORY}/../../../build/intermediates/cmake/${CMAKE_BUILD_TYPE}/obj/${ANDROID_ABI}/libnative-lib.so
#       COMMENT "Stripped native `library")