cmake error: clang is not able to compile a simple test program #2022
-
I'm new to NDK. And I am trying to compile a lib using ndk toolchain. The cmake file I used is shown below: cmake .. \
-DCMAKE_TOOLCHAIN_FILE=$ANDROID_NDK/build/cmake/android.toolchain.cmake \
-DCMAKE_BUILD_TYPE=Release \
-DANDROID_ABI="arm64-v8a" \
-DANDROID_NATIVE_API_LEVEL=android-28 \
-DNATIVE_LIBRARY_OUTPUT=. -DNATIVE_INCLUDE_OUTPUT=. $1 $2 $3 \
-DDEBUG=ON \
-DTEST=OFF \
-DARM=ON \
-DAPK=OFF And cmake gave error: -- 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: /media/wch/D/commonlib/android-ndk-r26d/toolchains/llvm/prebuilt/linux-x86_64/bin/clang
-- Check for working C compiler: /media/wch/D/commonlib/android-ndk-r26d/toolchains/llvm/prebuilt/linux-x86_64/bin/clang - broken
CMake Error at /home/wch/Downloads/cmake-3.28.1-linux-x86_64/share/cmake-3.28/Modules/CMakeTestCCompiler.cmake:67 (message):
The C compiler
"/media/wch/D/commonlib/android-ndk-r26d/toolchains/llvm/prebuilt/linux-x86_64/bin/clang"
is not able to compile a simple test program.
It fails with the following output:
Change Dir: '/media/wch/D/Project/mllm/build-arm/CMakeFiles/CMakeScratch/TryCompile-UICPj5'
Run Build Command(s): /home/wch/Downloads/cmake-3.28.1-linux-x86_64/bin/cmake -E env VERBOSE=1 /usr/bin/gmake -f Makefile cmTC_07689/fast
/usr/bin/gmake -f CMakeFiles/cmTC_07689.dir/build.make CMakeFiles/cmTC_07689.dir/build
gmake[1]: 进入目录“/media/wch/D/Project/mllm/build-arm/CMakeFiles/CMakeScratch/TryCompile-UICPj5”
Building C object CMakeFiles/cmTC_07689.dir/testCCompiler.c.o
/media/wch/D/commonlib/android-ndk-r26d/toolchains/llvm/prebuilt/linux-x86_64/bin/clang -g -DANDROID -fdata-sections -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security -o CMakeFiles/cmTC_07689.dir/testCCompiler.c.o -c /media/wch/D/Project/mllm/build-arm/CMakeFiles/CMakeScratch/TryCompile-UICPj5/testCCompiler.c
clang-17: error: no input files
gmake[1]: *** [CMakeFiles/cmTC_07689.dir/build.make:78:CMakeFiles/cmTC_07689.dir/testCCompiler.c.o] error 1
gmake[1]: 离开目录“/media/wch/D/Project/mllm/build-arm/CMakeFiles/CMakeScratch/TryCompile-UICPj5”
gmake: *** [Makefile:127:cmTC_07689/fast] error 2
CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
CMakeLists.txt:3 (project) I'm confused that why there has a |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 5 replies
-
It's very unlikely that anyone will be able to help without a repro case. |
Beta Was this translation helpful? Give feedback.
-
Hey there, I'm also seeing this behaviour. Same error (no input files), the compiler identification being "unknown". I'm using Fedora 40 (KDE), with the latest clang installed (shouldn't matter), cmake v3.28.2, and ndk r26d |
Beta Was this translation helpful? Give feedback.
After some mindless digging I seem to have fixed it. The problem was caused by the ndk being somehow corrupted by my unzip software (ark). Used
unzip
on the archive and it now works. Weird.