我正在Debian 9.8(x64)上编译glibc 2.19,但是在运行make
之后出现以下错误。该如何解决?
gcc -B/usr/bin/ -nostdlib -nostartfiles -o /home/cyril/HME/Multcore_version/AHME/glibc-build/iconv/iconv_prog -Wl,-z,combreloc -Wl,-z,relro -Wl,--hash-style=both /home/cyril/HME/Multcore_version/AHME/glibc-build/csu/crt1.o /home/cyril/HME/Multcore_version/AHME/glibc-build/csu/crti.o `gcc -B/usr/bin/ --print-file-name=crtbegin.o` /home/cyril/HME/Multcore_version/AHME/glibc-build/iconv/iconv_prog.o /home/cyril/HME/Multcore_version/AHME/glibc-build/iconv/iconv_charmap.o /home/cyril/HME/Multcore_version/AHME/glibc-build/iconv/charmap.o /home/cyril/HME/Multcore_version/AHME/glibc-build/iconv/charmap-dir.o /home/cyril/HME/Multcore_version/AHME/glibc-build/iconv/linereader.o /home/cyril/HME/Multcore_version/AHME/glibc-build/iconv/dummy-repertoire.o /home/cyril/HME/Multcore_version/AHME/glibc-build/iconv/simple-hash.o /home/cyril/HME/Multcore_version/AHME/glibc-build/iconv/xstrdup.o /home/cyril/HME/Multcore_version/AHME/glibc-build/iconv/xmalloc.o -Wl,-dynamic-linker=/lib64/ld-linux-x86-64.so.2 -Wl,-rpath-link=/home/cyril/HME/Multcore_version/AHME/glibc-build:/home/cyril/HME/Multcore_version/AHME/glibc-build/math:/home/cyril/HME/Multcore_version/AHME/glibc-build/elf:/home/cyril/HME/Multcore_version/AHME/glibc-build/dlfcn:/home/cyril/HME/Multcore_version/AHME/glibc-build/nss:/home/cyril/HME/Multcore_version/AHME/glibc-build/nis:/home/cyril/HME/Multcore_version/AHME/glibc-build/rt:/home/cyril/HME/Multcore_version/AHME/glibc-build/resolv:/home/cyril/HME/Multcore_version/AHME/glibc-build/crypt:/home/cyril/HME/Multcore_version/AHME/glibc-build/nptl /home/cyril/HME/Multcore_version/AHME/glibc-build/libc.so.6 /home/cyril/HME/Multcore_version/AHME/glibc-build/libc_nonshared.a -Wl,--as-needed /home/cyril/HME/Multcore_version/AHME/glibc-build/elf/ld.so -Wl,--no-as-needed -lgcc `gcc -B/usr/bin/ --print-file-name=crtend.o` /home/cyril/HME/Multcore_version/AHME/glibc-build/csu/crtn.o
/usr/bin/ld: /home/cyril/HME/Multcore_version/AHME/glibc-build/csu/crt1.o: relocation R_X86_64_32S against symbol `__libc_csu_fini' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/6/crtbegin.o: relocation R_X86_64_32 against hidden symbol `__TMC_END__' can not be used when making a shared object
/usr/bin/ld: final link failed: Nonrepresentable section on output
/usr/bin/ld: /home/cyril/HME/Multcore_version/AHME/glibc-build/csu/crt1.o: relocation R_X86_64_32S against symbol `__libc_csu_fini' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/6/crtbegin.o: relocation R_X86_64_32 against hidden symbol `__TMC_END__' can not be used when making a shared object
/usr/bin/ld: final link failed: Nonrepresentable section on output
collect2: error: ld returned 1 exit status
collect2: error: ld returned 1 exit status
答案 0 :(得分:0)
默认情况下,您的GCC已配置为生成与位置无关的可执行文件。但是GLIBC-2.19的Makefile
尚未准备好进行这种配置。
第1步:验证PIE部分是否正确:
echo "int main() { return 0; }" | gcc -xc - &&
file ./a.out
应显示“共享库”或“位置独立的可执行文件”。
第2步:您可以修复通过向-no-pie
添加LDFLAGS
而构建的GLIBC-2.19。