Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 429580 - x11-libs/cairo-1.12.2-r3[qt4] fails to link (underlinking, missing libstdc++ and libm)
Summary: x11-libs/cairo-1.12.2-r3[qt4] fails to link (underlinking, missing libstdc++ ...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Library (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Ben de Groot (RETIRED)
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: systemwide-gold underlinking
  Show dependency tree
 
Reported: 2012-08-02 21:57 UTC by SpanKY
Modified: 2015-09-05 07:01 UTC (History)
6 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
emerge --info (emerge-info.log,21.48 KB, text/plain)
2012-08-02 21:57 UTC, SpanKY
Details
build log (x11-libs:cairo-1.12.2-r3:20120802-215336.log,54.39 KB, text/plain)
2012-08-02 21:58 UTC, SpanKY
Details

Note You need to log in before you can comment on or make changes to this bug.
Description SpanKY gentoo-dev 2012-08-02 21:57:21 UTC
Created attachment 320126 [details]
emerge --info

libcairo.so links in some C++ code, but fails to link against libstdc++.so itself.  this leads to build failures with gold.

# emerge cairo -u
...
[ebuild     U  ] x11-libs/cairo-1.12.2-r3 [1.10.2-r2] USE="X glib opengl qt4 svg xcb (-aqua) -debug -directfb -doc (-drm) (-gallium) -openvg -static-libs" 0 kB
...
  CCLD     cairo-sphinx
/var/tmp/portage/x11-libs/cairo-1.12.2-r3/work/cairo-1.12.2/src/.libs/libcairo.so: error: undefined reference to '__gxx_personality_v0'
/var/tmp/portage/x11-libs/cairo-1.12.2-r3/work/cairo-1.12.2/src/.libs/libcairo.so: error: undefined reference to '__cxa_begin_catch'
/var/tmp/portage/x11-libs/cairo-1.12.2-r3/work/cairo-1.12.2/src/.libs/libcairo.so: error: undefined reference to '__cxa_end_catch'
/var/tmp/portage/x11-libs/cairo-1.12.2-r3/work/cairo-1.12.2/src/.libs/libcairo.so: error: undefined reference to '__cxa_rethrow'
/var/tmp/portage/x11-libs/cairo-1.12.2-r3/work/cairo-1.12.2/src/.libs/libcairo.so: error: undefined reference to 'typeinfo for std::bad_alloc'
cairo-boilerplate-qt.cpp:77: error: undefined reference to 'operator new(unsigned long)'
cairo-boilerplate-qt.cpp:77: error: undefined reference to 'operator delete(void*)'
collect2: error: ld returned 1 exit status
make[4]: *** [cairo-sphinx] Error 1
...

and indeed, if we look at the library:
# scanelf -qn /var/tmp/portage/x11-libs/cairo-1.12.2-r3/work/cairo-1.12.2/src/.libs/libcairo.so
libpthread.so.0,libpixman-1.so.0,libfontconfig.so.1,libfreetype.so.6,libEGL.so.1,libdl.so.2,libpng15.so.15,libQtGui.so.4,libQtCore.so.4,libxcb-shm.so.0,libxcb-render.so.0,libxcb.so.1,libXrender.so.1,libX11.so.6,libz.so.1,libGL.so.1,librt.so.1,libm.so.6,libgcc_s.so.1,libc.so.6  /var/tmp/portage/x11-libs/cairo-1.12.2-r3/work/cairo-1.12.2/src/.libs/libcairo.so

no libstdc++.so is listed there even though it uses such symbols:
# readelf -sW /var/tmp/portage/x11-libs/cairo-1.12.2-r3/work/cairo-1.12.2/src/.libs/libcairo.so | grep gxx
   391: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  UND __gxx_personality_v0
  5840: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  UND __gxx_personality_v0
Comment 1 SpanKY gentoo-dev 2012-08-02 21:58:23 UTC
Created attachment 320128 [details]
build log
Comment 2 Andreas K. Hüttel archtester gentoo-dev 2012-08-02 22:18:37 UTC
That's not the only issue I'd say. With gcc-4.7 and forced as-needed no-add-needed I get the following underlinking:

  CCLD   cairo-sphinx
/usr/lib/gcc/x86_64-pc-linux-gnu/4.7.1/../../../../x86_64-pc-linux-gnu/bin/ld: ../../util/cairo-script/.libs/libcairo-script-interpreter.so: undefined reference to symbol 'ceil@@GLIBC_2.2.5'
/usr/lib/gcc/x86_64-pc-linux-gnu/4.7.1/../../../../x86_64-pc-linux-gnu/bin/ld: note: 'ceil@@GLIBC_2.2.5' is defined in DSO /usr/lib64/libm.so so try adding it to the linker command line
/usr/lib64/libm.so: could not read symbols: Invalid operation
collect2: error: ld returned 1 exit status
Comment 3 Rafał Mużyło 2012-08-03 07:45:17 UTC
Part of the answer lies in src/Makefile.am, src/Makefile.sources and src/Makefile.am.features:
while the comment in the second seems out of data in regard of cairo, it's somewhat factual in regard of automake (as recently pulseaudio has added a workaround for similar issue); whether it's per design or not in automake doesn't really matter

So it seems in src/Makefile.am libcairo_cxx_la_LIBADD would be the point of fix (though perhaps it's even a real issue in automake with convenience archives).
Comment 4 Vicente Olivert Riera (RETIRED) gentoo-dev 2012-12-17 09:45:43 UTC
=x11-libs/cairo-1.12.8 still having the same behaviour as Vapier said, but at least, it doesn't fail to link.

# scanelf -qn /usr/lib/libcairo.so
libpthread.so.0,libpixman-1.so.0,libfontconfig.so.1, libfreetype.so.6,libEGL.so.1, libdl.so.2, libpng15.so.15, libQtGui.so.4, libQtCore.so.4, libxcb-shm.so.0, libxcb-render.so.0, libxcb.so.1, libXrender.so.1, libX11.so.6, libXext.so.6, libz.so.1, libGL.so.1, librt.so.1, libm.so.6, libgcc_s.so.1, libc.so.6  /usr/lib/libcairo.so

# readelf -sW /usr/lib/libcairo.so | grep gxx
    84: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  UND __gxx_personality_v0
Comment 5 Chí-Thanh Christopher Nguyễn gentoo-dev 2012-12-25 18:54:24 UTC
The issue still exists in 1.12.8 and it is a regression from 1.10.
Comment 6 Chí-Thanh Christopher Nguyễn gentoo-dev 2013-01-04 22:40:48 UTC
Reported upstream as https://bugs.freedesktop.org/show_bug.cgi?id=59038
Comment 7 Chí-Thanh Christopher Nguyễn gentoo-dev 2013-08-03 09:51:03 UTC
qt4 flag is masked so I will drop the blocker on the cairo stabilization bug.
Comment 8 Rafał Mużyło 2014-10-23 14:50:34 UTC
A little note: in 1.14.0 release notes, there's following line:
Fix broken build for Qt backend, due to missing libstdc++.
Comment 9 Nikoli 2015-05-04 12:27:47 UTC
cairo-1.14.2 is in tree, does this problem still exist in it?
Comment 10 Matt Turner gentoo-dev 2015-09-05 07:01:26 UTC
Upstream bug was fixed by

commit 2a37cbbabc00c7474be5baa25f848778b1773b2c
Author: Bryce Harrington <b.harrington@samsung.com>
Date:   Tue Jul 8 15:53:41 2014 -0700

    configure.ac: Fix broken build for Qt backend

which was in 1.14.0, so marking this fixed as well.