gpt4 book ai didi

CMake 错误 : execution of make failed on Windows

转载 作者:行者123 更新时间:2023-12-04 11:15:34 25 4
gpt4 key购买 nike

尝试构建时出现错误 nanomsg project在 Windows 7 中:

cmake ..
-- Building for: NMake Makefiles
-- The C compiler identification is GNU 4.7.1
-- Check for working C compiler: C:/Program Files (x86)/CodeBlocks/MinGW/bin/gcc.exe
CMake Error: Generator: execution of make failed. Make command was: "nmake" "/NOLOGO" "cmTC_5d837\fast"
-- Check for working C compiler: C:/Program Files (x86)/CodeBlocks/MinGW/bin/gcc.exe -- broken
CMake Error at C:/Program Files (x86)/cmake-3.9.4-win64-x64/share/cmake-3.9/Modules/CMakeTestCCompiler.cmake:51 (message):
The C compiler "C:/Program Files (x86)/CodeBlocks/MinGW/bin/gcc.exe" is not
able to compile a simple test program.

It fails with the following output:

Change Dir: C:/Users/User/Documents/Internal/nanomsg-master/build/CMakeFiles/CMakeTmp



Run Build Command:"nmake" "/NOLOGO" "cmTC_5d837\fast"



Generator: execution of make failed. Make command was: "nmake" "/NOLOGO"
"cmTC_5d837\fast"





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


-- Configuring incomplete, errors occurred!
See also "C:/Users/User/Documents/Internal/nanomsg-master/build/CMakeFiles/CMakeOutput.log".
See also "C:/Users/User/Documents/Internal/nanomsg-master/build/CMakeFiles/CMakeError.log".

我用 gcc编译器和 make来自 Mingw工具链和我可以成功运行 gcc.exemingw32-make.exe举个简单的例子。

在文件中 CMakeCache.txt缓存变量设置如下:
//C compiler
CMAKE_C_COMPILER:FILEPATH=C:/Program Files (x86)/CodeBlocks/MinGW/bin/gcc.exe

//Program used to build from makefiles.
CMAKE_MAKE_PROGRAM:STRING=nmake

我认为问题来自 CMAKE_MAKE_PROGRAM变量应该取 C:/Program Files (x86)/CodeBlocks/MinGW/bin/mingw32-make.exe ,但是我不明白它从哪里获得值(value) nmake .

即使我手动更换了它,我也遇到了同样的问题。

我的问题:
  • CMake 如何填充缓存变量?
  • 为什么CMAKE_MAKE_PROGRAM取值 nmake ?
  • 为什么手动更改这个变量没有解决问题?
  • 最佳答案

    CMake 根据 CMakeLists.txt 中的内容使用它检测到的值填充缓存文件以及它包含与任何 -D 组合的任何文件提供给 cmake 的参数.
    在 Windows 上 CMake 将默认为 Microsoft 的 nmake工具。覆盖它的方法是传递参数 -G"MinGW Makefiles"cmake ,或者如果您使用 MSYS shell -G"MSYS Makefiles" .
    但是有比 make´ called Ninja (get it from https://ninja-build.org/) which you can use by passing 更快的构建工具-GNinja to cmake`。
    注意:我看到您正在使用 Code::Blocks 附带的旧 MinGW。 MinGW 有一个最新的继承者 MinGW-w64,它支持 Windows 32 位和 64 位。最近的独立版本可以从 https://winlibs.com/ 下载它还包括 ninja.exe .
    P.S.:如果您在遵循这些提示后在构建 nanomsg 源时遇到更多问题,请考虑通过 -DNN_TESTS:BOOL=OFFcmake

    关于CMake 错误 : execution of make failed on Windows,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46807753/

    25 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com