Open yao-zheng-yi opened 3 years ago
make[1]: execvp: /home/xxx/ncnn/android-ndk-r21b/toolchains/llvm/prebuilt/linux-x86_64/bin/clang: Permission denied
看起来是权限问题。
make[1]: execvp: /home/xxx/ncnn/android-ndk-r21b/toolchains/llvm/prebuilt/linux-x86_64/bin/clang: Permission denied
看起来是权限问题。
多谢,我去试试看
make[1]: execvp: /home/xxx/ncnn/android-ndk-r21b/toolchains/llvm/prebuilt/linux-x86_64/bin/clang: Permission denied
看起来是权限问题。
我给clang文件增加了执行的权限,虽然Permission denied的错误消失了,但还是报同样的错。有其他办法解决吗
CMake Error at /usr/local/share/cmake-3.9/Modules/CMakeTestCCompiler.cmake:51 (message): The C compiler "/home/cwy/ncnn/android-ndk-r21b/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: /home/cwy/ncnn/build-android-armv7/CMakeFiles/CMakeTmp
Run Build Command:"/usr/bin/make" "cmTC_347bd/fast"
/usr/bin/make -f CMakeFiles/cmTC_347bd.dir/build.make CMakeFiles/cmTC_347bd.dir/build
make[1]: Entering directory '/home/cwy/ncnn/build-android-armv7/CMakeFiles/CMakeTmp'
Building C object CMakeFiles/cmTC_347bd.dir/testCCompiler.c.o
/home/cwy/ncnn/android-ndk-r21b/toolchains/llvm/prebuilt/linux-x86_64/bin/clang --target=armv7-none-linux-androideabi24 --gcc-toolchain=/home/cwy/ncnn/android-ndk-r21b/toolchains/llvm/prebuilt/linux-x86_64 --sysroot=/home/cwy/ncnn/android-ndk-r21b/toolchains/llvm/prebuilt/linux-x86_64/sysroot -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 -fPIE -o CMakeFiles/cmTC_347bd.dir/testCCompiler.c.o -c /home/cwy/ncnn/build-android-armv7/CMakeFiles/CMakeTmp/testCCompiler.c
Linking C executable cmTC_347bd
/usr/local/bin/cmake -E cmake_link_script CMakeFiles/cmTC_347bd.dir/link.txt --verbose=1
/home/cwy/ncnn/android-ndk-r21b/toolchains/llvm/prebuilt/linux-x86_64/bin/clang --target=armv7-none-linux-androideabi24 --gcc-toolchain=/home/cwy/ncnn/android-ndk-r21b/toolchains/llvm/prebuilt/linux-x86_64 --sysroot=/home/cwy/ncnn/android-ndk-r21b/toolchains/llvm/prebuilt/linux-x86_64/sysroot -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 -Wl,--exclude-libs,libgcc.a -Wl,--exclude-libs,libgcc_real.a -Wl,--exclude-libs,libatomic.a -static-libstdc++ -Wl,--build-id -Wl,--fatal-warnings -Wl,--exclude-libs,libunwind.a -Wl,--no-undefined -Qunused-arguments -Wl,--gc-sections CMakeFiles/cmTC_347bd.dir/testCCompiler.c.o -o cmTC_347bd -latomic -lm
/usr/bin/ld: unrecognised emulation mode: armelf_linux_eabi
Supported emulations: elf_x86_64 elf32_x86_64 elf_i386 elf_iamcu i386linux elf_l1om elf_k1om i386pep i386pe
clang: error: linker command failed with exit code 1 (use -v to see invocation)
CMakeFiles/cmTC_347bd.dir/build.make:97: recipe for target 'cmTC_347bd' failed
make[1]: *** [cmTC_347bd] Error 1
make[1]: Leaving directory '/home/cwy/ncnn/build-android-armv7/CMakeFiles/CMakeTmp'
Makefile:126: recipe for target 'cmTC_347bd/fast' failed
make: *** [cmTC_347bd/fast] Error 2
CMake will not be able to correctly generate this project. Call Stack (most recent call first): CMakeLists.txt:25 (project)
-- Configuring incomplete, errors occurred! See also "/home/cwy/ncnn/build-android-armv7/CMakeFiles/CMakeOutput.log". See also "/home/cwy/ncnn/build-android-armv7/CMakeFiles/CMakeError.log".
(1)先确认下编译器能否正常使用
cmake_minimum_required(VERSION 3.6)
project(hello)
add_executable(hello hello.cpp)
hello.cpp
:
#include <iostream>
int main() {
std::cout << "Hi" << std::endl;
return 0;
}
编译:
mkdir build
cd build
cmake ..
make
./hello
(2)然后考虑在编译的项目的CMakeLists.txt是否正常。
参考教程build for Android 执行命令行 cmake -DCMAKE_TOOLCHAIN_FILE="$ANDROID_NDK/build/cmake/android.toolchain.cmake" \ -DANDROID_ABI="armeabi-v7a" -DANDROID_ARM_NEON=ON \ -DANDROID_PLATFORM=android-24 -DNCNN_VULKAN=ON .. 时编译出错, -- CMAKE_TOOLCHAIN_FILE = /home/xxx/ncnn/build-android-armv7/$/home/xxx/ncnn/android-ndk-r21b/build/cmake/android.toolchain.cmake -- CMAKE_INSTALL_PREFIX = /home/xxx/ncnn/build-android-armv7/install -- Check for working C compiler: /home/xxx/ncnn/android-ndk-r21b/toolchains/llvm/prebuilt/linux-x86_64/bin/clang -- Check for working C compiler: /home/xxx/ncnn/android-ndk-r21b/toolchains/llvm/prebuilt/linux-x86_64/bin/clang -- broken CMake Error at /home/xxx/cmake-3.9.1-Linux-x86_64/share/cmake-3.9/Modules/CMakeTestCCompiler.cmake:51 (message): The C compiler "/home/xxx/ncnn/android-ndk-r21b/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: /home/xxx/ncnn/build-android-armv7/CMakeFiles/CMakeTmp
Run Build Command:"/usr/bin/make" "cmTC_955cf/fast"
/usr/bin/make -f CMakeFiles/cmTC_955cf.dir/build.make CMakeFiles/cmTC_955cf.dir/build
make[1]: Entering directory '/home/xxx/ncnn/build-android-armv7/CMakeFiles/CMakeTmp'
Building C object CMakeFiles/cmTC_955cf.dir/testCCompiler.c.o
/home/xxx/ncnn/android-ndk-r21b/toolchains/llvm/prebuilt/linux-x86_64/bin/clang --target=armv7-none-linux-androideabi24 --gcc-toolchain=/home/xxx/ncnn/android-ndk-r21b/toolchains/llvm/prebuilt/linux-x86_64 --sysroot=/home/xxx/ncnn/android-ndk-r21b/toolchains/llvm/prebuilt/linux-x86_64/sysroot -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 -fPIE -o CMakeFiles/cmTC_955cf.dir/testCCompiler.c.o -c /home/xxx/ncnn/build-android-armv7/CMakeFiles/CMakeTmp/testCCompiler.c
make[1]: execvp: /home/xxx/ncnn/android-ndk-r21b/toolchains/llvm/prebuilt/linux-x86_64/bin/clang: Permission denied
CMakeFiles/cmTC_955cf.dir/build.make:65: recipe for target 'CMakeFiles/cmTC_955cf.dir/testCCompiler.c.o' failed
make[1]: *** [CMakeFiles/cmTC_955cf.dir/testCCompiler.c.o] Error 127
make[1]: Leaving directory '/home/xxx/ncnn/build-android-armv7/CMakeFiles/CMakeTmp'
Makefile:126: recipe for target 'cmTC_955cf/fast' failed
make: *** [cmTC_955cf/fast] Error 2
CMake will not be able to correctly generate this project. Call Stack (most recent call first): CMakeLists.txt:25 (project)
-- Configuring incomplete, errors occurred! See also "/home/xxx/ncnn/build-android-armv7/CMakeFiles/CMakeOutput.log". See also "/home/xxx/ncnn/build-android-armv7/CMakeFiles/CMakeError.log". @nihui 请问该如何解决?