[Bug 236676] lang/gcc8: Loader picks up wrong libstc++.so

bugzilla-noreply at freebsd.org bugzilla-noreply at freebsd.org
Thu Mar 21 01:13:09 UTC 2019


https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=236676

            Bug ID: 236676
           Summary: lang/gcc8: Loader picks up wrong libstc++.so
           Product: Ports & Packages
           Version: Latest
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Many People
          Priority: ---
         Component: Individual Port(s)
          Assignee: gerald at FreeBSD.org
          Reporter: peter.henderson at ieee.org
          Assignee: gerald at FreeBSD.org
             Flags: maintainer-feedback?(gerald at FreeBSD.org)
 Attachment #203017 text/plain
         mime type:

Created attachment 203017
  --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=203017&action=edit
Program where incorrect libstdc++ causes a failure.

I'm not sure who's responsibility this is, but as it can effect any gcc8 user,
I am reporting it here.

The loader is picking up /usr/local/lib/compat/libstdc++.so.6,rather than
/usr/local/lib/gcc8/libstdc++.so.6.0.25.

"pkg which /usr/local/lib/compat/libstdc++.so.6" outputs:
/usr/local/lib/compat/libstdc++.so.6 was installed by package
compat9x-amd64-9.3.903000.20170608

As a result, my test program "./gcc-ld-test" outputs:                           
/usr/local/lib/compat/libstdc++.so.6: version GLIBCXX_3.4.11 required by
/usr/home/peterh/ieee-754/test/gcc-ld-test not found

"ldd ./gcc-ld-test" outputs:
./gcc-ld-test:
        libstdc++.so.6 => /usr/local/lib/compat/libstdc++.so.6 (0x800837000)
        libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x800b3e000)
        libc.so.7 => /lib/libc.so.7 (0x800d4d000)
        libm.so.5 => /lib/libm.so.5 (0x801109000)

gcc-ld-test was compiled using:
gcc8 -D BAD_LD -lstdc++ -o gcc-ld-test gcc-ld-test.cpp

The -D BAD_LD turns on the failure.  I.e. without "-D BAD_LD" the program still
need libstdc++ and still loads /usr/local/lib/compat/libstdc++.so.6, but runs
without any problems.  The problem is triggered when I use boost format.

"pkg version" outputs:
gcc8-8.3.0                         =
compat9x-amd64-9.3.903000.20170608 ?
boost-libs-1.69.0_1                =

"uname -a" outputs:
FreeBSD 11.2-RELEASE-p9 #0 r343989: Mon Feb 11 17:52:41 AEDT 2019    
root at hydrogen:/usr/obj/usr/src/sys/GENERIC  amd64

I was able to fix the problem, and hence run my program in one of two ways:

1) Use:
gcc8 -D BAD_LD -o gcc-ld-test gcc-ld-test.cpp /usr/local/lib/gcc8/libstdc++.a
The program then works and
"ldd ./gcc-ld-test" outputs:
./gcc-ld-test:
        libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x8008ef000)
        libc.so.7 => /lib/libc.so.7 (0x800afe000)

2) Use:
gcc8 -D BAD_LD -rpath=/usr/local/lib/gcc8 -lstdc++ -o gcc-ld-test gcc-ld-test
Again the program works and 
"ldd ./gcc-ld-test" outputs:
./gcc-ld-test:
        libstdc++.so.6 => /usr/local/lib/gcc8/libstdc++.so.6 (0x800822000)
        libc.so.7 => /lib/libc.so.7 (0x800bb7000)
        libm.so.5 => /lib/libm.so.5 (0x800f73000)
        libgcc_s.so.1 => /usr/local/lib/gcc8/libgcc_s.so.1 (0x8011a0000)

-- 
You are receiving this mail because:
You are the assignee for the bug.


More information about the freebsd-ports-bugs mailing list