代码之家  ›  专栏  ›  技术社区  ›  Vittorio Romeo

在Windows10x64上使用Ninja作为带有MSYS2+MinGW的生成器

  •  0
  • Vittorio Romeo  · 技术社区  · 4 年前

    “MSYS2 MinGW 64位” shell并调用CMake,如下所示:

    cmake .. -G"MinGW Makefiles"
    

    ninja 而不是 make . 因此,我安装了 mingw-w64-x86_64-ninja

    cmake .. -G"Ninja"
    

    但它失败了,出现以下错误:

    -- The C compiler identification is GNU 10.2.0
    -- The CXX compiler identification is GNU 10.2.0
    -- Detecting C compiler ABI info
    -- Detecting C compiler ABI info - failed
    -- Check for working C compiler: C:/msys64/mingw64/bin/gcc.exe
    -- Check for working C compiler: C:/msys64/mingw64/bin/gcc.exe - broken
    CMake Error at C:/msys64/mingw64/share/cmake-3.20/Modules/CMakeTestCCompiler.cmake:66 (message):
      The C compiler
    
        "C:/msys64/mingw64/bin/gcc.exe"
    
      is not able to compile a simple test program.
    
      It fails with the following output:
    
        Change Dir: C:/projecct/build/CMakeFiles/CMakeTmp
    
        Run Build Command(s):C:/msys64/usr/bin/ninja.exe cmTC_c3f3d && [1/2] Building C object CMakeFiles/cmTC_c3f3d.dir/testCCompiler.c.obj
        FAILED: CMakeFiles/cmTC_c3f3d.dir/testCCompiler.c.obj
        C:\msys64\mingw64\bin\gcc.exe    -o CMakeFiles/cmTC_c3f3d.dir/testCCompiler.c.obj -c testCCompiler.c
        /bin/sh: line 1: C:msys64mingw64bingcc.exe: command not found
        ninja: build stopped: subcommand failed.
    
    
    
    
    
      CMake will not be able to correctly generate this project.
    Call Stack (most recent call first):
      CMakeLists.txt:2 (project)
    
    
    -- Configuring incomplete, errors occurred!
    See also "C:/project/build/CMakeFiles/CMakeOutput.log".
    See also "C:/project/build/CMakeFiles/CMakeError.log".
    

     /bin/sh: line 1: C:msys64mingw64bingcc.exe: command not found
    

    看来这是一个 / \

    • 我可以在Windows10上的MSYS2+MingWx64安装程序中使用Ninja作为生成器吗?

    1 回复  |  直到 4 年前
        1
  •  1
  •   Vittorio Romeo    4 年前

    在我的公司,我们每天都在Windows10上使用mingw64+ninja。我不确定你的设置出了什么问题,这里有一些提示:

    • 从中运行cmake 外壳,而不是 msys2型 外壳(通常 C:/msys64/mingw64.exe )
    • 确保已安装 mingw-w64-x86_64-cmake cmake mingw-w64-cmake .
    • mingw-w64-x86_64-ninja ninja mingw-w64-ninja

    记住这两项,在我的windows10机器上,我可以成功地用ninja配置和编译(假设我们的设置有点旧,我们冻结了几年前的msys2版本)。

    推荐文章