【问题标题】:CMake 3.13.2 seems to have issues with G++ 8.2.0CMake 3.13.2 似乎与 G++ 8.2.0 有问题
【发布时间】:2019-06-01 07:38:17
【问题描述】:

我正在使用 MinGW 将我的 G++ 编译器升级到版本 8.2.0。 现在 Cmake 不再工作了。

在 64 位 Win10 上工作。

它告诉我“gcc.exe 无法编译简单的测试程序”。虽然编译器、gcc 和 g++ 都在控制台上为我工作。

我已经尝试过多次重新安装编译器,但没有任何结果。

C:\temp>g++ --version
        g++ (MinGW.org GCC-8.2.0-1) 8.2.0
Copyright (C) 2018 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
        warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

C:\temp>cmake --version
        cmake version 3.13.2

CMake suite maintained and supported by Kitware (kitware.com/cmake).

C:\temp>g++ hello.cpp

        C:\temp>a.exe
        Hello, World!

C:\temp>gcc hello.c

        C:\temp>a.exe
        Hello World

        C:\temp>cmake . -G "MinGW Makefiles"
-- The C compiler identification is GNU 8.2.0
-- The CXX compiler identification is GNU 8.2.0
-- Check for working C compiler: C:/MinGW/bin/gcc.exe
-- Check for working C compiler: C:/MinGW/bin/gcc.exe -- broken
        CMake Error at C:/Program Files/CMake/share/cmake-3.13/Modules/CMakeTestCCompiler.cmake:52 (message):
The C compiler

"C:/MinGW/bin/gcc.exe"

is not able to compile a simple test program.

It fails with the following output:

Change Dir: C:/temp/CMakeFiles/CMakeTmp

        Run Build Command:"C:/MinGW/bin/mingw32-make.exe" "cmTC_7fbea/fast"
C:/MinGW/bin/mingw32-make.exe -f CMakeFiles\cmTC_7fbea.dir\build.make CMakeFiles/cmTC_7fbea.dir/build
        mingw32-make.exe[1]: Entering directory 'C:/temp/CMakeFiles/CMakeTmp'
Building C object CMakeFiles/cmTC_7fbea.dir/testCCompiler.c.obj
        C:\MinGW\bin\gcc.exe    -o CMakeFiles\cmTC_7fbea.dir\testCCompiler.c.obj   -c C:\temp\CMakeFiles\CMakeTmp\testCCompiler.c
        Linking C executable cmTC_7fbea.exe
"C:\Program Files\CMake\bin\cmake.exe" -E cmake_link_script CMakeFiles\cmTC_7fbea.dir\link.txt --verbose=1
"C:\Program Files\CMake\bin\cmake.exe" -E remove -f CMakeFiles\cmTC_7fbea.dir/objects.a
        C:\MinGW\bin\ar.exe cr CMakeFiles\cmTC_7fbea.dir/objects.a @CMakeFiles\cmTC_7fbea.dir\objects1.rsp
        C:\MinGW\bin\ar.exe: could not create temporary file whilst writing archive: no more archived files
CMakeFiles\cmTC_7fbea.dir\build.make:87: recipe for target 'cmTC_7fbea.exe' failed
        mingw32-make.exe[1]: *** [cmTC_7fbea.exe] Error 1
mingw32-make.exe[1]: Leaving directory 'C:/temp/CMakeFiles/CMakeTmp'
Makefile:120: recipe for target 'cmTC_7fbea/fast' failed
        mingw32-make.exe: *** [cmTC_7fbea/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:/temp/CMakeFiles/CMakeOutput.log".
See also "C:/temp/CMakeFiles/CMakeError.log".

非常感谢任何帮助!

【问题讨论】:

  • cmake 3.12.4 出现同样的问题
  • MinGW-W64 (sourceforge.net/projects/mingw-w64/files) 没有问题,但最新的 MinGW-W64 编译器是 8.1.0 检查工作 C 编译器:C:/mingw64/bin/gcc.exe --作品
  • 我正在使用mingw32,我应该切换到mingw-64吗?
  • MinGW-w64 是一个改进的版本,它支持 32 位和 64 位,以及更多的 WinAPI(仍然不是全部,因为工作量很大,但比 MinGW 更多)。

标签: c++ gcc cmake g++


【解决方案1】:

切换到 mingw-64 解决了我的问题!

【讨论】:

    猜你喜欢
    • 2012-09-01
    • 2011-03-14
    • 2022-06-22
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-10-22
    • 1970-01-01
    相关资源
    最近更新 更多