【问题标题】:After CMake update from 3.7.2 to 3.21.0, the try compile a simple test program is brokenCMake 从 3.7.2 更新到 3.21.0 后,try compile a simple test program 坏了
【发布时间】:2021-07-22 06:40:58
【问题描述】:

我有一个可工作的 cmake (3.7.2),带有用于基于 gnu 的交叉编译器的工具链文件。 将cmake更新到3.21.0后无法编译简单的测试程序。

输出:

-- The C compiler identification is GNU 4.6.4
-- The CXX compiler identification is GNU 4.6.4
-- Detecting C compiler ABI info
CMake Error: Generator: execution of make failed. Make command was:  -f Makefile cmTC_79efc/fast &&
-- Detecting C compiler ABI info - failed
-- Check for working C compiler: <compiler-root-path>/v4.6.6.1/bin/tricore-gcc.exe
CMake Error: Generator: execution of make failed. Make command was:  -f Makefile cmTC_30bd9/fast &&
-- Check for working C compiler: <compiler-root-path>/v4.6.6.1/bin/tricore-gcc.exe - broken
CMake Error at <cmake-root-path>/cmake-3.21.0-windows-x86_64/share/cmake-3.21/Modules/CMakeTestCCompiler.cmake:66 (message):
  The C compiler

    '<compiler-root-path>/tricore/v4.6.6.1/bin/tricore-gcc.exe'

  is not able to compile a simple test program.

  It fails with the following output:

    Change Dir: <source-root-path>/build/CMakeFiles/CMakeTmp

    Run Build Command(s): -f Makefile cmTC_30bd9/fast && Falscher Parameter
    Generator: execution of make failed. Make command was:  -f Makefile cmTC_30bd9/fast &&




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


-- Configuring incomplete, errors occurred!
See also '<source-root-path>/build/CMakeFiles/CMakeOutput.log'.
See also '<source-root-path>/build/CMakeFiles/CMakeError.log'.
make: *** No rule to make target `all'.  Stop.

我已经为这个问题搜索了很长时间,但我没有找到解决方案。
我找到了一些几乎相同的解决方案,它们描述了如果 try_compile 不起作用该怎么办。
但是我有一个适用于 V3.7.2 的工作工具链文件(等等),但同样不适用于 V3.21.0。
我也没有发现在更新时必须在工具链文件中更改某些内容。

感谢所有有用的答案。

【问题讨论】:

  • See also '&lt;source-root-path&gt;/build/CMakeFiles/CMakeOutput.log'. See also '&lt;source-root-path&gt;/build/CMakeFiles/CMakeError.log'. 请看。用什么命令行来测试编译?
  • Message Generator: execution of make failed. 表明 CMake 生成器有问题(在您的情况下为 Unix Makefiles)。顺便说一句,Make command was: -f Makefile cmTC_30bd9/fast-f 选项之前显然错过了make。还要确保在更新 CMake 后,对项目执行 clean 配置(构建目录为空)。

标签: cmake cross-compiling updates


【解决方案1】:

我发现了问题,在我的工具链文件中有一行
SET(CMAKE_MAKE_PROGRAM "${COMPILER_ROOT_DIR}/bin/make.exe")
它必须是
SET(CMAKE_MAKE_PROGRAM "${COMPILER_ROOT_DIR}/bin/make.exe" CACHE INTERNAL "")
无论出于何种原因,第一个将在 V3.7.2 中运行,而不是在 V3.21.0 中运行。
第二个适用于两者

【讨论】:

    猜你喜欢
    • 2021-09-21
    • 2015-12-19
    • 2015-03-01
    • 2018-06-12
    • 2021-01-14
    • 2019-09-18
    • 2018-12-19
    • 1970-01-01
    • 2020-05-04
    相关资源
    最近更新 更多