当前位置: 首页 > 工具软件 > SimpleTest > 使用案例 >

mac The C compiler is not able to compile a simple test program.

周超英
2023-12-01

通过报错查看CMakeTestCCompiler.cmake,

if(NOT CMAKE_C_COMPILER_WORKS)
  PrintTestCompilerStatus("C" " -- broken")
  file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
    "Determining if the C compiler works failed with "
    "the following output:\n${__CMAKE_C_COMPILER_OUTPUT}\n\n")
  string(REPLACE "\n" "\n  " _output "${__CMAKE_C_COMPILER_OUTPUT}")
  message(FATAL_ERROR "The C compiler\n  \"${CMAKE_C_COMPILER}\"\n"
    "is not able to compile a simple test program.\nIt fails "
    "with the following output:\n  ${_output}\n\n"
    "CMake will not be able to correctly generate this project.")
else()

if(NOT CMAKE_C_COMPILER_WORKS)

我们可以知道,是因为编译器不能正常工作。从CMakeTestCCompiler这个名字可以发现,应该是cmake正在测试编译器到底能不能正常工作。

遇到这个错误时去查看一下后续的报错信息,我这里是
dyld: Library not loaded: /usr/local/opt/isl/lib/libisl.22.dylib
Referenced from: /usr/local/Cellar/gcc/10.2.0/libexec/gcc/x86_64-apple-darwin19/10.2.0/cc1
Reason: image not found
那么就去到/usr/local/opt/isl/lib/,把libisl.xx.dylib改成22,就可以成功编译了。

 类似资料:

相关阅读

相关文章

相关问答