【发布时间】:2021-07-20 05:11:46
【问题描述】:
我在 Windows 上使用 MSYS2 + MinGW x64 + CMake 作为我的开发设置。目前,为了初始化我的项目,我打开一个 "MSYS2 MinGW 64-bit" shell 并调用 CMake,如下所示:
cmake .. -G"MinGW Makefiles"
这很好用,但我想使用ninja 而不是make。因此,我通过我的 MSYS2 shell 安装了mingw-w64-x86_64-ninja,使其在我的 MinGW 环境中可用。我期待
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
这似乎是 / 与 \ 的问题。
-
是否有解决此问题的方法或解决方法?
-
我可以在 Windows 10 上的 MSYS2 + MinGW x64 设置上使用 Ninja 作为我的生成器吗?
【问题讨论】:
标签: c++ windows cmake mingw ninja