Я получаю это при компиляции очень простого CMakeLists.txt
C:\Users\LZ\sw\test\integrations\cmake\tess>cmake -G "MinGW Makefiles" .
-- The CXX compiler identification is unknown
-- Check for working CXX compiler: C:/MinGW/bin/g++.exe
-- Check for working CXX compiler: C:/MinGW/bin/g++.exe - broken
CMake Error at C:/Program Files/CMake/share/cmake-3.17/Modules/CMakeTestCXXCompiler.cmake:53 (message):
The C++ compiler
"C:/MinGW/bin/g++.exe"
is not able to compile a simple test program.
It fails with the following output:
Change Dir: C:/Users/LZ/sw/test/integrations/cmake/tess/CMakeFiles/CMakeTmp
Run Build Command(s):C:/MinGW/bin/mingw32-make.exe cmTC_37ce9/fast && C:/MinGW/bin/mingw32-make.exe -f CMakeFiles\cmTC_37ce9.dir\build.make CMakeFiles/cmTC_37ce9.dir/build
mingw32-make.exe[1]: Entering directory 'C:/Users/LZ/sw/test/integrations/cmake/tess/CMakeFiles/CMakeTmp'
Building CXX object CMakeFiles/cmTC_37ce9.dir/testCXXCompiler.cxx.obj
C:\MinGW\bin\g++.exe -o CMakeFiles\cmTC_37ce9.dir\testCXXCompiler.cxx.obj -c C:\Users\LZ\sw\test\integrations\cmake\tess\CMakeFiles\CMakeTmp\testCXXCompiler.cxx
CMakeFiles\cmTC_37ce9.dir\build.make:81: recipe for target 'CMakeFiles/cmTC_37ce9.dir/testCXXCompiler.cxx.obj' failed
mingw32-make.exe[1]: *** [CMakeFiles/cmTC_37ce9.dir/testCXXCompiler.cxx.obj] Error 1
mingw32-make.exe[1]: Leaving directory 'C:/Users/LZ/sw/test/integrations/cmake/tess/CMakeFiles/CMakeTmp'
Makefile:137: recipe for target 'cmTC_37ce9/fast' failed
mingw32-make.exe: *** [cmTC_37ce9/fast] Error 2
CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
CMakeLists.txt:3 (project)
-- Configuring incomplete, errors occurred!
See also "C:/Users/LZ/sw/test/integrations/cmake/tess/CMakeFiles/CMakeOutput.log".
See also "C:/Users/LZ/sw/test/integrations/cmake/tess/CMakeFiles/CMakeError.log".
Вот C:/Users/LZ/sw/test/integrations/cmake/tess/CMakeFiles/CMakeError.log
:
Compiling the CXX compiler identification source file "CMakeCXXCompilerId.cpp" failed.
Compiler: C:/MinGW/bin/g++.exe
Build flags:
Id flags:
The output was:
1
Compiling the CXX compiler identification source file "CMakeCXXCompilerId.cpp" failed.
Compiler: C:/MinGW/bin/g++.exe
Build flags:
Id flags: -c
The output was:
1
Compiling the CXX compiler identification source file "CMakeCXXCompilerId.cpp" failed.
Compiler: C:/MinGW/bin/g++.exe
Build flags:
Id flags: --c++
The output was:
1
g++.exe: error: unrecognized command line option '--c++'
Compiling the CXX compiler identification source file "CMakeCXXCompilerId.cpp" failed.
Compiler: C:/MinGW/bin/g++.exe
Build flags:
Id flags: --ec++
The output was:
1
g++.exe: error: unrecognized command line option '--ec++'; did you mean '-Weffc++'?
Compiling the CXX compiler identification source file "CMakeCXXCompilerId.cpp" failed.
Compiler: C:/MinGW/bin/g++.exe
Build flags:
Id flags: --target=arm-arm-none-eabi;-mcpu=cortex-m3
The output was:
1
g++.exe: warning: '-mcpu=' is deprecated; use '-mtune=' or '-march=' instead
g++.exe: error: unrecognized command line option '--target=arm-arm-none-eabi'
Compiling the CXX compiler identification source file "CMakeCXXCompilerId.cpp" failed.
Compiler: C:/MinGW/bin/g++.exe
Build flags:
Id flags:
The output was:
1
Compiling the CXX compiler identification source file "CMakeCXXCompilerId.cpp" failed.
Compiler: C:/MinGW/bin/g++.exe
Build flags:
Id flags: -c
The output was:
1
Compiling the CXX compiler identification source file "CMakeCXXCompilerId.cpp" failed.
Compiler: C:/MinGW/bin/g++.exe
Build flags:
Id flags: --c++
The output was:
1
g++.exe: error: unrecognized command line option '--c++'
Compiling the CXX compiler identification source file "CMakeCXXCompilerId.cpp" failed.
Compiler: C:/MinGW/bin/g++.exe
Build flags:
Id flags: --ec++
The output was:
1
g++.exe: error: unrecognized command line option '--ec++'; did you mean '-Weffc++'?
Compiling the CXX compiler identification source file "CMakeCXXCompilerId.cpp" failed.
Compiler: C:/MinGW/bin/g++.exe
Build flags:
Id flags: --target=arm-arm-none-eabi;-mcpu=cortex-m3
The output was:
1
g++.exe: warning: '-mcpu=' is deprecated; use '-mtune=' or '-march=' instead
g++.exe: error: unrecognized command line option '--target=arm-arm-none-eabi'
Checking whether the CXX compiler is IAR using "" did not match "IAR .+ Compiler":
g++.exe: fatal error: no input files
compilation terminated.
Checking whether the CXX compiler is IAR using "" did not match "IAR .+ Compiler":
g++.exe: fatal error: no input files
compilation terminated.
Determining if the CXX compiler works failed with the following output:
Change Dir: C:/Users/LZ/sw/test/integrations/cmake/tess/CMakeFiles/CMakeTmp
Run Build Command(s):C:/MinGW/bin/mingw32-make.exe cmTC_b7c4e/fast && C:/MinGW/bin/mingw32-make.exe -f CMakeFiles\cmTC_b7c4e.dir\build.make CMakeFiles/cmTC_b7c4e.dir/build
mingw32-make.exe[1]: Entering directory 'C:/Users/LZ/sw/test/integrations/cmake/tess/CMakeFiles/CMakeTmp'
Building CXX object CMakeFiles/cmTC_b7c4e.dir/testCXXCompiler.cxx.obj
C:\MinGW\bin\g++.exe -o CMakeFiles\cmTC_b7c4e.dir\testCXXCompiler.cxx.obj -c C:\Users\LZ\sw\test\integrations\cmake\tess\CMakeFiles\CMakeTmp\testCXXCompiler.cxx
CMakeFiles\cmTC_b7c4e.dir\build.make:81: recipe for target 'CMakeFiles/cmTC_b7c4e.dir/testCXXCompiler.cxx.obj' failed
mingw32-make.exe[1]: *** [CMakeFiles/cmTC_b7c4e.dir/testCXXCompiler.cxx.obj] Error 1
mingw32-make.exe[1]: Leaving directory 'C:/Users/LZ/sw/test/integrations/cmake/tess/CMakeFiles/CMakeTmp'
Makefile:137: recipe for target 'cmTC_b7c4e/fast' failed
mingw32-make.exe: *** [cmTC_b7c4e/fast] Error 2
Похоже, что MinGW думает Я кросс-компиляции, хотя я не указал кросс-компиляции на моем CMakeLists.txt. Или он просто пытается что-то кросс-компилировать, но ошибка может быть в другом.
Я запускаю это на PowerShell. Я также попробовал cmd.exe. Он работает на оболочке MinGW64 из MSYS2, но это не относится к C:/MinGW/bin/g++.exe
, и я не могу использовать эту другую оболочку, потому что она жалуется на то, что sw.exe
находится в пути, и я не могу ее извлечь, потому что я должен запустить sw setup
.
Как мне решить эту проблему?