使用CMake执行Assimp编译错误:GCC无法编译测试程序



我正在尝试使用CMake为Windows 10编译Assimp 5.0.1。我在MinGW中使用的C/C++编译器是GCC和G++。若我正确地理解了这个问题,那个么MakeFile的空白就有问题了。/CMakeTmp/目录是空的,我相信答案就在我面前:

控制台输出:

-- The C compiler identification is GNU 9.2.0
-- The CXX compiler identification is GNU 9.2.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - failed
-- 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 (x86)/CMake/share/cmake-3.20/Modules/CMakeTestCCompiler.cmake:66 (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: Q:/programming/westy/src/lib/assimp-5.0.1/build/CMakeFiles/CMakeTmp
Run Build Command(s):make -f Makefile /nologo cmTC_a4ec5fast && Makefile:37: *** missing separator.  Stop.

CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
CMakeLists.txt:54 (PROJECT)

-- Configuring incomplete, errors occurred!
See also "Q:/programming/westy/src/lib/assimp-5.0.1/build/CMakeFiles/CMakeOutput.log".
See also "Q:/programming/westy/src/lib/assimp-5.0.1/build/CMakeFiles/CMakeError.log".

CMakeError.log:

Detecting C compiler ABI info failed to compile with the following output:
Change Dir: Q:/programming/westy/src/lib/assimp-5.0.1/build/CMakeFiles/CMakeTmp
Run Build Command(s):make -f Makefile /nologo cmTC_165dcfast && Makefile:37: *** missing separator.  Stop.

CMakeOutput.log:

Compiling the C compiler identification source file "CMakeCCompilerId.c" succeeded.
Compiler: C:/MinGW/bin/gcc.exe 
Build flags: 
Id flags:  
The output was:
0

Compilation of the C compiler identification source "CMakeCCompilerId.c" produced "a.exe"
The C compiler identification is GNU, found in "Q:/programming/westy/src/lib/assimp-5.0.1/build/CMakeFiles/3.20.2/CompilerIdC/a.exe"
Compiling the CXX compiler identification source file "CMakeCXXCompilerId.cpp" succeeded.
Compiler: C:/MinGW/bin/g++.exe 
Build flags: 
Id flags:  
The output was:
0

Compilation of the CXX compiler identification source "CMakeCXXCompilerId.cpp" produced "a.exe"
The CXX compiler identification is GNU, found in "Q:/programming/westy/src/lib/assimp-5.0.1/build/CMakeFiles/3.20.2/CompilerIdCXX/a.exe"

cmake使用了哪个-G选项?make/nologo参数似乎不对,看起来像是Microsoft/MSVC参数。如果未指定-G,则CMake在Windows上默认为-G"NMake Makefiles"

如果使用MSYS的make,请确保对mingw32-make-G"MSYS Makefiles"使用cmake标志-G"MinGW Makefiles"

但是,为了避免所有这些问题并提高速度,-GNinja是最好的解决方案,前提是您有可用的忍者(请参阅https://ninja-build.org/)。

最后,您仍然使用MinGW GCC 9.2.0。有更新的版本,请参阅http://winlibs.com/对于也带有更新的CCD_ 13的独立构建。

相关内容

  • 没有找到相关文章

最新更新