系统环境:
$ lsb_release -a LSB Version: :base-4.0-amd64:base-4.0-noarch:core-4.0-amd64:core-4.0-noarch:graphics-4.0-amd64:graphics-4.0-noarch:printing-4.0-amd64:printing-4.0-noarch Distributor ID: CentOS Description: CentOS release 6.8 (Final) Release: 6.8 Codename: Final $ getconf LONG_BIT 64 $ which cmake /usr/bin/cmake $ cmake --version cmake version 2.8.12.2 $ which ninja /usr/bin/ninja $ ninja --version 1.7.1
问题:使用cmake工具且选用Ninja作为编译工具(build program)时,报错,找不到Ninja的程序,具体信息如下:
1 CMake Error: CMake was unable to find a build program corresponding to "Ninja". CMAKE_MAKE_PROGRAM is not set. You probably need to select a different build tool. 2 CMake Error: Error required internal CMake variable not set, cmake may be not be built correctly. 3 Missing variable is: 4 CMAKE_C_COMPILER 5 CMake Error: Could not find cmake module file: /home/jgeng/avs2-build/CMakeFiles/2.8.12.2/CMakeCCompiler.cmake 6 CMake Error: Error required internal CMake variable not set, cmake may be not be built correctly. 7 Missing variable is: 8 CMAKE_CXX_COMPILER_ENV_VAR 9 CMake Error: Error required internal CMake variable not set, cmake may be not be built correctly. 10 Missing variable is: 11 CMAKE_CXX_COMPILER 12 CMake Error: Could not find cmake module file: /home/jgeng/avs2-build/CMakeFiles/2.8.12.2/CMakeCXXCompiler.cmake 13 -- Configuring incomplete, errors occurred!
解决方法:
# ln -s /usr/bin/ninja /usr/bin/ninja-build
# strace cmake -GNinja .. | grep -i ninja access("ninja-build", R_OK) = -1 ENOENT (No such file or directory) access("/usr/local/sbin/ninja-build", R_OK) = -1 ENOENT (No such file or directory) access("/usr/local/bin/ninja-build", R_OK) = -1 ENOENT (No such file or directory) access("/sbin/ninja-build", R_OK) = -1 ENOENT (No such file or directory) access("/bin/ninja-build", R_OK) = -1 ENOENT (No such file or directory) access("/usr/sbin/ninja-build", R_OK) = -1 ENOENT (No such file or directory) access("/usr/bin/ninja-build", R_OK) = -1 ENOENT (No such file or directory)
cmake 在设置build program的时候找的是ninja-build程序,而不是ninja程序。
参考:https://stackoverflow.com/questions/38658014/ninja-not-found-by-cmake
所有评论(0)