Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 28 Jun 2010 03:40:26 +0400
From:      Anonymous <swell.k@gmail.com>
To:        FreeBSD-gnats-submit@FreeBSD.org
Subject:   ports/148196: devel/binutils: ignores libmap.conf(5) or missing *@GLIBCXX_3.4.* symbols
Message-ID:  <86y6e0jb85.fsf@gmail.com>
Resent-Message-ID: <201006272350.o5RNo2Yd067861@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         148196
>Category:       ports
>Synopsis:       devel/binutils: ignores libmap.conf(5) or missing *@GLIBCXX_3.4.* symbols
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sun Jun 27 23:50:02 UTC 2010
>Closed-Date:
>Last-Modified:
>Originator:     Anonymous
>Release:        FreeBSD 9.0-CURRENT amd64
>Organization:
>Environment:
LOCALBASE=/usr/pkg

Tested mostly on devel/binutils, WITHOUT_GOLD (from ports/148005).
It's hard to test `gold' when it itself depends on -lstdc++.
>Description:
http://docs.freebsd.org/cgi/mid.cgi?86pqzd2nif.fsf

ld(1) unlike rtld(1) only uses hints file when resolving indirect dependencies.

Base binutils are affected as well, but the issue only becomes annoying
when using compiler/linker from ports.

Using libmap.conf(5) is preferred to altering search path in hints file
according to custom-gcc article.

  http://www.freebsd.org/doc/en/articles/custom-gcc/article.html#ADJUSTING-LIBMAP.CONF

>How-To-Repeat:
1. install lang/gcc45
2. build devel/boost-libs using gcc45
3. try linking -lboost_regex

   $ echo 'int main(void) { return(0); }' | gcc45 -xc -o/dev/null - -lboost_regex -L$LOCALBASE/lib
   /usr/pkg/lib/libboost_regex.so: undefined reference to `std::ctype<char>::_M_widen_init() const@GLIBCXX_3.4.11'
   /usr/pkg/lib/libboost_regex.so: undefined reference to `std::_List_node_base::_M_unhook()@GLIBCXX_3.4.14'
   /usr/pkg/lib/libboost_regex.so: undefined reference to `std::_List_node_base::_M_transfer(std::_List_node_base*, std::_List_node_base*)@GLIBCXX_3.4.14'
   /usr/pkg/lib/libboost_regex.so: undefined reference to `std::_List_node_base::_M_hook(std::_List_node_base*)@GLIBCXX_3.4.14'
   collect2: ld returned 1 exit status

4. try to add -lstdc++ to libmap.conf

   # echo libstdc++.so.6 gcc45/libstdc++.so.6 >>/etc/libmap.conf

5. try again step #3

   $ echo 'int main(void) { return(0); }' | gcc45 -xc -o/dev/null - -lboost_regex -L$LOCALBASE/lib
   /usr/pkg/lib/libboost_regex.so: undefined reference to `std::ctype<char>::_M_widen_init() const@GLIBCXX_3.4.11'
   /usr/pkg/lib/libboost_regex.so: undefined reference to `std::_List_node_base::_M_unhook()@GLIBCXX_3.4.14'
   /usr/pkg/lib/libboost_regex.so: undefined reference to `std::_List_node_base::_M_transfer(std::_List_node_base*, std::_List_node_base*)@GLIBCXX_3.4.14'
   /usr/pkg/lib/libboost_regex.so: undefined reference to `std::_List_node_base::_M_hook(std::_List_node_base*)@GLIBCXX_3.4.14'
   collect2: ld returned 1 exit status

6. check rtld(1)

   $ ldd $LOCALBASE/lib/libboost_regex.so.4
   /usr/pkg/lib/libboost_regex.so.4:
           libstdc++.so.6 => /usr/pkg/lib/gcc45/libstdc++.so.6 (0x80271e000)
           libm.so.5 => /lib/libm.so.5 (0x80f5df000)
           libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x808d74000)
           libc.so.7 => /lib/libc.so.7 (0x808402000)

>Fix:
Workarounds:
- use CXX (only for -lstdc++)
- link -l<lib> directly by using `-l' linker option
- use `-rpath-link' linker option
- add search path to hints file

  # ldconfig ${LOCALBASE-/usr/local}/lib/gcc45 /lib /usr/lib ...
or
  # sed -i '' "\|_LDC.*/usr/lib|s|\"|\"${LOCALBASE-/usr/local}/lib/gcc45 |" /etc/rc.d/ldconfig
  # /etc/rc.d/ldconfig restart

but it may not work with base binutils, not sure why
>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?86y6e0jb85.fsf>