Bzi-Han/AndroidSurfaceImgui

I can't build in android again

nyaruru1 opened this issue · 11 comments

I patch 5 file but build error
Log show clang16

Any detail logs?

The C compiler identification is Clang 16.0.6
-- The CXX compiler identification is Clang 16.0.6
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - failed
-- Check for working C compiler: /data/data/com.termux/files/usr/bin/cc
-- Check for working C compiler: /data/data/com.termux/files/usr/bin/cc - broken
CMake Error at /data/data/com.termux/files/usr/share/cmake-3.26/Modules/CMakeTestCCompiler.cmake:67 (message):
The C compiler

"/data/data/com.termux/files/usr/bin/cc"

is not able to compile a simple test program.

It fails with the following output:

Change Dir: /data/data/com.termux/files/home/AndroidSurfaceImgui/build/CMakeFiles/CMakeScratch/TryCompile-MOBn3r

Run Build Command(s):/data/data/com.termux/files/usr/bin/ninja -v cmTC_7aa76 && [1/2] /data/data/com.termux/files/usr/bin/cc --target=aarch64-none-linux-android23 --sysroot=/data/data/com.termux/files/home/android-ndk/toolchains/llvm/prebuilt/linux-aarch64/sysroot   -O2 -g -DNDEBUG -fPIE -MD -MT CMakeFiles/cmTC_7aa76.dir/testCCompiler.c.o -MF CMakeFiles/cmTC_7aa76.dir/testCCompiler.c.o.d -o CMakeFiles/cmTC_7aa76.dir/testCCompiler.c.o -c /data/data/com.termux/files/home/AndroidSurfaceImgui/build/CMakeFiles/CMakeScratch/TryCompile-MOBn3r/testCCompiler.c
[2/2] : && /data/data/com.termux/files/usr/bin/cc --target=aarch64-none-linux-android23 --sysroot=/data/data/com.termux/files/home/android-ndk/toolchains/llvm/prebuilt/linux-aarch64/sysroot -O2 -g -DNDEBUG  CMakeFiles/cmTC_7aa76.dir/testCCompiler.c.o -o cmTC_7aa76   && :
FAILED: cmTC_7aa76
: && /data/data/com.termux/files/usr/bin/cc --target=aarch64-none-linux-android23 --sysroot=/data/data/com.termux/files/home/android-ndk/toolchains/llvm/prebuilt/linux-aarch64/sysroot -O2 -g -DNDEBUG  CMakeFiles/cmTC_7aa76.dir/testCCompiler.c.o -o cmTC_7aa76   && :
ld.lld: error: unable to find library -l:libunwind.a
ld.lld: error: unable to find library -l:libunwind.a
clang-16: error: linker command failed with exit code 1 (use -v to see invocation)
ninja: build stopped: subcommand failed.

CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
CMakeLists.txt:3 (project)

Build script

cmake -DCMAKE_TOOLCHAIN_FILE=../android-ndk/build/cmake/android.toolchain.cmake -DANDROID_PLATFORM=android-23 -DANDROID_ABI=arm64-v8a -S . -B build -G Ninja
cmake --build build --config Release

I think you didn't patch this file?

  • ~/../usr/share/cmake-3.26/Modules/Platform/Android/Determine-Compiler.cmake

Or there is a possibility that you patch the wrong file, the path ~/../usr/share/cmake-${version}/Modules/Platform is CMake scripts path in Termux.
If you didn't find those 5 original files in the CMake scripts path, then you must be patching the wrong path.

-- Android: Targeting API '23' with architecture 'arm64', ABI 'arm64-v8a', and processor 'aarch64'
-- Android: Selected unified Clang toolchain
-- The C compiler identification is unknown
-- The CXX compiler identification is unknown
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - failed
-- Check for working C compiler: /data/data/com.termux/files/home/android-ndk/toolchains/llvm/prebuilt/linux-aarch64/bin/clang
-- Check for working C compiler: /data/data/com.termux/files/home/android-ndk/toolchains/llvm/prebuilt/linux-aarch64/bin/clang - broken
CMake Error at /data/data/com.termux/files/usr/share/cmake-3.26/Modules/CMakeTestCCompiler.cmake:67 (message):
The C compiler

"/data/data/com.termux/files/home/android-ndk/toolchains/llvm/prebuilt/linux-aarch64/bin/clang"

is not able to compile a simple test program.

It fails with the following output:

Change Dir: /data/data/com.termux/files/home/AndroidSurfaceImgui/build/CMakeFiles/CMakeScratch/TryCompile-uK9f48

Run Build Command(s):/data/data/com.termux/files/usr/bin/ninja -v cmTC_310f2 && [1/2] /data/data/com.termux/files/home/android-ndk/toolchains/llvm/prebuilt/linux-aarch64/bin/clang    -o CMakeFiles/cmTC_310f2.dir/testCCompiler.c.o -c /data/data/com.termux/files/home/AndroidSurfaceImgui/build/CMakeFiles/CMakeScratch/TryCompile-uK9f48/testCCompiler.c
FAILED: CMakeFiles/cmTC_310f2.dir/testCCompiler.c.o
/data/data/com.termux/files/home/android-ndk/toolchains/llvm/prebuilt/linux-aarch64/bin/clang    -o CMakeFiles/cmTC_310f2.dir/testCCompiler.c.o -c /data/data/com.termux/files/home/AndroidSurfaceImgui/build/CMakeFiles/CMakeScratch/TryCompile-uK9f48/testCCompiler.c
/data/data/com.termux/files/home/android-ndk/toolchains/llvm/prebuilt/linux-aarch64/bin/clang: 1: clang-14: not found
ninja: build stopped: subcommand failed.

CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
CMakeLists.txt:3 (project)

-- Configuring incomplete, errors occurred!

After patch cmake

Try rm -rf build, then build again.

yes i remove build folder

Termux CMake3.26 patch files for TermuxNDK.zip

Link: https://github.com/Bzi-Han/AndroidSurfaceImgui/files/12544702/Termux.CMake3.26.patch.files.for.TermuxNDK.zip

You must patch failed.
Just download this upload file using wget or curl.
Then unzip the file, modify +x permission, and run PatchCMake3.26.sh.

Checking permission...
[=] User u0_a542
[=] Checking CMake version...
[+] CMake version 3.26
[=] Checking environment...
[] Patching files...
[
] Backup file /data/data/com.termux/files/usr/share/cmake-3.26/Modules/Platform/Android-Clang.cmake.bak
[] Replacing /data/data/com.termux/files/usr/share/cmake-3.26/Modules/Platform/Android-Clang.cmake
[
] Backup file /data/data/com.termux/files/usr/share/cmake-3.26/Modules/Platform/Android-Determine.cmake.bak
[] Replacing /data/data/com.termux/files/usr/share/cmake-3.26/Modules/Platform/Android-Determine.cmake
[
] Backup file /data/data/com.termux/files/usr/share/cmake-3.26/Modules/Platform/Android-Initialize.cmake.bak
[] Replacing /data/data/com.termux/files/usr/share/cmake-3.26/Modules/Platform/Android-Initialize.cmake
[
] Backup file /data/data/com.termux/files/usr/share/cmake-3.26/Modules/Platform/Android.cmake.bak
[] Replacing /data/data/com.termux/files/usr/share/cmake-3.26/Modules/Platform/Android.cmake
[
] Backup file /data/data/com.termux/files/usr/share/cmake-3.26/Modules/Platform/Android/Determine-Compiler.cmake.bak
[*] Replacing /data/data/com.termux/files/usr/share/cmake-3.26/Modules/Platform/Android/Determine-Compiler.cmake
[+] Patch successfully.
~/Termux CMake3.26 patch files for TermuxNDK $ cd
~ $ cd AndroidSurfaceImgui/
~/AndroidSurfaceImgui $ ls
CMakeLists.txt build.sh includes modules src third_party
~/AndroidSurfaceImgui $ ./build.sh
-- Android: Targeting API '23' with architecture 'arm64', ABI 'arm64-v8a', and processor 'aarch64'
-- Android: Selected unified Clang toolchain
-- The C compiler identification is unknown
-- The CXX compiler identification is unknown
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - failed
-- Check for working C compiler: /data/data/com.termux/files/home/android-ndk/toolchains/llvm/prebuilt/linux-aarch64/bin/clang
-- Check for working C compiler: /data/data/com.termux/files/home/android-ndk/toolchains/llvm/prebuilt/linux-aarch64/bin/clang - broken
CMake Error at /data/data/com.termux/files/usr/share/cmake-3.26/Modules/CMakeTestCCompiler.cmake:67 (message):
The C compiler

"/data/data/com.termux/files/home/android-ndk/toolchains/llvm/prebuilt/linux-aarch64/bin/clang"

is not able to compile a simple test program.

It fails with the following output:

Change Dir: /data/data/com.termux/files/home/AndroidSurfaceImgui/build/CMakeFiles/CMakeScratch/TryCompile-5WIqbP

Run Build Command(s):/data/data/com.termux/files/usr/bin/ninja -v cmTC_6804a && [1/2] /data/data/com.termux/files/home/android-ndk/toolchains/llvm/prebuilt/linux-aarch64/bin/clang    -o CMakeFiles/cmTC_6804a.dir/testCCompiler.c.o -c /data/data/com.termux/files/home/AndroidSurfaceImgui/build/CMakeFiles/CMakeScratch/TryCompile-5WIqbP/testCCompiler.c
FAILED: CMakeFiles/cmTC_6804a.dir/testCCompiler.c.o
/data/data/com.termux/files/home/android-ndk/toolchains/llvm/prebuilt/linux-aarch64/bin/clang    -o CMakeFiles/cmTC_6804a.dir/testCCompiler.c.o -c /data/data/com.termux/files/home/AndroidSurfaceImgui/build/CMakeFiles/CMakeScratch/TryCompile-5WIqbP/testCCompiler.c
/data/data/com.termux/files/home/android-ndk/toolchains/llvm/prebuilt/linux-aarch64/bin/clang: 1: clang-14: not found
ninja: build stopped: subcommand failed.

CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
CMakeLists.txt:3 (project)

-- Configuring incomplete, errors occurred!

Use this NDK: https://github.com/lzhiyong/termux-ndk/releases/download/ndk-r24/android-ndk-r24-aarch64.zip
Try again.
If it fails, I have no idea how to help you.

Cmake version 3.27.7