【发布时间】:2015-04-15 17:00:54
【问题描述】:
我最近从默认的 binutils 链接器 ld.bfd 切换到 ld.gold(以使链接时间优化工作,为什么不呢?)。它是手动制作的(比如这里:http://wiki.gentoo.org/wiki/Gold)。结果我得到了从 /usr/bin/ld 到 ld.gold 二进制文件的符号链接链,因此链接器在构建过程中被透明地更改了。
但是当我尝试重建所有包时,我发现 ld.gold 有时会导致配置/编译失败,例如“C 编译器无法创建可执行文件”:
checking for x86_64-pc-linux-gnu-gcc... x86_64-pc-linux-gnu-gcc
checking whether the C compiler works... no
configure: error: in `/var/tmp/portage/sys-libs/db-6.0.30-r1/work/db-6.0.30/build_unix-abi_x86_64.amd64':
configure: error: C compiler cannot create executables
实际上是链接器问题:
configure: checking whether the C compiler works
/usr/lib/gcc/x86_64-pc-linux-gnu/4.8.4/../../../../x86_64-pc-linux-gnu/bin/ld: --default-symver: unknown option
/usr/lib/gcc/x86_64-pc-linux-gnu/4.8.4/../../../../x86_64-pc-linux-gnu/bin/ld: use the --help option for usage information
collect2: error: ld returned 1 exit status
但是使用默认的 bfd 链接器可以成功构建包,所以问题是如何回到 bfd 链接器来处理无法使用 ld.gold 构建的包?
问题包是 =sys-libs/db-6.0.30-r1(现在引起我注意的那个)。
【问题讨论】:
标签: c linker ld gentoo gold-linker