0

gcc (GCC) 10.2.0 cmake 版本 3.19.4

CMakeFile.txt

    ...
    test_big_endian(WORDS_BIGENDIAN)
    ...

cmake 输出:

-- 检查系统是否为大端 -- 搜索 16 位整数 -- 寻找 sys/types.h -- 寻找 sys/types.h - 未找到 -- 寻找 stdint.h -- 寻找 stdint.h - 未找到 - 正在寻找 stddef.h - 正在寻找 stddef.h - 未找到 - 检查 unsigned short 的大小 - 检查 unsigned short 的大小 - 失败 - 检查 unsigned int 的大小 - 检查 unsigned int 的大小- 失败 - 检查 unsigned long 的大小 - 检查 unsigned long 的大小 - /usr/local/cmake/share/cmake-3.19/Modules/TestBigEndian.cmake:51(消息)失败的 CMake 错误:找不到合适的类型调用堆栈(最近调用优先):contrib/xz/cmake/tuklib_integer.cmake:23 (test_big_endian)
contrib/xz/CMakeLists.txt:126 (tuklib_integer)

CMakeError.log 输出:

确定包含文件 sys/types.h 是否存在失败,输出如下: Change Dir: /data/clickhouse/clickhouse/ClickHouse/build/CMakeFiles/CMakeTmp

运行构建命令:/usr/local/bin/ninja cmTC_73c6f && [1/2] 构建 C 对象 CMakeFiles/cmTC_73c6f.dir/CheckIncludeFile.co [2/2] 链接 C 可执行文件 cmTC_73c6f FAILED: cmTC_73c6f : && /usr /local/bin/gcc -fdiagnostics-color=always -pipe -msse4.1 -msse4.2 -mpopcnt -Wall -Werror -w -fuse-ld=gold -rdynamic -Wl,--no-undefined -Wl,- no-pie -rdynamic CMakeFiles/cmTC_73c6f.dir/CheckIncludeFile.co -o cmTC_73c6f && : /usr/bin/ld.gold: 错误: 找不到 -lgcc_s /usr/bin/ld.gold: 错误: 找不到 -lgcc_s / lib/../lib64/libc.a(syslog.o):function __vsyslog_chk: error: undefined reference to '_Unwind_Resume' /lib/../lib64/libc.a(syslog.o):function __vsyslog_chk: error: undefined引用'_Unwind_Resume' /lib/../lib64/libc.a(syslog.o):function openlog: error: undefined reference to '_Unwind_Resume'/lib/../lib64/libc.a(syslog.o):function closelog: error: undefined reference to '_Unwind_Resume' /lib/../lib64/libc.a(syslog.o)(.eh_frame+0xd78b) : 错误: 未定义引用 '__gcc_personality_v0' /lib/../lib64/libc.a(backtrace.o):function backtrace_helper: 错误: 未定义引用 '_Unwind_GetIP' /lib/../lib64/libc.a(backtrace .o):function backtrace_helper: error: undefined reference to '_Unwind_GetCFA' /lib/../lib64/libc.a(backtrace.o):function __backtrace: error: undefined reference to '_Unwind_Backtrace' collect2: error: ld returned 1退出状态忍者:构建停止:子命令失败。__gcc_personality_v0' /lib/../lib64/libc.a(backtrace.o):function backtrace_helper: error: undefined reference to '_Unwind_GetIP' /lib/../lib64/libc.a(backtrace.o):function backtrace_helper:错误:未定义对“_Unwind_GetCFA”的引用 /lib/../lib64/libc.a(backtrace.o):function __backtrace:错误:未定义对“_Unwind_Backtrace”collect2 的引用:错误:ld 返回 1 退出状态忍者:构建已停止:子命令失败。__gcc_personality_v0' /lib/../lib64/libc.a(backtrace.o):function backtrace_helper: error: undefined reference to '_Unwind_GetIP' /lib/../lib64/libc.a(backtrace.o):function backtrace_helper:错误:未定义对“_Unwind_GetCFA”的引用 /lib/../lib64/libc.a(backtrace.o):function __backtrace:错误:未定义对“_Unwind_Backtrace”collect2 的引用:错误:ld 返回 1 退出状态忍者:构建已停止:子命令失败。构建停止:子命令失败。构建停止:子命令失败。

我找到了错误发生的地方。cmake-3.19/Modules/CheckIncludeFile.cmake:

  if(${VARIABLE})
      if(NOT CMAKE_REQUIRED_QUIET)
        message(CHECK_PASS "found")
      endif()
      set(${VARIABLE} 1 CACHE INTERNAL "Have include ${INCLUDE}")
      file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
        "Determining if the include file ${INCLUDE} "
        "exists passed with the following output:\n"
        "${OUTPUT}\n\n")
    else()
      if(NOT CMAKE_REQUIRED_QUIET)
        message(CHECK_FAIL "not found")
      endif()
      set(${VARIABLE} "" CACHE INTERNAL "Have include ${INCLUDE}")
      file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
        "Determining if the include file ${INCLUDE} "
        "exists failed with the following output:\n"
        "${OUTPUT}\n\n")
    endif()

错误是什么意思?如何解决?

- - 新的 - -

/usr/bin/ld.gold: error: cannot find -lgcc_s由 gcc 标志引起-Wl,-no-pie。为什么gcc_s找不到?

4

2 回答 2

1

顺便说一句,在 cmake 3.20 中,他们引入了 CMAKE_LANG_BYTE_ORDER。

这比使用 TestBigEndian 更快:https ://cmake.org/cmake/help/latest/variable/CMAKE_LANG_BYTE_ORDER.html#variable:CMAKE_%3CLANG%3E_BYTE_ORDER

于 2021-03-09T02:07:56.007 回答
0

原因是版本ld太低(2.23)。更新到版本(2.27),它工作正常。

于 2021-03-09T02:02:37.200 回答