Hello All

>From the "that's what you get for touching that" dept:

I've been testing the development versions of gcc and glibc (from svn
and git) and lately I've seen some breakage related to libgcc_s.so.

Current Glibc fails to build with a LD cannot find -lgcc_s error.
Grepping the source for -lgcc_s shows that Makeconfig now includes
-lgcc_s in its default LDFLAGS for libgcc_eh. The solution that works
for me is to simply remove it:

sed -i 's# -lgcc_s##' Makeconfig

I also tried copying libgcc_s.so from the host into /tools/lib (that
also worked). The buildlogs were identical for glibc in both cases so I
think the sed is probably safe.

So far so simple. With gcc it was a bit more complicated. With
gcc-4.7-20120623 (ftp://ftp.fu-berlin.de/unix/languages/gcc/snapshots)
The second pass of gcc fails while compiling libstdc++ with an error
like this:

libtool: link:  /mnt/lfs/sources/gcc-build/./gcc/xgcc -shared-libgcc 
-B/mnt/lfs/sources/gcc-build/./gcc -nostdinc++ 
-L/mnt/lfs/sources/gcc-build/x86_64-unknown-linux-gnu/libstdc++-v3/src 
-L/mnt/lfs/sources/gcc-build/x86_64-unknown-linux-gnu/libstdc++-v3/src/.libs 
-B/tools/x86_64-unknown-linux-gnu/bin/ -B/tools/x86_64-unknown-linux-gnu/lib/ 
-isystem /tools/x86_64-unknown-linux-gnu/include -isystem 
/tools/x86_64-unknown-linux-gnu/sys-include    -shared -nostdlib 
/tools/lib/../lib64/crti.o /mnt/lfs/sources/gcc-build/./gcc/crtbeginS.o  
.libs/compatibility.o .libs/compatibility-debug_list.o 
.libs/compatibility-debug_list-2.o .libs/compatibility-list.o 
.libs/compatibility-list-2.o .libs/compatibility-c++0x.o 
.libs/compatibility-atomic-c++0x.o .libs/compatibility-thread-c++0x.o  
-Wl,--whole-archive ../libsupc++/.libs/libsupc++convenience.a 
../src/c++98/.libs/libc++98convenience.a 
../src/c++11/.libs/libc++11convenience.a -Wl,--no-whole-archive  
-L/mnt/lfs/sources/gcc-build/x86_64-unk
 nown-lin
 ux-gnu/libstdc++-v3/src 
-L/mnt/lfs/sources/gcc-build/x86_64-unknown-linux-gnu/libstdc++-v3/src/.libs 
-lm -L/mnt/lfs/sources/gcc-build/./gcc -L/tools/x86_64-unknown-linux-gnu/bin 
-L/tools/x86_64-unknown-linux-gnu/lib -L/tools/lib/../lib64 -L/tools/lib -lc 
-lgcc_s /mnt/lfs/sources/gcc-build/./gcc/crtendS.o /tools/lib/../lib64/crtn.o  
-Wl,-O1 -Wl,-z -Wl,relro -Wl,--gc-sections 
-Wl,--version-script=libstdc++-symbols.ver   -Wl,-soname -Wl,libstdc++.so.6 -o 
.libs/libstdc++.so.6.0.17
../src/c++11/.libs/libc++11convenience.a(functexcept.o): In function 
`operator()':
/mnt/lfs/sources/gcc-build/x86_64-unknown-linux-gnu/libstdc++-v3/include/mutex:815:
 multiple definition of `void std::call_once<void (std::thread::*)(), 
std::reference_wrapper<std::thread> >(std::once_flag&, void 
(std::thread::*&&)(), 
std::reference_wrapper<std::thread>&&)::{lambda()#1}::_FUN()'
.libs/compatibility-thread-c++0x.o:/mnt/lfs/sources/gcc-build/x86_64-unknown-linux-gnu/libstdc++-v3/include/mutex:815:
 first defined here
../src/c++11/.libs/libc++11convenience.a(functexcept.o): In function 
`_ZZSt9call_onceIMNSt13__future_base11_State_baseEFvRSt8functionIFSt10unique_ptrINS0_12_Result_baseENS4_8_DeleterEEvEERbEJKPS1_St17reference_wrapperIS8_ESF_IbEEEvRSt9once_flagOT_DpOT0_ENUlvE_4_FUNEv':
/mnt/lfs/sources/gcc-build/x86_64-unknown-linux-gnu/libstdc++-v3/include/mutex:815:
 multiple definition of `void std::call_once<void 
(std::__future_base::_State_base::*)(std::function<std::unique_ptr<std::__future_base::_Result_base,
 std::__future_base::_Result_base::_Deleter> ()>&, bool&), 
std::__future_base::_State_base* const, 
std::reference_wrapper<std::function<std::unique_ptr<std::__future_base::_Result_base,
 std::__future_base::_Result_base::_Deleter> ()> >, 
std::reference_wrapper<bool> >(std::once_flag&, void 
(std::__future_base::_State_base::*&&)(std::function<std::unique_ptr<std::__future_base::_Result_base,
 std::__future_base::_Result_base::_Deleter> ()>&, bool&), 
std::__future_base::_State_base* const&&, 
std::reference_wrapper<std::function<std::unique_ptr<std::__future_base::_Result_base,
 std::__future_base::_Result_base::_Deleter> ()> >&&, 
std::reference_wrapper<bool>&&)::{lambda()#1}::_FUN()'
.libs/compatibility-thread-c++0x.o:/mnt/lfs/sources/gcc-build/x86_64-unknown-linux-gnu/libstdc++-v3/include/mutex:815:
 first defined here
../src/c++11/.libs/libc++11convenience.a(functexcept.o): In function 
`_ZZSt9call_onceIMNSt13__future_base11_State_baseEFvRSt8functionIFSt10unique_ptrINS0_12_Result_baseENS4_8_DeleterEEvEERbEJKPS1_St17reference_wrapperIS8_ESF_IbEEEvRSt9once_flagOT_DpOT0_ENKUlvE_cvPFvvEEv':
/mnt/lfs/sources/gcc-build/x86_64-unknown-linux-gnu/libstdc++-v3/include/mutex:815:
 multiple definition of `void std::call_once<void 
(std::__future_base::_State_base::*)(std::function<std::unique_ptr<std::__future_base::_Result_base,
 std::__future_base::_Result_base::_Deleter> ()>&, bool&), 
std::__future_base::_State_base* const, 
std::reference_wrapper<std::function<std::unique_ptr<std::__future_base::_Result_base,
 std::__future_base::_Result_base::_Deleter> ()> >, 
std::reference_wrapper<bool> >(std::once_flag&, void 
(std::__future_base::_State_base::*&&)(std::function<std::unique_ptr<std::__future_base::_Result_base,
 std::__future_base::_Result_base::_Deleter> ()>&, bool&), 
std::__future_base::_State_base* const&&, 
std::reference_wrapper<std::function<std::unique_ptr<std::__future_base::_Result_base,
 std::__future_base::_Result_base::_Deleter> ()> >&&, 
std::reference_wrapper<bool>&&)::{lambda()#1}::operator void (*)()() const'
.libs/compatibility-thread-c++0x.o:/mnt/lfs/sources/gcc-build/x86_64-unknown-linux-gnu/libstdc++-v3/include/mutex:815:
 first defined here
../src/c++11/.libs/libc++11convenience.a(functexcept.o): In function `void 
std::call_once<void (std::thread::*)(), std::reference_wrapper<std::thread> 
>(std::once_flag&, void (std::thread::*&&)(), 
std::reference_wrapper<std::thread>&&)::{lambda()#1}::operator void (*)()() 
const':
/mnt/lfs/sources/gcc-build/x86_64-unknown-linux-gnu/libstdc++-v3/include/mutex:815:
 multiple definition of `void std::call_once<void (std::thread::*)(), 
std::reference_wrapper<std::thread> >(std::once_flag&, void 
(std::thread::*&&)(), 
std::reference_wrapper<std::thread>&&)::{lambda()#1}::operator void (*)()() 
const'
.libs/compatibility-thread-c++0x.o:/mnt/lfs/sources/gcc-build/x86_64-unknown-linux-gnu/libstdc++-v3/include/mutex:815:
 first defined here
../src/c++11/.libs/libc++11convenience.a(future.o): In function `operator()':
/mnt/lfs/sources/gcc-build/x86_64-unknown-linux-gnu/libstdc++-v3/include/mutex:815:
 multiple definition of `void std::call_once<void (std::thread::*)(), 
std::reference_wrapper<std::thread> >(std::once_flag&, void 
(std::thread::*&&)(), 
std::reference_wrapper<std::thread>&&)::{lambda()#1}::_FUN()'
.libs/compatibility-thread-c++0x.o:/mnt/lfs/sources/gcc-build/x86_64-unknown-linux-gnu/libstdc++-v3/include/mutex:815:
 first defined here
../src/c++11/.libs/libc++11convenience.a(future.o): In function 
`_ZZSt9call_onceIMNSt13__future_base11_State_baseEFvRSt8functionIFSt10unique_ptrINS0_12_Result_baseENS4_8_DeleterEEvEERbEJKPS1_St17reference_wrapperIS8_ESF_IbEEEvRSt9once_flagOT_DpOT0_ENUlvE_4_FUNEv':
/mnt/lfs/sources/gcc-build/x86_64-unknown-linux-gnu/libstdc++-v3/include/mutex:815:
 multiple definition of `void std::call_once<void 
(std::__future_base::_State_base::*)(std::function<std::unique_ptr<std::__future_base::_Result_base,
 std::__future_base::_Result_base::_Deleter> ()>&, bool&), 
std::__future_base::_State_base* const, 
std::reference_wrapper<std::function<std::unique_ptr<std::__future_base::_Result_base,
 std::__future_base::_Result_base::_Deleter> ()> >, 
std::reference_wrapper<bool> >(std::once_flag&, void 
(std::__future_base::_State_base::*&&)(std::function<std::unique_ptr<std::__future_base::_Result_base,
 std::__future_base::_Result_base::_Deleter> ()>&, bool&), 
std::__future_base::_State_base* const&&, 
std::reference_wrapper<std::function<std::unique_ptr<std::__future_base::_Result_base,
 std::__future_base::_Result_base::_Deleter> ()> >&&, 
std::reference_wrapper<bool>&&)::{lambda()#1}::_FUN()'
.libs/compatibility-thread-c++0x.o:/mnt/lfs/sources/gcc-build/x86_64-unknown-linux-gnu/libstdc++-v3/include/mutex:815:
 first defined here
../src/c++11/.libs/libc++11convenience.a(future.o): In function 
`_ZZSt9call_onceIMNSt13__future_base11_State_baseEFvRSt8functionIFSt10unique_ptrINS0_12_Result_baseENS4_8_DeleterEEvEERbEJKPS1_St17reference_wrapperIS8_ESF_IbEEEvRSt9once_flagOT_DpOT0_ENKUlvE_cvPFvvEEv':
/mnt/lfs/sources/gcc-build/x86_64-unknown-linux-gnu/libstdc++-v3/include/mutex:815:
 multiple definition of `void std::call_once<void 
(std::__future_base::_State_base::*)(std::function<std::unique_ptr<std::__future_base::_Result_base,
 std::__future_base::_Result_base::_Deleter> ()>&, bool&), 
std::__future_base::_State_base* const, 
std::reference_wrapper<std::function<std::unique_ptr<std::__future_base::_Result_base,
 std::__future_base::_Result_base::_Deleter> ()> >, 
std::reference_wrapper<bool> >(std::once_flag&, void 
(std::__future_base::_State_base::*&&)(std::function<std::unique_ptr<std::__future_base::_Result_base,
 std::__future_base::_Result_base::_Deleter> ()>&, bool&), 
std::__future_base::_State_base* const&&, 
std::reference_wrapper<std::function<std::unique_ptr<std::__future_base::_Result_base,
 std::__future_base::_Result_base::_Deleter> ()> >&&, 
std::reference_wrapper<bool>&&)::{lambda()#1}::operator void (*)()() const'
.libs/compatibility-thread-c++0x.o:/mnt/lfs/sources/gcc-build/x86_64-unknown-linux-gnu/libstdc++-v3/include/mutex:815:
 first defined here
../src/c++11/.libs/libc++11convenience.a(future.o): In function `void 
std::call_once<void (std::thread::*)(), std::reference_wrapper<std::thread> 
>(std::once_flag&, void (std::thread::*&&)(), 
std::reference_wrapper<std::thread>&&)::{lambda()#1}::operator void (*)()() 
const':
/mnt/lfs/sources/gcc-build/x86_64-unknown-linux-gnu/libstdc++-v3/include/mutex:815:
 multiple definition of `void std::call_once<void (std::thread::*)(), 
std::reference_wrapper<std::thread> >(std::once_flag&, void 
(std::thread::*&&)(), 
std::reference_wrapper<std::thread>&&)::{lambda()#1}::operator void (*)()() 
const'
.libs/compatibility-thread-c++0x.o:/mnt/lfs/sources/gcc-build/x86_64-unknown-linux-gnu/libstdc++-v3/include/mutex:815:
 first defined here
collect2: error: ld returned 1 exit status
make[5]: *** [libstdc++.la] Error 1
make[5]: Leaving directory 
`/mnt/lfs/sources/gcc-build/x86_64-unknown-linux-gnu/libstdc++-v3/src'
make[4]: *** [all-recursive] Error 1
make[4]: Leaving directory 
`/mnt/lfs/sources/gcc-build/x86_64-unknown-linux-gnu/libstdc++-v3/src'
make[3]: *** [all-recursive] Error 1
make[3]: Leaving directory 
`/mnt/lfs/sources/gcc-build/x86_64-unknown-linux-gnu/libstdc++-v3'
make[2]: *** [all] Error 2
make[2]: Leaving directory 
`/mnt/lfs/sources/gcc-build/x86_64-unknown-linux-gnu/libstdc++-v3'
make[1]: *** [all-target-libstdc++-v3] Error 2
make[1]: Leaving directory `/mnt/lfs/sources/gcc-build'
make: *** [all] Error 2

Eww, ugly. Looking at the config.log in
gcc-build/x86_64-unknown-linux-gnu/libstdc++-v3/ I see:

./conftest: error while loading shared libraries: libgcc_s.so.1: cannot open 
shared object file: No such file or directory

And:

gcc_cv_have_tls=no

It seems that the error is related to gcc's lack of thread local
storage due to the fact that configure didn't find libgcc_s.so. The
first pass of Gcc doesn't install libgcc_s.so so in order to make one
available for the libstdc++ configure script to find I first tried
simply copying libgcc_s.so from the host into /tools/lib. This worked
but is obviously not suitable as it breaks the separation between the
host and tools. Looking in gcc-build I can see libgcc_s.so.1 in
gcc-build/$(uname -m)-unknown-linux-gnu/libgcc. If I copy that
into /tools/lib, rm -rf gcc-build/x86_64-unknown-linux-gnu/libstdc++-v3
and then run make again the build succeeds. In order to avoid the error
entirely I had to (in gcc-build, just before running make):

make all-target-libgcc
cp $(uname -m)-unknown-linux-gnu/libgcc/libgcc_s.so.1 /tools/lib
ln -s libgcc_s.so.1 /tools/lib/libgcc_s.so

And then run make, make install and so on. I think we will need to do
something similar when gcc-4.7.2 is released.

Looking at the gcc bugzilla the problem seems to be related to
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53675 but I'm not sure.

Andy
-- 
http://linuxfromscratch.org/mailman/listinfo/lfs-dev
FAQ: http://www.linuxfromscratch.org/faq/
Unsubscribe: See the above information page

Reply via email to