【问题标题】:cmake msys2 mingw is not able to compile a simple test programcmake msys2 mingw 无法编译简单的测试程序
【发布时间】:2023-04-08 10:35:01
【问题描述】:

昨天我能够毫无问题地配置和编译我的项目。现在我做了一些系统更新,编译器无法通过检查。我被困在那里好几个小时了-

我正在运行安装了当前 MSYS2 的 Windows 10。包是最新的。当我检查 --debug-trycompile 时,我看到 testCCompiler.c 文件已创建,并且还有一个可执行文件,我可以毫无问题地运行它。因此,我不知道究竟是什么导致了这个错误。

当我进入目录并执行完全相同的命令时,它也在工作。

[cmake] Check for working C compiler: C:/msys64/mingw64/bin/gcc.exe
[cmake] Check for working C compiler: C:/msys64/mingw64/bin/gcc.exe -- broken
[cmake] CMake Error at C:/msys64/mingw64/share/cmake-3.15/Modules/CMakeTestCCompiler.cmake:60 (message):
[cmake]   The C compiler
[cmake] 
[cmake]     "C:/msys64/mingw64/bin/gcc.exe"
[cmake] 
[cmake]   is not able to compile a simple test program.
[cmake] 
[cmake]   It fails with the following output:
[cmake] 
[cmake]     Change Dir: C:/Users/bscb/Documents/code/MachineLearning/build/CMakeFiles/CMakeTmp
[cmake]     
[cmake]     Run Build Command(s):C:/Ninja/ninja.exe cmTC_aef7d && [1/2] Building C object CMakeFiles/cmTC_aef7d.dir/testCCompiler.c.obj
[cmake]     [2/2] Linking C executable cmTC_aef7d.exe
[cmake]     FAILED: cmTC_aef7d.exe 
[cmake]     cmd.exe /C "cd . && C:\msys64\mingw64\bin\gcc.exe    CMakeFiles/cmTC_aef7d.dir/testCCompiler.c.obj  -o cmTC_aef7d.exe -Wl,--major-image-version,0,--minor-image-version,0  -lkernel32 -luser32 -lgdi32 -lwinspool -lshell32 -lole32 -loleaut32 -luuid -lcomdlg32 -ladvapi32 && cd ."
[cmake]     Das System kann den angegebenen Pfad nicht finden.
[cmake]     ninja: build stopped: subcommand failed.

【问题讨论】:

    标签: windows gcc cmake mingw-w64 msys2


    【解决方案1】:

    解决方案是有一个由 conda 创建的 cmd.exe 初始化脚本,它链接到一个不存在的批处理文件。

    【讨论】:

    • 嗨 bazz-dee,您能否提供有关此解决方案的更多信息?
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2015-08-13
    • 1970-01-01
    • 2021-03-18
    • 1970-01-01
    • 2014-12-10
    • 2021-02-02
    • 2017-11-16
    相关资源
    最近更新 更多