zoukankan      html  css  js  c++  java
  • CMake Error: CMake was unable to find a build program corresponding to "Ninja".

    系统环境:

    $ 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

  • 相关阅读:
    HDU 4539郑厂长系列故事――排兵布阵(状压DP)
    HDU 2196Computer(树形DP)
    HDU 4284Travel(状压DP)
    HDU 1520Anniversary party(树型DP)
    HDU 3920Clear All of Them I(状压DP)
    HDU 3853LOOPS(简单概率DP)
    UVA 11983 Weird Advertisement(线段树求矩形并的面积)
    POJ 2886Who Gets the Most Candies?(线段树)
    POJ 2828Buy Tickets
    HDU 1394Minimum Inversion Number(线段树)
  • 原文地址:https://www.cnblogs.com/xlmeng1988/p/cmake_ninja_error.html
Copyright © 2011-2022 走看看