LFS 가이드에 따라 binutils 5.25 및 glibc 2.21을 사용하여 GCC 5.1을 컴파일하려고 시도했지만 "gcc pass 2" 단계에 도달하면 오류와 함께 프로세스가 실패했습니다.
ld: /tools/lib/../lib64/libstdc++.a(new_opv.o): relocation R_X86_64_32 against `_ZTISt9bad_alloc' can not be used when making a shared object; recompile with -fPIC
/tools/lib/../lib64/libstdc++.a: error adding symbols: Bad value
해당 옵션을 제공하려고 시도했지만 -fPIC
도움이 되지 않습니다.
내 구성 옵션은 다음과 같습니다.
CC=$LFS_TGT-gcc
CXX=$LFS_TGT-g++
AR=$LFS_TGT-ar
RANLIB=$LFS_TGT-ranlib
../gcc-5.1.0/configure \
--prefix=/tools \
--with-local-prefix=/tools \
--with-native-system-header-dir=/tools/include \
--enable-languages=c,c++ \
--disable-libstdcxx-pch \
--disable-multilib \
--disable-bootstrap \
--disable-libgomp
전체 오류 메시지는 다음과 같습니다.
libtool: link: x86_64-peal-linux-gnu-g++ -fPIC -DPIC -shared -nostdlib /home/system/peal/system/system/toolchain/tools/lib/../lib64/crti.o /home/system/peal/system/system/toolchain/tools/bin/../lib/gcc/x86_64-peal-linux-gnu/5.1.0/crtbeginS.o .libs/findcomp.o .libs/libcc1.o .libs/names.o .libs/callbacks.o .libs/connection.o .libs/marshall.o -L/home/system/peal/system/system/toolchain/tools/bin/../lib/gcc/x86_64-peal-linux-gnu/5.1.0 -L/home/system/peal/system/system/toolchain/tools/bin/../lib/gcc -L/home/system/peal/system/system/toolchain/tools/lib/../lib64 -L/home/system/peal/system/system/toolchain/tools/bin/../lib/gcc/x86_64-peal-linux-gnu/5.1.0/../../../../x86_64-peal-linux-gnu/lib -L/home/system/peal/system/system/toolchain/tools/lib /tools/lib/../lib64/libstdc++.a -lm -lc -lgcc /home/system/peal/system/system/toolchain/tools/bin/../lib/gcc/x86_64-peal-linux-gnu/5.1.0/crtendS.o /home/system/peal/system/system/toolchain/tools/lib/../lib64/crtn.o -static-libstdc++ -static-libgcc ../libiberty/pic/libiberty.a -Wl,-soname -Wl,libcc1.so.0 -Wl,-retain-symbols-file -Wl,../../gcc-5.1.0/libcc1/libcc1.sym -o .libs/libcc1.so.0.0.0
/home/system/peal/system/system/toolchain/tools/bin/../lib/gcc/x86_64-peal-linux-gnu/5.1.0/../../../../x86_64-peal-linux-gnu/bin/ld: /tools/lib/../lib64/libstdc++.a(new_opv.o): relocation R_X86_64_32 against `_ZTISt9bad_alloc' can not be used when making a shared object; recompile with -fPIC
/tools/lib/../lib64/libstdc++.a: error adding symbols: Bad value
collect2: error: ld returned 1 exit status
Makefile:409: recipe for target 'libcc1.la' failed
make[3]: *** [libcc1.la] Error 1
make[3]: Leaving directory '/home/system/peal/system/system/toolchain/sources/gcc-build/libcc1'
Makefile:291: recipe for target 'all' failed
make[2]: *** [all] Error 2
make[2]: Leaving directory '/home/system/peal/system/system/toolchain/sources/gcc-build/libcc1'
Makefile:10639: recipe for target 'all-libcc1' failed
make[1]: *** [all-libcc1] Error 2
make[1]: Leaving directory '/home/system/peal/system/system/toolchain/sources/gcc-build'
Makefile:880: recipe for target 'all' failed
make: *** [all] Error 2
도움이된다면 LFS*
변수는 다음과 같습니다.
LFS=/home/system/peal/system/system/toolchain
LFS_TGT=x86_64-peal-linux-gnu
내 빌드 서버는 매일 업데이트되는 Ubuntu 16.04(gcc 5.3)를 기반으로 합니다.
툴체인에 대한 자세한 내용은 다음과 같습니다.
me@buildserver:/home/system/peal/system/system/toolchain/sources/gcc-build$ gcc --version
gcc (GCC) 5.1.0
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
me@buildserver:/home/system/peal/system/system/toolchain/sources/gcc-build$ g++ --version
g++ (GCC) 5.1.0
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
me@buildserver:/home/system/peal/system/system/toolchain/sources/gcc-build$ ld --version
GNU ld (GNU Binutils) 2.25.90.20151209
Copyright (C) 2015 Free Software Foundation, Inc.
This program is free software; you may redistribute it under the terms of
the GNU General Public License version 3 or (at your option) a later version.
This program has absolutely no warranty.
me@buildserver:/home/system/peal/system/system/toolchain/sources/gcc-build$ ldd --version
ldd (GNU libc) 2.21
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Written by Roland McGrath and Ulrich Drepper.
me@buildserver:/home/system/peal/system/system/toolchain/sources/gcc-build$ which ld
/tools/bin/ld
me@buildserver:/home/system/peal/system/system/toolchain/sources/gcc-build$ which ldd
/tools/bin/ldd
me@buildserver:/home/system/peal/system/system/toolchain/sources/gcc-build$ which gcc
/tools/bin/gcc
me@buildserver:/home/system/peal/system/system/toolchain/sources/gcc-build$ which g++
/tools/bin/g++
어떤 아이디어가 있나요?
감사합니다!
답변1
문제를 발견했습니다.
- Munir가 말했듯이 나는
sh
대신 ;dash
bash
- 이후 헤더 파일
gcc
누락으로 인해 컴파일에 실패했습니다. 이 문제는 build: 플래그를 추가하여 해결 되었습니다 .rpc/xdr.h
glibc
--enable-obsolete-rpc
이제 모든 것이 괜찮습니다.