cmake msys2 mingw无法编译简单的测试程序

问题描述 投票:0回答:1

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

我正在运行装有当前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个回答
0
投票

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

© www.soinside.com 2019 - 2024. All rights reserved.