系统环境:

$ 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

 

转载于:https://www.cnblogs.com/xlmeng1988/p/cmake_ninja_error.html

GitHub 加速计划 / ni / ninja
4
0
下载
a small build system with a focus on speed
最近提交(Master分支:3 个月前 )
dcefb838 Fix typo: Explaantions -> Explanations 6 个月前
2f19d3a0 - 6 个月前
Logo

旨在为数千万中国开发者提供一个无缝且高效的云端环境,以支持学习、使用和贡献开源项目。

更多推荐