gcc从源构建失败,重定位错误

问题描述

我试图以非root用户身份从源代码安装gcc(8.4.0和10.1.0)。对于这两个版本,制作都会在大约6小时后失败。我使用$ HOME / .local作为我的安装位置

我将config配置为

export LDFLAGS="-L$HOME/.local/lib"
export CPPFLAGS="-I$HOME/.local/include"

../gcc-8.4.0/configure --enable-shared=libffi,zlib --prefix=$HOME/.local --disable-multilib

configure写一个Makefile,然后我运行

make

大约6个小时后,我在错误流中得到了这个信息:

/usr/bin/ld: /scratch/gcc8bld/x86_64-pc-linux-gnu/libstdc++-v3/src/.libs/libstdc++.a(new_op.o): relocation R_X86_64_32 against symbol `_ZNSt9bad_allocD1Ev' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /scratch/gcc8bld/x86_64-pc-linux-gnu/libstdc++-v3/src/.libs/libstdc++.a(si_class_type_info.o): relocation R_X86_64_32S against symbol `_ZTVN10__cxxabiv120__si_class_type_infoE' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /scratch/gcc8bld/x86_64-pc-linux-gnu/libstdc++-v3/src/.libs/libstdc++.a(eh_alloc.o): relocation R_X86_64_32 against `.rodata._ZNK9__gnu_cxx24__concurrence_lock_error4whatEv.str1.8' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /scratch/gcc8bld/x86_64-pc-linux-gnu/libstdc++-v3/src/.libs/libstdc++.a(bad_alloc.o): relocation R_X86_64_32 against `.rodata._ZNKSt9bad_alloc4whatEv.str1.1' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /scratch/gcc8bld/x86_64-pc-linux-gnu/libstdc++-v3/src/.libs/libstdc++.a(eh_terminate.o): relocation R_X86_64_32 against symbol `__gxx_personality_v0' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /scratch/gcc8bld/x86_64-pc-linux-gnu/libstdc++-v3/src/.libs/libstdc++.a(eh_throw.o): relocation R_X86_64_32S against `.text._ZL23__gxx_exception_cleanup19_Unwind_Reason_CodeP17_Unwind_Exception' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /scratch/gcc8bld/x86_64-pc-linux-gnu/libstdc++-v3/src/.libs/libstdc++.a(class_type_info.o): relocation R_X86_64_32S against symbol `_ZTVN10__cxxabiv117__class_type_infoE' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /scratch/gcc8bld/x86_64-pc-linux-gnu/libstdc++-v3/src/.libs/libstdc++.a(eh_aux_runtime.o): relocation R_X86_64_32 against symbol `_ZNSt8bad_castD1Ev' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /scratch/gcc8bld/x86_64-pc-linux-gnu/libstdc++-v3/src/.libs/libstdc++.a(bad_array_new.o): relocation R_X86_64_32 against `.rodata._ZNKSt20bad_array_new_length4whatEv.str1.1' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /scratch/gcc8bld/x86_64-pc-linux-gnu/libstdc++-v3/src/.libs/libstdc++.a(bad_typeid.o): relocation R_X86_64_32 against `.rodata._ZNKSt10bad_typeid4whatEv.str1.1' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /scratch/gcc8bld/x86_64-pc-linux-gnu/libstdc++-v3/src/.libs/libstdc++.a(bad_cast.o): relocation R_X86_64_32 against `.rodata._ZNKSt8bad_cast4whatEv.str1.1' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /scratch/gcc8bld/x86_64-pc-linux-gnu/libstdc++-v3/src/.libs/libstdc++.a(new_opnt.o): relocation R_X86_64_32 against symbol `_ZTISt9bad_alloc' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /scratch/gcc8bld/x86_64-pc-linux-gnu/libstdc++-v3/src/.libs/libstdc++.a(eh_personality.o): relocation R_X86_64_32S against `.rodata._ZL28read_encoded_value_with_basehmPKhPm' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /scratch/gcc8bld/x86_64-pc-linux-gnu/libstdc++-v3/src/.libs/libstdc++.a(eh_globals.o): relocation R_X86_64_TPOFF32 against `_ZZN12_GLOBAL__N_110get_globalEvE6global' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /scratch/gcc8bld/x86_64-pc-linux-gnu/libstdc++-v3/src/.libs/libstdc++.a(locale.o): relocation R_X86_64_32 against symbol `_ZNSt6locale5facet9_S_c_nameE' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /scratch/gcc8bld/x86_64-pc-linux-gnu/libstdc++-v3/src/.libs/libstdc++.a(locale_init.o): relocation R_X86_64_32 against `.bss._ZZN12_GLOBAL__N_116get_locale_mutexEvE12locale_mutex' can not be used when making a shared object; recompile with -fPIC

标准输出的最后一行是

libtool: link:  /scratch/ggcc8bld/./gcc/xg++ -B/scratch/ggcc8bld/./gcc/ -nostdinc++ -nostdinc++ -I/scratch/gcc8bld/x86_64-pc-linux-gnu/libstdc++-v3/include/x86_64-pc-linux-gnu -I/scratch/gcc8bld/x86_64-pc-linux-gnu/libstdc++-v3/include -I/scratch/gcc-8.4.0/libstdc++-v3/libsupc++ -I/scratch/gcc-8.4.0/libstdc++-v3/include/backward -I/scratch/gcc-8.4.0/libstdc++-v3/testsuite/util -L/scratch/gcc8bld/x86_64-pc-linux-gnu/libstdc++-v3/src -L/scratch/gcc8bld/x86_64-pc-linux-gnu/libstdc++-v3/src/.libs -L/scratch/gcc8bld/x86_64-pc-linux-gnu/libstdc++-v3/libsupc++/.libs -B/scratch/gcc8bld/x86_64-pc-linux-gnu/libstdc++-v3/src/.libs -B/scratch/gcc8bld/x86_64-pc-linux-gnu/libstdc++-v3/libsupc++/.libs -B/home/FCAM/username/.local/x86_64-pc-linux-gnu/bin/ -B/home/FCAM/username/.local/x86_64-pc-linux-gnu/lib/ -isystem /home/FCAM/username/.local/x86_64-pc-linux-gnu/include -isystem /home/FCAM/username/.local/x86_64-pc-linux-gnu/sys-include     -fPIC -DPIC -shared -nostdlib /lib/../lib64/crti.o /scratch/gcc8bld/./gcc/crtbeginS.o  .libs/findcomp.o .libs/libcc1.o .libs/libcp1.o .libs/names.o .libs/callbacks.o .libs/connection.o .libs/marshall.o   -L/scratch/gcc8bld/x86_64-pc-linux-gnu/libstdc++-v3/src/.libs -L/scratch/gcc8bld/x86_64-pc-linux-gnu/libstdc++-v3/src -L/scratch/gcc8bld/x86_64-pc-linux-gnu/libstdc++-v3/libsupc++/.libs -L/scratch/gcc8bld/./gcc -L/lib/../lib64 -L/usr/lib/../lib64 /scratch/gcc8bld/x86_64-pc-linux-gnu/libstdc++-v3/src/.libs/libstdc++.a -lm -lc -lgcc /scratch/gcc8bld/./gcc/crtendS.o /lib/../lib64/crtn.o  -static-libstdc++ -static-libgcc ../libiberty/pic/libiberty.a   -Wl,-soname -Wl,libcc1.so.0 -Wl,-retain-symbols-file -Wl,../../gcc-8.4.0/libcc1/libcc1.sym -o .libs/libcc1.so.0.0.0
make[3]: Leaving directory `/scratch/ggcc8bld/libcc1'
make[2]: Leaving directory `/scratch/ggcc8bld/libcc1'
make[1]: Leaving directory `/scratch/ggcc8bld'

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...