Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 501324 - sys-libs/libunwind-1.1[lzma] - linking fails using ld.gold (../src/.libs/libunwind-x86_64.so: undefined reference to 'lzma_stream_footer_decode')
Summary: sys-libs/libunwind-1.1[lzma] - linking fails using ld.gold (../src/.libs/libu...
Status: RESOLVED DUPLICATE of bug 444050
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: AMD64 Linux
: Normal normal (vote)
Assignee: Gentoo Toolchain Maintainers
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: systemwide-gold 461394
  Show dependency tree
 
Reported: 2014-02-14 21:06 UTC by Maks Verver
Modified: 2014-02-16 19:22 UTC (History)
2 users (show)

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


Attachments
build.log (build.log,95.41 KB, text/x-log)
2014-02-14 21:08 UTC, Maks Verver
Details
emerge --info libunwind (emerge-info.txt,5.92 KB, text/plain)
2014-02-14 21:09 UTC, Maks Verver
Details
Patch for libunwind-1.1.ebuild (libunwind-1.1-lzma-linking.patch,475 bytes, patch)
2014-02-16 01:34 UTC, Maks Verver
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Maks Verver 2014-02-14 21:06:42 UTC
Build fails in tests/ subdirectory (even when tests are not executed) because libunwind-x86_64.so is missing a dependency on liblzma.

Reproducible: Always

Steps to Reproduce:
binutils-config --linker ld.gold
USE=lzma emerge -1 libunwind
Actual Results:  
/bin/sh ../libtool --tag=CC   --mode=link x86_64-pc-linux-gnu-gcc  -O2 -pipe -fexceptions -Wall -Wsign-compare  -Wl,-O1 -Wl,--as-needed -o Gperf-simple Gperf-simple.o ../src/libunwind-x86_64.la ../src/libunwind.la 
libtool: link: x86_64-pc-linux-gnu-gcc -O2 -pipe -fexceptions -Wall -Wsign-compare -Wl,-O1 -o .libs/Gperf-simple Gperf-simple.o  -Wl,--as-needed ../src/.libs/libunwind-x86_64.so ../src/.libs/libunwind.so
../src/.libs/libunwind-x86_64.so: error: undefined reference to 'lzma_stream_footer_decode'
../src/.libs/libunwind-x86_64.so: error: undefined reference to 'lzma_index_buffer_decode'
../src/.libs/libunwind-x86_64.so: error: undefined reference to 'lzma_index_size'
../src/.libs/libunwind-x86_64.so: error: undefined reference to 'lzma_index_end'
../src/.libs/libunwind-x86_64.so: error: undefined reference to 'lzma_index_uncompressed_size'
../src/.libs/libunwind-x86_64.so: error: undefined reference to 'lzma_stream_buffer_decode'
collect2: error: ld returned 1 exit status
Makefile:683: recipe for target 'Gperf-simple' failed
make[1]: *** [Gperf-simple] Error 1
make[1]: Leaving directory '/var/tmp/portage/sys-libs/libunwind-1.1/work/libunwind-1.1/tests'
Makefile:476: recipe for target 'all-recursive' failed
make: *** [all-recursive] Error 1
Comment 1 Maks Verver 2014-02-14 21:08:16 UTC
Created attachment 370430 [details]
build.log
Comment 2 Maks Verver 2014-02-14 21:09:18 UTC
Created attachment 370432 [details]
emerge --info libunwind
Comment 3 Samuli Suominen (RETIRED) gentoo-dev 2014-02-14 23:32:05 UTC
sort of 2 issues here:

tests are restricted in the ebuild due to other issues, so it shouldn't even build the tests/ subdirectory where the failure is
but of course, it should still build, so proper linking is required
Comment 4 Alex Xu (Hello71) 2014-02-15 00:37:34 UTC
underlinking problem?
Comment 5 Maks Verver 2014-02-15 20:57:58 UTC
(In reply to Alex Xu (Hello71) from comment #4)
> underlinking problem?

Yes, but it's not 100% clear where it comes from.  Running autoreconf in the source directory before building seems to fix it, but I'm not sure why.

That way, libtool eventually calls the linker as follows:

     gcc -O2 -pipe -fexceptions -Wall -Wsign-compare -Wl,-O1 -Wl,--as-needed -o .libs/test-coredump-unwind test-coredump-unwind.o  ../src/.libs/libunwind-coredump.so ../src/.libs/libunwind-x86_64.so /home/maks/test/libunwind-1.1/src/.libs/libunwind.so -lgcc -llzma -lc

... without running autoreconf, -lgcc and -llzma are missing from that command, but I'm not sure yet what happens between autoconf and linking that causes this.

By the way, the ebuild currently contains this line:

   sed -i -e '/LIBLZMA/s:-lzma:-llzma:' configure{,.ac} || die #444050

.. however, this is a red herring. Although this does fix a typo, LIBLZMA is actually not used anywhere; the configure code that sets LIBLZMA also sets HAVE_LZMA and that is what is used in src/Makefile.am.

So the analysis at Bug #444050 (fix the typo, then rerun autoreconf) is wrong: fixing the typo doesn't matter, it's running autoreconf that fixes the problem.   Editing the configure script directly (to avoid having to rerun autoconf) does not fix the problem.
Comment 6 SpanKY gentoo-dev 2014-02-16 01:13:02 UTC

*** This bug has been marked as a duplicate of bug 444050 ***
Comment 7 Maks Verver 2014-02-16 01:34:42 UTC
Created attachment 370530 [details, diff]
Patch for libunwind-1.1.ebuild

Turns out autoreconf fixes the problem because Gentoo's aclocal sets the libtool parameter link_all_deplibs to `unknown` while the bundled aclocal.m4 has it set to `no`, which arguably is an upstream bug (either libunwind-x86_64.la should include -llzma as a dependency, or link_all_deplibs should be `yes`, so that the dependency gets picked up recursively from libunwind.la.)

Attached patch fixes the problem by removing the link_all_deplibs...=no lines, which resolves my issue and I think also fixes bug #444050 (which I don't think was actually solved before).
Comment 8 SpanKY gentoo-dev 2014-02-16 03:02:43 UTC
(In reply to Maks Verver from comment #7)

i don't think that is the correct fix.  see the patch i committed.
Comment 9 Maks Verver 2014-02-16 19:22:18 UTC
(In reply to SpanKY from comment #8)
> (In reply to Maks Verver from comment #7)
> 
> i don't think that is the correct fix.  see the patch i committed.

Even better.  Thanks.  (I hope upstream fixes this in Makefile.am at some point, otherwise you have to keep editing the Makefile templates, which is still pretty hackish.)