CMake и MinGW - «Компилятор C не может скомпилировать простую тестовую программу» - PullRequest
1 голос
/ 18 июня 2020

Я использую для сборки 64-разрядную версию CMake и MinGW-w64. Я использовал ту же настройку с тем же компилятором на другом моем P C, и это сработало. Не уверен, что случилось.

У меня есть корзина MinGW-w64 в моем PATH. Когда я запускаю cmake и не указываю путь к компилятору, он успешно генерирует файлы сборки MinGW. Однако, когда я указываю компилятор (который, как я знаю, работает, я получил его на winlibs.com), он создает следующий журнал. Я использую Windows 10.

Detecting C compiler ABI info failed to compile with the following output:
Change Dir: C:/Libraries/Projects/CMakeTest/build/MinGW-10.1.0-64-bit/debug/CMakeFiles/CMakeTmp

Run Build Command(s):C:/MinGW/MinGW-10.1.0-64-bit/bin/mingw32-make.exe cmTC_a01cd/fast && C:/MinGW/MinGW-10.1.0-64-bit/bin/mingw32-make.exe  -f CMakeFiles\cmTC_a01cd.dir\build.make CMakeFiles/cmTC_a01cd.dir/build

mingw32-make[1]: Entering directory 'C:/Libraries/Projects/CMakeTest/build/MinGW-10.1.0-64-bit/debug/CMakeFiles/CMakeTmp'

Building C object CMakeFiles/cmTC_a01cd.dir/CMakeCCompilerABI.c.obj

C:\MinGW\MinGW-10.1.0-64-bit\bin\x86_64-w64-mingw32-gcc.exe   -v -o CMakeFiles\cmTC_a01cd.dir\CMakeCCompilerABI.c.obj -c "C:\Program Files\CMake\share\cmake-3.18\Modules\CMakeCCompilerABI.c"

Using built-in specs.

COLLECT_GCC=C:\MinGW\MinGW-10.1.0-64-bit\bin\x86_64-w64-mingw32-gcc.exe

Target: x86_64-w64-mingw32

Configured with: ../configure --prefix=/R/winlibs64_10.1.0/inst_gcc-10.1.0/share/gcc --build=x86_64-w64-mingw32 --host=x86_64-w64-mingw32 --with-pkgversion='MinGW-W64 x86_64-posix-seh, built by Brecht Sanders' --with-tune=generic --enable-checking=release --enable-threads=posix --disable-sjlj-exceptions --disable-libunwind-exceptions --enable-serial-configure --disable-bootstrap --enable-host-shared --enable-plugin --enable-default-ssp --disable-rpath --disable-libstdcxx-pch --enable-libstdcxx-time=yes --disable-libstdcxx-debug --disable-version-specific-runtime-libs --with-stabs --disable-symvers --enable-languages=c,c++,fortran,lto,objc,obj-c++,d --disable-gold --disable-nls --disable-stage1-checking --disable-win32-registry --disable-multilib --enable-ld --enable-libquadmath --enable-libada --enable-libssp --enable-libstdcxx --enable-lto --enable-fully-dynamic-string --enable-libgomp --enable-graphite --enable-mingw-wildcard --with-mpc=/d/winlibs64_10.1.0/custombuilt --with-mpfr=/d/winlibs64_10.1.0/custombuilt --with-gmp=/d/winlibs64_10.1.0/custombuilt --with-isl=/d/winlibs64_10.1.0/custombuilt --enable-install-libiberty --enable-__cxa_atexit --without-included-gettext --with-diagnostics-color=auto --with-libiconv --with-system-zlib --with-build-sysroot=/R/winlibs64_10.1.0/gcc-10.1.0/build_mingw/mingw-w64

Thread model: posix

Supported LTO compression algorithms: zlib zstd

gcc version 10.1.0 (MinGW-W64 x86_64-posix-seh, built by Brecht Sanders) 

COLLECT_GCC_OPTIONS='-v' '-o' 'CMakeFiles\cmTC_a01cd.dir\CMakeCCompilerABI.c.obj' '-c' '-mtune=generic' '-march=x86-64'

 c:/mingw/mingw-10.1.0-64-bit/bin/../libexec/gcc/x86_64-w64-mingw32/10.1.0/cc1.exe -quiet -v -iprefix c:\mingw\mingw-10.1.0-64-bit\bin\../lib/gcc/x86_64-w64-mingw32/10.1.0/ -D_REENTRANT C:\Program Files\CMake\share\cmake-3.18\Modules\CMakeCCompilerABI.c -quiet -dumpbase CMakeCCompilerABI.c -mtune=generic -march=x86-64 -auxbase-strip CMakeFiles\cmTC_a01cd.dir\CMakeCCompilerABI.c.obj -version -o C:\Users\gvcal\AppData\Local\Temp\ccHRxkpy.s

GNU C17 (MinGW-W64 x86_64-posix-seh, built by Brecht Sanders) version 10.1.0 (x86_64-w64-mingw32)

    compiled by GNU C version 10.1.0, GMP version 6.2.0, MPFR version 4.0.2, MPC version 1.1.0, isl version isl-0.22.1-GMP



GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072

ignoring duplicate directory "c:/mingw/mingw-10.1.0-64-bit/lib/gcc/../../lib/gcc/x86_64-w64-mingw32/10.1.0/include"

ignoring nonexistent directory "R:/winlibs64_10.1.0/inst_gcc-10.1.0/share/gcc/include"

ignoring nonexistent directory "/R/winlibs64_10.1.0/inst_gcc-10.1.0/share/gcc/include"

ignoring duplicate directory "c:/mingw/mingw-10.1.0-64-bit/lib/gcc/../../lib/gcc/x86_64-w64-mingw32/10.1.0/include-fixed"

ignoring duplicate directory "c:/mingw/mingw-10.1.0-64-bit/lib/gcc/../../lib/gcc/x86_64-w64-mingw32/10.1.0/../../../../x86_64-w64-mingw32/include"

ignoring nonexistent directory "/mingw/include"

#include "..." search starts here:

#include <...> search starts here:

 c:\mingw\mingw-10.1.0-64-bit\bin\../lib/gcc/x86_64-w64-mingw32/10.1.0/include

 c:\mingw\mingw-10.1.0-64-bit\bin\../lib/gcc/x86_64-w64-mingw32/10.1.0/../../../../include

 c:\mingw\mingw-10.1.0-64-bit\bin\../lib/gcc/x86_64-w64-mingw32/10.1.0/include-fixed

 c:\mingw\mingw-10.1.0-64-bit\bin\../lib/gcc/x86_64-w64-mingw32/10.1.0/../../../../x86_64-w64-mingw32/include

End of search list.

GNU C17 (MinGW-W64 x86_64-posix-seh, built by Brecht Sanders) version 10.1.0 (x86_64-w64-mingw32)

    compiled by GNU C version 10.1.0, GMP version 6.2.0, MPFR version 4.0.2, MPC version 1.1.0, isl version isl-0.22.1-GMP



GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072

Compiler executable checksum: 21a8d9a0add79f637093bff9641d5f35

COLLECT_GCC_OPTIONS='-v' '-o' 'CMakeFiles\cmTC_a01cd.dir\CMakeCCompilerABI.c.obj' '-c' '-mtune=generic' '-march=x86-64'

 c:/mingw/mingw-10.1.0-64-bit/bin/../lib/gcc/x86_64-w64-mingw32/10.1.0/../../../../x86_64-w64-mingw32/bin/as.exe -v -o CMakeFiles\cmTC_a01cd.dir\CMakeCCompilerABI.c.obj C:\Users\gvcal\AppData\Local\Temp\ccHRxkpy.s

GNU assembler version 2.34 (x86_64-w64-mingw32) using BFD version (Binutils for MinGW-W64 x86_64, built by Brecht Sanders) 2.34

COMPILER_PATH=c:/mingw/mingw-10.1.0-64-bit/bin/../libexec/gcc/x86_64-w64-mingw32/10.1.0/;c:/mingw/mingw-10.1.0-64-bit/bin/../libexec/gcc/;c:/mingw/mingw-10.1.0-64-bit/bin/../lib/gcc/x86_64-w64-mingw32/10.1.0/../../../../x86_64-w64-mingw32/bin/

LIBRARY_PATH=c:/mingw/mingw-10.1.0-64-bit/bin/../lib/gcc/x86_64-w64-mingw32/10.1.0/;c:/mingw/mingw-10.1.0-64-bit/bin/../lib/gcc/;c:/mingw/mingw-10.1.0-64-bit/bin/../lib/gcc/x86_64-w64-mingw32/10.1.0/../../../../x86_64-w64-mingw32/lib/../lib/;c:/mingw/mingw-10.1.0-64-bit/bin/../lib/gcc/x86_64-w64-mingw32/10.1.0/../../../../lib/;c:/mingw/mingw-10.1.0-64-bit/bin/../lib/gcc/x86_64-w64-mingw32/10.1.0/../../../../x86_64-w64-mingw32/lib/;c:/mingw/mingw-10.1.0-64-bit/bin/../lib/gcc/x86_64-w64-mingw32/10.1.0/../../../

COLLECT_GCC_OPTIONS='-v' '-o' 'CMakeFiles\cmTC_a01cd.dir\CMakeCCompilerABI.c.obj' '-c' '-mtune=generic' '-march=x86-64'

Linking C executable cmTC_a01cd.exe

"C:\Program Files\CMake\bin\cmake.exe" -E cmake_link_script CMakeFiles\cmTC_a01cd.dir\link.txt --verbose=1

"C:\Program Files\CMake\bin\cmake.exe" -E rm -f CMakeFiles\cmTC_a01cd.dir/objects.a
CMAKE_AR-NOTFOUND cr CMakeFiles\cmTC_a01cd.dir/objects.a @CMakeFiles\cmTC_a01cd.dir\objects1.rsp
Error running link command: The system cannot find the file specified
mingw32-make[1]: *** [CMakeFiles\cmTC_a01cd.dir\build.make:107: cmTC_a01cd.exe] Error 2

mingw32-make[1]: Leaving directory 'C:/Libraries/Projects/CMakeTest/build/MinGW-10.1.0-64-bit/debug/CMakeFiles/CMakeTmp'

mingw32-make: *** [makefile:140: cmTC_a01cd/fast] Error 2





Determining if the C compiler works failed with the following output:
Change Dir: C:/Libraries/Projects/CMakeTest/build/MinGW-10.1.0-64-bit/debug/CMakeFiles/CMakeTmp

Run Build Command(s):C:/MinGW/MinGW-10.1.0-64-bit/bin/mingw32-make.exe cmTC_f77ee/fast && C:/MinGW/MinGW-10.1.0-64-bit/bin/mingw32-make.exe  -f CMakeFiles\cmTC_f77ee.dir\build.make CMakeFiles/cmTC_f77ee.dir/build

mingw32-make[1]: Entering directory 'C:/Libraries/Projects/CMakeTest/build/MinGW-10.1.0-64-bit/debug/CMakeFiles/CMakeTmp'

Building C object CMakeFiles/cmTC_f77ee.dir/testCCompiler.c.obj

C:\MinGW\MinGW-10.1.0-64-bit\bin\x86_64-w64-mingw32-gcc.exe    -o CMakeFiles\cmTC_f77ee.dir\testCCompiler.c.obj -c C:\Libraries\Projects\CMakeTest\build\MinGW-10.1.0-64-bit\debug\CMakeFiles\CMakeTmp\testCCompiler.c

Linking C executable cmTC_f77ee.exe

"C:\Program Files\CMake\bin\cmake.exe" -E cmake_link_script CMakeFiles\cmTC_f77ee.dir\link.txt --verbose=1

"C:\Program Files\CMake\bin\cmake.exe" -E rm -f CMakeFiles\cmTC_f77ee.dir/objects.a
CMAKE_AR-NOTFOUND cr CMakeFiles\cmTC_f77ee.dir/objects.a @CMakeFiles\cmTC_f77ee.dir\objects1.rsp
Error running link command: The system cannot find the file specified
mingw32-make[1]: *** [CMakeFiles\cmTC_f77ee.dir\build.make:108: cmTC_f77ee.exe] Error 2

mingw32-make[1]: Leaving directory 'C:/Libraries/Projects/CMakeTest/build/MinGW-10.1.0-64-bit/debug/CMakeFiles/CMakeTmp'

mingw32-make: *** [makefile:140: cmTC_f77ee/fast] Error 2

Используется мой ПУТЬ и полная командная строка:

Путь:

C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Program Files (x86)\QuickTime\QTSystem\;C:\Program Files\MATLAB\R2019b\bin;C:\Program Files\Microsoft VS Code\bin;C:\Program Files\CMake\bin;C:\MinGW\MinGW-10.1.0-64-bit\bin;C:\Users\gvcal\AppData\Local\Microsoft\WindowsApps;

Командная строка:

"C:\Program Files\CMake\bin\cmake.EXE" -Hc:/Libraries/Projects/CMakeTest -Bc:/Libraries/Projects/CMakeTest/build -G "MinGW Makefiles"

1 Ответ

0 голосов
/ 19 июня 2020

Думаю, это может быть ошибка в файлах Makefiles CMake и MinGW. Все еще не совсем уверен, что это такое.

В любом случае, я переключился на систему сборки Ninja (https://ninja-build.org/), и теперь все работает нормально.

...