Issue: ldb_toolchain_gen.sh Fails to Compile Due to GLIBC_ABI_DT_RELR Version Mismatch
Description / 描述
When attempting to generate the ldb_toolchain using ldb_toolchain_gen.sh on my system (Arch Linux), the script fails during the final test compilation step. The error indicates an ABI incompatibility between the glibc version provided by the generated toolchain and the libmpc.so.3 library present on the host system. Specifically, /usr/lib/libmpc.so.3 requires the GLIBC_ABI_DT_RELR version from libc.so.6, which is not found in the libc.so.6 included or used by the ldb_toolchain.
在我的系统(Arch Linux)上尝试使用 ldb_toolchain_gen.sh 生成 ldb_toolchain 时,脚本在最后的测试编译步骤失败。错误表明生成的工具链提供的 glibc 版本与宿主系统上存在的 libmpc.so.3 库之间存在 ABI 不兼容性。具体来说,/usr/lib/libmpc.so.3 需要 libc.so.6 中的 GLIBC_ABI_DT_RELR 版本,而 ldb_toolchain 包含或使用的 libc.so.6 中未找到此版本。
Steps to Reproduce / 重现步骤
- Ensure a clean environment by removing any existing
ldb_toolchain directory:
rm -rf ldb_toolchain/
确保环境干净,移除任何现有的 ldb_toolchain 目录:
rm -rf ldb_toolchain/
wget https://github.com/amosbird/ldb_toolchain_gen/releases/download/v0.24/ldb_toolchain_gen.sh -O ldb_toolchain_gen.sh
- Run the
ldb_toolchain_gen.sh script in verbose mode:
bash -x ldb_toolchain_gen.sh "$(pwd)/ldb_toolchain/"
以详细模式运行 ldb_toolchain_gen.sh 脚本:
bash -x ldb_toolchain_gen.sh "$(pwd)/ldb_toolchain/"
Expected Behavior / 预期行为
The ldb_toolchain_gen.sh script should successfully generate the toolchain and be able to compile a simple test program without errors.
ldb_toolchain_gen.sh 脚本应成功生成工具链,并能够无错误地编译一个简单的测试程序。
Actual Behavior / 实际行为
The script fails with the following error during the test compilation phase:
脚本在测试编译阶段出现以下错误:
/root/project/doris/ldb_toolchain/tmp/gentoo/bin/../../../libexec/gcc/x86_64-pc-linux-gnu/14/cc1: /root/project/doris/ldb_toolchain/libexec/gcc/x86_64-pc-linux-gnu/14/../../../../lib/libc.so.6: version `GLIBC_ABI_DT_RELR' not found (required by /usr/lib/libmpc.so.3)
Generated toolchain (gcc) cannot compile a simple program.
This indicates that the cc1 component of the generated GCC attempts to load /usr/lib/libmpc.so.3 from the host system, which requires a newer glibc ABI version (GLIBC_ABI_DT_RELR) than what the ldb_toolchain's libc.so.6 provides.
这表明生成的 GCC 的 cc1 组件试图从宿主系统加载 /usr/lib/libmpc.so.3,而该库需要比 ldb_toolchain 的 libc.so.6 所提供的更新的 glibc ABI 版本(GLIBC_ABI_DT_RELR)。
Environment Information / 环境信息
- Operating System / 操作系统: Arch Linux (rolling release)
- Kernel Version / 内核版本: (Please provide output of
uname -a)
ldb_toolchain_gen.sh SHA256 sum: c7bbaba5e833c6d1b9ddcdb48fd738260f81e8fc49b6e147ad27a7fd93963d77
- Relevant Installed Packages / 相关已安装软件包:
gcc 15.1.1+r7+gf36ec88aa85a-1
gcc-libs 15.1.1+r7+gf36ec88aa85a-1
gmp 6.3.0-2
gmp-ecm 7.0.6-1
libmpc 1.3.1-2
mpfr 4.2.2-1
python-gmpy2 2.2.1-2
Possible Cause / 可能原因
The ldb_toolchain might be built with an older version of glibc that does not support the GLIBC_ABI_DT_RELR symbol, which is required by the libmpc.so.3 package installed on the newer Arch Linux host system. The patchelf operations within the script aim to make the toolchain self-contained, but it seems libmpc.so.3 is still being picked up from the host, leading to the ABI mismatch.
ldb_toolchain 可能使用较旧版本的 glibc 构建,该版本不支持 GLIBC_ABI_DT_RELR 符号,而这个符号是安装在较新 Arch Linux 宿主系统上的 libmpc.so.3 软件包所必需的。脚本中的 patchelf 操作旨在使工具链自包含,但似乎 libmpc.so.3 仍然从宿主系统加载,导致了 ABI 不匹配。
root@host ~/p/doris (master)# bash -x ldb_toolchain_gen.sh "$(pwd)/ldb_toolchain/"
+ set -e
+ verbose=false
+ old_abi=false
+ help_message='Usage: ldb_toolchain_gen.sh [OPTIONS] <toolchain_dir>
Options:
-h, --help Display this help message and exit.
-v, --verbose Enable verbose mode.
-o, --old-abi Use old ABI (Application Binary Interface).'
+ getopts :hvo opt
+ shift 0
+ '[' -z /root/project/doris/ldb_toolchain/ ']'
+ dir=/root/project/doris/ldb_toolchain/
+ [[ ! /root/project/doris/ldb_toolchain/ = \/* ]]
+ [[ -e /root/project/doris/ldb_toolchain/ ]]
++ dirname /root/project/doris/ldb_toolchain/
+ prefix=/root/project/doris
++ mktemp -p /root/project/doris -d -q -t .ldb_toolchain_XXXXXX
+ tmpdir=/root/project/doris/.ldb_toolchain_TSlDGU
+ '[' '!' 0 -eq 0 ']'
+ trap 'rm -rf -- '\''/root/project/doris/.ldb_toolchain_TSlDGU'\''' EXIT
+ sed '0,/^#EOF#$/d' ldb_toolchain_gen.sh
+ tar zx --strip-components=1 -C /root/project/doris/.ldb_toolchain_TSlDGU
+ mv /root/project/doris/.ldb_toolchain_TSlDGU /root/project/doris/ldb_toolchain/
+ chmod a+rx /root/project/doris/ldb_toolchain/
+ cd /root/project/doris/ldb_toolchain/
+ interpreter=
+ '[' x86_64 == x86_64 ']'
+ interpreter=/root/project/doris/ldb_toolchain//lib/ld-linux-x86-64.so.2
+ for f in bin/*
+ bin/patchelf --set-interpreter /root/project/doris/ldb_toolchain//lib/ld-linux-x86-64.so.2 --set-rpath '$ORIGIN/../lib' bin/addr2line
+ for f in bin/*
+ bin/patchelf --set-interpreter /root/project/doris/ldb_toolchain//lib/ld-linux-x86-64.so.2 --set-rpath '$ORIGIN/../lib' bin/ar
+ for f in bin/*
+ bin/patchelf --set-interpreter /root/project/doris/ldb_toolchain//lib/ld-linux-x86-64.so.2 --set-rpath '$ORIGIN/../lib' bin/as
+ for f in bin/*
+ bin/patchelf --set-interpreter /root/project/doris/ldb_toolchain//lib/ld-linux-x86-64.so.2 --set-rpath '$ORIGIN/../lib' bin/bison
+ true
+ for f in bin/*
+ bin/patchelf --set-interpreter /root/project/doris/ldb_toolchain//lib/ld-linux-x86-64.so.2 --set-rpath '$ORIGIN/../lib' bin/bison-3.5.1
+ for f in bin/*
+ bin/patchelf --set-interpreter /root/project/doris/ldb_toolchain//lib/ld-linux-x86-64.so.2 --set-rpath '$ORIGIN/../lib' bin/c++
+ true
+ for f in bin/*
+ bin/patchelf --set-interpreter /root/project/doris/ldb_toolchain//lib/ld-linux-x86-64.so.2 --set-rpath '$ORIGIN/../lib' bin/cc
+ true
+ for f in bin/*
+ bin/patchelf --set-interpreter /root/project/doris/ldb_toolchain//lib/ld-linux-x86-64.so.2 --set-rpath '$ORIGIN/../lib' bin/ccmake
+ for f in bin/*
+ bin/patchelf --set-interpreter /root/project/doris/ldb_toolchain//lib/ld-linux-x86-64.so.2 --set-rpath '$ORIGIN/../lib' bin/clang
+ true
+ for f in bin/*
+ bin/patchelf --set-interpreter /root/project/doris/ldb_toolchain//lib/ld-linux-x86-64.so.2 --set-rpath '$ORIGIN/../lib' bin/clang++
+ true
+ for f in bin/*
+ bin/patchelf --set-interpreter /root/project/doris/ldb_toolchain//lib/ld-linux-x86-64.so.2 --set-rpath '$ORIGIN/../lib' bin/clang-cpp
+ for f in bin/*
+ bin/patchelf --set-interpreter /root/project/doris/ldb_toolchain//lib/ld-linux-x86-64.so.2 --set-rpath '$ORIGIN/../lib' bin/clang-format
+ for f in bin/*
+ bin/patchelf --set-interpreter /root/project/doris/ldb_toolchain//lib/ld-linux-x86-64.so.2 --set-rpath '$ORIGIN/../lib' bin/clang-scan-deps
+ for f in bin/*
+ bin/patchelf --set-interpreter /root/project/doris/ldb_toolchain//lib/ld-linux-x86-64.so.2 --set-rpath '$ORIGIN/../lib' bin/clang-tidy
+ for f in bin/*
+ bin/patchelf --set-interpreter /root/project/doris/ldb_toolchain//lib/ld-linux-x86-64.so.2 --set-rpath '$ORIGIN/../lib' bin/clangd
+ true
+ for f in bin/*
+ bin/patchelf --set-interpreter /root/project/doris/ldb_toolchain//lib/ld-linux-x86-64.so.2 --set-rpath '$ORIGIN/../lib' bin/cmake
+ for f in bin/*
+ bin/patchelf --set-interpreter /root/project/doris/ldb_toolchain//lib/ld-linux-x86-64.so.2 --set-rpath '$ORIGIN/../lib' bin/cmake-gui
+ for f in bin/*
+ bin/patchelf --set-interpreter /root/project/doris/ldb_toolchain//lib/ld-linux-x86-64.so.2 --set-rpath '$ORIGIN/../lib' bin/cpack
+ for f in bin/*
+ bin/patchelf --set-interpreter /root/project/doris/ldb_toolchain//lib/ld-linux-x86-64.so.2 --set-rpath '$ORIGIN/../lib' bin/cpp
+ for f in bin/*
+ bin/patchelf --set-interpreter /root/project/doris/ldb_toolchain//lib/ld-linux-x86-64.so.2 --set-rpath '$ORIGIN/../lib' bin/ctest
+ for f in bin/*
+ bin/patchelf --set-interpreter /root/project/doris/ldb_toolchain//lib/ld-linux-x86-64.so.2 --set-rpath '$ORIGIN/../lib' bin/curl
+ true
+ for f in bin/*
+ bin/patchelf --set-interpreter /root/project/doris/ldb_toolchain//lib/ld-linux-x86-64.so.2 --set-rpath '$ORIGIN/../lib' bin/flamegraph
+ true
+ for f in bin/*
+ bin/patchelf --set-interpreter /root/project/doris/ldb_toolchain//lib/ld-linux-x86-64.so.2 --set-rpath '$ORIGIN/../lib' bin/flex
+ for f in bin/*
+ bin/patchelf --set-interpreter /root/project/doris/ldb_toolchain//lib/ld-linux-x86-64.so.2 --set-rpath '$ORIGIN/../lib' bin/g++
+ true
+ for f in bin/*
+ bin/patchelf --set-interpreter /root/project/doris/ldb_toolchain//lib/ld-linux-x86-64.so.2 --set-rpath '$ORIGIN/../lib' bin/gcc
+ true
+ for f in bin/*
+ bin/patchelf --set-interpreter /root/project/doris/ldb_toolchain//lib/ld-linux-x86-64.so.2 --set-rpath '$ORIGIN/../lib' bin/gcc-ar
+ for f in bin/*
+ bin/patchelf --set-interpreter /root/project/doris/ldb_toolchain//lib/ld-linux-x86-64.so.2 --set-rpath '$ORIGIN/../lib' bin/gcc-nm
+ for f in bin/*
+ bin/patchelf --set-interpreter /root/project/doris/ldb_toolchain//lib/ld-linux-x86-64.so.2 --set-rpath '$ORIGIN/../lib' bin/gcc-ranlib
+ for f in bin/*
+ bin/patchelf --set-interpreter /root/project/doris/ldb_toolchain//lib/ld-linux-x86-64.so.2 --set-rpath '$ORIGIN/../lib' bin/gdb
+ for f in bin/*
+ bin/patchelf --set-interpreter /root/project/doris/ldb_toolchain//lib/ld-linux-x86-64.so.2 --set-rpath '$ORIGIN/../lib' bin/gdb-add-index
+ true
+ for f in bin/*
+ bin/patchelf --set-interpreter /root/project/doris/ldb_toolchain//lib/ld-linux-x86-64.so.2 --set-rpath '$ORIGIN/../lib' bin/ld
+ for f in bin/*
+ bin/patchelf --set-interpreter /root/project/doris/ldb_toolchain//lib/ld-linux-x86-64.so.2 --set-rpath '$ORIGIN/../lib' bin/ld.bfd
+ for f in bin/*
+ bin/patchelf --set-interpreter /root/project/doris/ldb_toolchain//lib/ld-linux-x86-64.so.2 --set-rpath '$ORIGIN/../lib' bin/ld.lld
+ for f in bin/*
+ bin/patchelf --set-interpreter /root/project/doris/ldb_toolchain//lib/ld-linux-x86-64.so.2 --set-rpath '$ORIGIN/../lib' bin/ldb-curl
+ for f in bin/*
+ bin/patchelf --set-interpreter /root/project/doris/ldb_toolchain//lib/ld-linux-x86-64.so.2 --set-rpath '$ORIGIN/../lib' bin/ldb-python
+ for f in bin/*
+ bin/patchelf --set-interpreter /root/project/doris/ldb_toolchain//lib/ld-linux-x86-64.so.2 --set-rpath '$ORIGIN/../lib' bin/ldb_gperf
+ true
+ for f in bin/*
+ bin/patchelf --set-interpreter /root/project/doris/ldb_toolchain//lib/ld-linux-x86-64.so.2 --set-rpath '$ORIGIN/../lib' bin/llc
+ for f in bin/*
+ bin/patchelf --set-interpreter /root/project/doris/ldb_toolchain//lib/ld-linux-x86-64.so.2 --set-rpath '$ORIGIN/../lib' bin/lld
+ for f in bin/*
+ bin/patchelf --set-interpreter /root/project/doris/ldb_toolchain//lib/ld-linux-x86-64.so.2 --set-rpath '$ORIGIN/../lib' bin/lldb
+ for f in bin/*
+ bin/patchelf --set-interpreter /root/project/doris/ldb_toolchain//lib/ld-linux-x86-64.so.2 --set-rpath '$ORIGIN/../lib' bin/lldb-argdumper
+ for f in bin/*
+ bin/patchelf --set-interpreter /root/project/doris/ldb_toolchain//lib/ld-linux-x86-64.so.2 --set-rpath '$ORIGIN/../lib' bin/lldb-dap
+ for f in bin/*
+ bin/patchelf --set-interpreter /root/project/doris/ldb_toolchain//lib/ld-linux-x86-64.so.2 --set-rpath '$ORIGIN/../lib' bin/lldb-instr
+ for f in bin/*
+ bin/patchelf --set-interpreter /root/project/doris/ldb_toolchain//lib/ld-linux-x86-64.so.2 --set-rpath '$ORIGIN/../lib' bin/lldb-server
+ for f in bin/*
+ bin/patchelf --set-interpreter /root/project/doris/ldb_toolchain//lib/ld-linux-x86-64.so.2 --set-rpath '$ORIGIN/../lib' bin/llvm-addr2line
+ for f in bin/*
+ bin/patchelf --set-interpreter /root/project/doris/ldb_toolchain//lib/ld-linux-x86-64.so.2 --set-rpath '$ORIGIN/../lib' bin/llvm-ar
+ for f in bin/*
+ bin/patchelf --set-interpreter /root/project/doris/ldb_toolchain//lib/ld-linux-x86-64.so.2 --set-rpath '$ORIGIN/../lib' bin/llvm-cov
+ for f in bin/*
+ bin/patchelf --set-interpreter /root/project/doris/ldb_toolchain//lib/ld-linux-x86-64.so.2 --set-rpath '$ORIGIN/../lib' bin/llvm-install-name-tool
+ for f in bin/*
+ bin/patchelf --set-interpreter /root/project/doris/ldb_toolchain//lib/ld-linux-x86-64.so.2 --set-rpath '$ORIGIN/../lib' bin/llvm-link
+ for f in bin/*
+ bin/patchelf --set-interpreter /root/project/doris/ldb_toolchain//lib/ld-linux-x86-64.so.2 --set-rpath '$ORIGIN/../lib' bin/llvm-nm
+ for f in bin/*
+ bin/patchelf --set-interpreter /root/project/doris/ldb_toolchain//lib/ld-linux-x86-64.so.2 --set-rpath '$ORIGIN/../lib' bin/llvm-objcopy
+ for f in bin/*
+ bin/patchelf --set-interpreter /root/project/doris/ldb_toolchain//lib/ld-linux-x86-64.so.2 --set-rpath '$ORIGIN/../lib' bin/llvm-profdata
+ for f in bin/*
+ bin/patchelf --set-interpreter /root/project/doris/ldb_toolchain//lib/ld-linux-x86-64.so.2 --set-rpath '$ORIGIN/../lib' bin/llvm-profgen
+ for f in bin/*
+ bin/patchelf --set-interpreter /root/project/doris/ldb_toolchain//lib/ld-linux-x86-64.so.2 --set-rpath '$ORIGIN/../lib' bin/llvm-ranlib
+ for f in bin/*
+ bin/patchelf --set-interpreter /root/project/doris/ldb_toolchain//lib/ld-linux-x86-64.so.2 --set-rpath '$ORIGIN/../lib' bin/llvm-strip
+ for f in bin/*
+ bin/patchelf --set-interpreter /root/project/doris/ldb_toolchain//lib/ld-linux-x86-64.so.2 --set-rpath '$ORIGIN/../lib' bin/llvm-symbolizer
+ for f in bin/*
+ bin/patchelf --set-interpreter /root/project/doris/ldb_toolchain//lib/ld-linux-x86-64.so.2 --set-rpath '$ORIGIN/../lib' bin/m4
+ for f in bin/*
+ bin/patchelf --set-interpreter /root/project/doris/ldb_toolchain//lib/ld-linux-x86-64.so.2 --set-rpath '$ORIGIN/../lib' bin/nasm
+ for f in bin/*
+ bin/patchelf --set-interpreter /root/project/doris/ldb_toolchain//lib/ld-linux-x86-64.so.2 --set-rpath '$ORIGIN/../lib' bin/ninja
+ for f in bin/*
+ bin/patchelf --set-interpreter /root/project/doris/ldb_toolchain//lib/ld-linux-x86-64.so.2 --set-rpath '$ORIGIN/../lib' bin/nm
+ for f in bin/*
+ bin/patchelf --set-interpreter /root/project/doris/ldb_toolchain//lib/ld-linux-x86-64.so.2 --set-rpath '$ORIGIN/../lib' bin/objcopy
+ for f in bin/*
+ bin/patchelf --set-interpreter /root/project/doris/ldb_toolchain//lib/ld-linux-x86-64.so.2 --set-rpath '$ORIGIN/../lib' bin/objdump
+ true
+ for f in bin/*
+ bin/patchelf --set-interpreter /root/project/doris/ldb_toolchain//lib/ld-linux-x86-64.so.2 --set-rpath '$ORIGIN/../lib' bin/opt
+ for f in bin/*
+ bin/patchelf --set-interpreter /root/project/doris/ldb_toolchain//lib/ld-linux-x86-64.so.2 --set-rpath '$ORIGIN/../lib' bin/patchelf
+ true
+ for f in bin/*
+ bin/patchelf --set-interpreter /root/project/doris/ldb_toolchain//lib/ld-linux-x86-64.so.2 --set-rpath '$ORIGIN/../lib' bin/pkg-config
+ for f in bin/*
+ bin/patchelf --set-interpreter /root/project/doris/ldb_toolchain//lib/ld-linux-x86-64.so.2 --set-rpath '$ORIGIN/../lib' bin/pprof
+ true
+ for f in bin/*
+ bin/patchelf --set-interpreter /root/project/doris/ldb_toolchain//lib/ld-linux-x86-64.so.2 --set-rpath '$ORIGIN/../lib' bin/ranlib
+ for f in bin/*
+ bin/patchelf --set-interpreter /root/project/doris/ldb_toolchain//lib/ld-linux-x86-64.so.2 --set-rpath '$ORIGIN/../lib' bin/tfg
+ true
+ for f in bin/*
+ bin/patchelf --set-interpreter /root/project/doris/ldb_toolchain//lib/ld-linux-x86-64.so.2 --set-rpath '$ORIGIN/../lib' bin/tfg.py
+ true
+ for f in bin/*
+ bin/patchelf --set-interpreter /root/project/doris/ldb_toolchain//lib/ld-linux-x86-64.so.2 --set-rpath '$ORIGIN/../lib' bin/x86_64-pc-linux-gnu-cpp
+ for f in bin/*
+ bin/patchelf --set-interpreter /root/project/doris/ldb_toolchain//lib/ld-linux-x86-64.so.2 --set-rpath '$ORIGIN/../lib' bin/x86_64-pc-linux-gnu-ld
+ for f in bin/*
+ bin/patchelf --set-interpreter /root/project/doris/ldb_toolchain//lib/ld-linux-x86-64.so.2 --set-rpath '$ORIGIN/../lib' bin/yacc
+ true
+ for f in bin/*
+ bin/patchelf --set-interpreter /root/project/doris/ldb_toolchain//lib/ld-linux-x86-64.so.2 --set-rpath '$ORIGIN/../lib' bin/yasm
+ for f in tmp/gentoo/bin/*
+ bin/patchelf --set-interpreter /root/project/doris/ldb_toolchain//lib/ld-linux-x86-64.so.2 --set-rpath '$ORIGIN/../../../lib' tmp/gentoo/bin/g++
+ for f in tmp/gentoo/bin/*
+ bin/patchelf --set-interpreter /root/project/doris/ldb_toolchain//lib/ld-linux-x86-64.so.2 --set-rpath '$ORIGIN/../../../lib' tmp/gentoo/bin/gcc
+ for f in tmp/gentoo/llvm/bin/*
+ bin/patchelf --set-interpreter /root/project/doris/ldb_toolchain//lib/ld-linux-x86-64.so.2 --set-rpath '$ORIGIN/../../../../lib' tmp/gentoo/llvm/bin/clang
+ for f in tmp/gentoo/llvm/bin/*
+ bin/patchelf --set-interpreter /root/project/doris/ldb_toolchain//lib/ld-linux-x86-64.so.2 --set-rpath '$ORIGIN/../../../../lib' tmp/gentoo/llvm/bin/clang
++
+ for f in tmp/gentoo/llvm/bin/*
+ bin/patchelf --set-interpreter /root/project/doris/ldb_toolchain//lib/ld-linux-x86-64.so.2 --set-rpath '$ORIGIN/../../../../lib' tmp/gentoo/llvm/bin/clang
d
+ for f in cc1 cc1plus collect2 g++-mapper-server lto1 lto-wrapper
+ bin/patchelf --set-interpreter /root/project/doris/ldb_toolchain//lib/ld-linux-x86-64.so.2 --set-rpath '$ORIGIN/../../../../lib' libexec/gcc/x86_64-pc-lin
ux-gnu/14/cc1
+ for f in cc1 cc1plus collect2 g++-mapper-server lto1 lto-wrapper
+ bin/patchelf --set-interpreter /root/project/doris/ldb_toolchain//lib/ld-linux-x86-64.so.2 --set-rpath '$ORIGIN/../../../../lib' libexec/gcc/x86_64-pc-lin
ux-gnu/14/cc1plus
+ for f in cc1 cc1plus collect2 g++-mapper-server lto1 lto-wrapper
+ bin/patchelf --set-interpreter /root/project/doris/ldb_toolchain//lib/ld-linux-x86-64.so.2 --set-rpath '$ORIGIN/../../../../lib' libexec/gcc/x86_64-pc-lin
ux-gnu/14/collect2
+ for f in cc1 cc1plus collect2 g++-mapper-server lto1 lto-wrapper
+ bin/patchelf --set-interpreter /root/project/doris/ldb_toolchain//lib/ld-linux-x86-64.so.2 --set-rpath '$ORIGIN/../../../../lib' libexec/gcc/x86_64-pc-lin
ux-gnu/14/g++-mapper-server
+ for f in cc1 cc1plus collect2 g++-mapper-server lto1 lto-wrapper
+ bin/patchelf --set-interpreter /root/project/doris/ldb_toolchain//lib/ld-linux-x86-64.so.2 --set-rpath '$ORIGIN/../../../../lib' libexec/gcc/x86_64-pc-lin
ux-gnu/14/lto1
+ for f in cc1 cc1plus collect2 g++-mapper-server lto1 lto-wrapper
+ bin/patchelf --set-interpreter /root/project/doris/ldb_toolchain//lib/ld-linux-x86-64.so.2 --set-rpath '$ORIGIN/../../../../lib' libexec/gcc/x86_64-pc-lin
ux-gnu/14/lto-wrapper
+ bin/patchelf --set-rpath '$ORIGIN/../../../../lib' libexec/gcc/x86_64-pc-linux-gnu/14/liblto_plugin.so
+ for c in clang clang++ gcc g++
+ false
+ sed -i 's/<OLD_ABI>//' bin/clang
+ for c in clang clang++ gcc g++
+ false
+ sed -i 's/<OLD_ABI>//' bin/clang++
+ for c in clang clang++ gcc g++
+ false
+ sed -i 's/<OLD_ABI>//' bin/gcc
+ for c in clang clang++ gcc g++
+ false
+ sed -i 's/<OLD_ABI>//' bin/g++
+ bin/gcc test/a.c -o test/a
/root/project/doris/ldb_toolchain/tmp/gentoo/bin/../../../libexec/gcc/x86_64-pc-linux-gnu/14/cc1: /root/project/doris/ldb_toolchain/libexec/gcc/x86_64-pc-li
nux-gnu/14/../../../../lib/libc.so.6: version `GLIBC_ABI_DT_RELR' not found (required by /usr/lib/libmpc.so.3)
+ echo 'Generated toolchain (gcc) cannot compile a simple program.'
Generated toolchain (gcc) cannot compile a simple program.
+ echo 'Please file an issue at https://github.com/amosbird/ldb_toolchain_gen/issues with current setup information.'
Please file an issue at https://github.com/amosbird/ldb_toolchain_gen/issues with current setup information.
+ exit 1
+ rm -rf -- /root/project/doris/.ldb_toolchain_TSlDGU
root@host ~/p/doris (master) [1]# sha256sum ldb_toolchain_gen.sh
c7bbaba5e833c6d1b9ddcdb48fd738260f81e8fc49b6e147ad27a7fd93963d77 ldb_toolchain_gen.sh
Issue:
ldb_toolchain_gen.shFails to Compile Due to GLIBC_ABI_DT_RELR Version MismatchDescription / 描述
When attempting to generate the
ldb_toolchainusingldb_toolchain_gen.shon my system (Arch Linux), the script fails during the final test compilation step. The error indicates an ABI incompatibility between theglibcversion provided by the generated toolchain and thelibmpc.so.3library present on the host system. Specifically,/usr/lib/libmpc.so.3requires theGLIBC_ABI_DT_RELRversion fromlibc.so.6, which is not found in thelibc.so.6included or used by theldb_toolchain.在我的系统(Arch Linux)上尝试使用
ldb_toolchain_gen.sh生成ldb_toolchain时,脚本在最后的测试编译步骤失败。错误表明生成的工具链提供的glibc版本与宿主系统上存在的libmpc.so.3库之间存在 ABI 不兼容性。具体来说,/usr/lib/libmpc.so.3需要libc.so.6中的GLIBC_ABI_DT_RELR版本,而ldb_toolchain包含或使用的libc.so.6中未找到此版本。Steps to Reproduce / 重现步骤
ldb_toolchaindirectory:rm -rf ldb_toolchain/确保环境干净,移除任何现有的
ldb_toolchain目录:rm -rf ldb_toolchain/ldb_toolchain_gen.shscript in verbose mode:bash -x ldb_toolchain_gen.sh "$(pwd)/ldb_toolchain/"以详细模式运行
ldb_toolchain_gen.sh脚本:bash -x ldb_toolchain_gen.sh "$(pwd)/ldb_toolchain/"Expected Behavior / 预期行为
The
ldb_toolchain_gen.shscript should successfully generate the toolchain and be able to compile a simple test program without errors.ldb_toolchain_gen.sh脚本应成功生成工具链,并能够无错误地编译一个简单的测试程序。Actual Behavior / 实际行为
The script fails with the following error during the test compilation phase:
脚本在测试编译阶段出现以下错误:
This indicates that the
cc1component of the generated GCC attempts to load/usr/lib/libmpc.so.3from the host system, which requires a newerglibcABI version (GLIBC_ABI_DT_RELR) than what theldb_toolchain'slibc.so.6provides.这表明生成的 GCC 的
cc1组件试图从宿主系统加载/usr/lib/libmpc.so.3,而该库需要比ldb_toolchain的libc.so.6所提供的更新的glibcABI 版本(GLIBC_ABI_DT_RELR)。Environment Information / 环境信息
uname -a)ldb_toolchain_gen.shSHA256 sum:c7bbaba5e833c6d1b9ddcdb48fd738260f81e8fc49b6e147ad27a7fd93963d77gcc 15.1.1+r7+gf36ec88aa85a-1gcc-libs 15.1.1+r7+gf36ec88aa85a-1gmp 6.3.0-2gmp-ecm 7.0.6-1libmpc 1.3.1-2mpfr 4.2.2-1python-gmpy2 2.2.1-2Possible Cause / 可能原因
The
ldb_toolchainmight be built with an older version ofglibcthat does not support theGLIBC_ABI_DT_RELRsymbol, which is required by thelibmpc.so.3package installed on the newer Arch Linux host system. Thepatchelfoperations within the script aim to make the toolchain self-contained, but it seemslibmpc.so.3is still being picked up from the host, leading to the ABI mismatch.ldb_toolchain可能使用较旧版本的glibc构建,该版本不支持GLIBC_ABI_DT_RELR符号,而这个符号是安装在较新 Arch Linux 宿主系统上的libmpc.so.3软件包所必需的。脚本中的patchelf操作旨在使工具链自包含,但似乎libmpc.so.3仍然从宿主系统加载,导致了 ABI 不匹配。