Bug 795

Summary: LSB: Some cases (libstdc++.so.6) failed on library check of LSB test.
Product: [Build System, Metadata & Runtime] OE-Core Reporter: Jingdong Lu <jingdong.lu>
Component: devtools / tool chainAssignee: Nitin Kamble <nitin.a.kamble>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: Medium CC: jingdong.lu, meta.mr.watcher, meta.watcher, sgw
Version: 1.0   
Target Milestone: 1.0 M4   
Hardware: x86   
OS: x86   
Whiteboard:
OS type for building Yocto: --- Type of Regression: ---
Verified: Documentation change: ---

Description Jingdong Lu 2011-03-03 00:47:19 UTC
When we run library check of LSB on qemux86 and qemuppc, we got some failures about 'libstdc++.so.6'.

Test environment:
Platform: Qemu-x86, Qemu-ppc
lsb image: poky-image-lsb-qemux86-test.ext3(Feb 26th, auto-build server)
Library check of LSB: 4.1.0-1

The error log:
Did not find _ZNKSt5ctypeIcE8do_widenEPKcS2_Pc (GLIBCXX_3.4) in libstdc++.so.6
Unmangled symbol name: std::ctype<char>::do_widen(char const*, char const*, char*) const
Did not find _ZNKSt5ctypeIcE8do_widenEc (GLIBCXX_3.4) in libstdc++.so.6
Unmangled symbol name: std::ctype<char>::do_widen(char) const
Did not find _ZNKSt5ctypeIcE9do_narrowEPKcS2_cPc (GLIBCXX_3.4) in libstdc++.so.6
Unmangled symbol name: std::ctype<char>::do_narrow(char const*, char const*, char, char*) const
Did not find _ZNKSt5ctypeIcE9do_narrowEcc (GLIBCXX_3.4) in libstdc++.so.6
Unmangled symbol name: std::ctype<char>::do_narrow(char, char) const


Did not find _ZNSt11range_errorD0Ev (GLIBCXX_3.4) in libstdc++.so.6
Unmangled symbol name: std::range_error::~range_error()
Did not find _ZNSt11range_errorD1Ev (GLIBCXX_3.4) in libstdc++.so.6
Unmangled symbol name: std::range_error::~range_error()
Did not find _ZNSt12domain_errorD0Ev (GLIBCXX_3.4) in libstdc++.so.6
Unmangled symbol name: std::domain_error::~domain_error()
Did not find _ZNSt12domain_errorD1Ev (GLIBCXX_3.4) in libstdc++.so.6
Unmangled symbol name: std::domain_error::~domain_error()
Did not find _ZNSt12length_errorD0Ev (GLIBCXX_3.4) in libstdc++.so.6
Unmangled symbol name: std::length_error::~length_error()
Did not find _ZNSt12length_errorD1Ev (GLIBCXX_3.4) in libstdc++.so.6
Unmangled symbol name: std::length_error::~length_error()
Did not find _ZNSt12out_of_rangeD0Ev (GLIBCXX_3.4) in libstdc++.so.6
Unmangled symbol name: std::out_of_range::~out_of_range()
Did not find _ZNSt12out_of_rangeD1Ev (GLIBCXX_3.4) in libstdc++.so.6
Unmangled symbol name: std::out_of_range::~out_of_range()
Did not find _ZNSt14overflow_errorD0Ev (GLIBCXX_3.4) in libstdc++.so.6
Unmangled symbol name: std::overflow_error::~overflow_error()
Did not find _ZNSt14overflow_errorD1Ev (GLIBCXX_3.4) in libstdc++.so.6
Unmangled symbol name: std::overflow_error::~overflow_error()
Did not find _ZNSt15basic_stringbufIcSt11char_traitsIcESaIcEED0Ev (GLIBCXX_3.4) in libstdc++.so.6
Unmangled symbol name: std::basic_stringbuf<char, std::char_traits<char>, std::allocator<char> >::~basic_stringbuf()
Did not find _ZNSt15basic_stringbufIcSt11char_traitsIcESaIcEED1Ev (GLIBCXX_3.4) in libstdc++.so.6
Unmangled symbol name: std::basic_stringbuf<char, std::char_traits<char>, std::allocator<char> >::~basic_stringbuf()
Did not find _ZNSt15basic_stringbufIwSt11char_traitsIwESaIwEED0Ev (GLIBCXX_3.4) in libstdc++.so.6
Unmangled symbol name: std::basic_stringbuf<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >::~basic_stringbuf()
Did not find _ZNSt15basic_stringbufIwSt11char_traitsIwESaIwEED1Ev (GLIBCXX_3.4) in libstdc++.so.6
Unmangled symbol name: std::basic_stringbuf<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >::~basic_stringbuf()
Did not find _ZNSt15underflow_errorD0Ev (GLIBCXX_3.4) in libstdc++.so.6
Unmangled symbol name: std::underflow_error::~underflow_error()
Did not find _ZNSt15underflow_errorD1Ev (GLIBCXX_3.4) in libstdc++.so.6
Unmangled symbol name: std::underflow_error::~underflow_error()
Did not find _ZNSt16invalid_argumentD0Ev (GLIBCXX_3.4) in libstdc++.so.6
Unmangled symbol name: std::invalid_argument::~invalid_argument()
Did not find _ZNSt16invalid_argumentD1Ev (GLIBCXX_3.4) in libstdc++.so.6
Unmangled symbol name: std::invalid_argument::~invalid_argument()

On qemu:
root@qemux86:~# nm -D /usr/lib/libstdc++.so.6 | grep do_widen
4c959480 T _ZNKSt5ctypeIwE8do_widenEPKcS2_Pw
4c959460 T _ZNKSt5ctypeIwE8do_widenEc

root@qemux86:~# nm -D /usr/lib/libstdc++.so.6 | grep range_error
4c90c340 T _ZNSt11range_errorC1ERKSs
4c90c340 T _ZNSt11range_errorC2ERKSs
4c9066c0 T _ZSt19__throw_range_errorPKc
4c99478c V _ZTISt11range_error
4c967487 V _ZTSSt11range_error
4c994798 V _ZTVSt11range_error
Comment 1 Jingdong Lu 2011-03-03 01:15:54 UTC
I test the unstripped libstdc++.so.6.0.14 generated by gcc-runtime_4.5.1.bb.

eric@eric-desktop:~/poky/poky-0210/build/tmp/work/i586-poky-linux/gcc-runtime-4.5.1-r2/image/usr/lib$ nm libstdc++.so | grep do_widen
0004d220 t _ZNKSt5ctypeIcE8do_widenEPKcS2_Pc
0004d100 t _ZNKSt5ctypeIcE8do_widenEc
000a2c80 T _ZNKSt5ctypeIwE8do_widenEPKcS2_Pw
000a2c60 T _ZNKSt5ctypeIwE8do_widenEc

_ZNKSt5ctypeIcE8do_widenEPKcS2_Pc, ... should be a weak symbol like this:

root@qemux86:~# nm -D /usr/lib/libstdc\+\+.so.6 | grep do_widen
0004d130 W _ZNKSt5ctypeIcE8do_widenEPKcS2_Pc
0004d010 W _ZNKSt5ctypeIcE8do_widenEc
000a30c0 T _ZNKSt5ctypeIwE8do_widenEPKcS2_Pw
000a30a0 T _ZNKSt5ctypeIwE8do_widenEc

I found that some weak symbols ('W') change into local ('t') during link time and be stripped. According to compiling log, the option "-fvisibility-inlines-hidden" is used for gcc. And this option caused some weak symbols change into local.

In .../meta/conf/distro/include/poky-eglibc.inc
CXXFLAGS += "-fvisibility-inlines-hidden"

~/poky/poky-0210/build$ bitbake -e | grep  CXXFLAGS
...
# TARGET_CXXFLAGS=${TARGET_CFLAGS} -fpermissive
export TARGET_CXXFLAGS="-fexpensive-optimizations -fomit-frame-pointer -frename-registers -O2 -ggdb -feliminate-unused-debug-types -fpermissive"
# CXXFLAGS=${TARGET_CXXFLAGS} -fvisibility-inlines-hidden
export CXXFLAGS="-fexpensive-optimizations -fomit-frame-pointer -frename-registers -O2 -ggdb -feliminate-unused-debug-types -fpermissive -fvisibility-inlines-hidden"

So I suggest this option "-fvisibility-inlines-hidden" should be removed when compiling libstdc++ and I give a proposed patch for this failure.

gcc-configure-runtime.inc
--- gcc-configure-runtime.inc.orig	2011-03-03 17:09:38.754912745 +0800
+++ gcc-configure-runtime.inc	2011-03-03 17:09:49.374912073 +0800
@@ -14,6 +14,7 @@
 
 do_configure () {
 	export CXX="${CXX} -nostdinc++ -nostdlib++"
+	export CXXFLAGS="${TARGET_CXXFLAGS}"
 	for d in ${RUNTIMETARGET}; do
 		echo "Configuring $d"
 		mkdir -p ${B}/$d/

According to the suggestion from LFS, we also can unset CXXFLAGS when compiling libstdc++. I have checked these two modifications and got excepted results.
Comment 2 Nitin Kamble 2011-03-10 15:38:20 UTC
sent a patch to the mailing list for fixing this bug.