Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 286662 - [patch] media-sound/shell-fm-0.7 fails with --as-needed
Summary: [patch] media-sound/shell-fm-0.7 fails with --as-needed
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Gentoo Sound Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: as-needed
  Show dependency tree
 
Reported: 2009-09-27 12:59 UTC by Marco Leogrande
Modified: 2009-11-24 14:08 UTC (History)
0 users

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


Attachments
Patch the Makefile to allow compilation with --as-needed (shell-fm-0.7-asneeded.patch,365 bytes, patch)
2009-09-27 13:04 UTC, Marco Leogrande
Details | Diff
Patch shell-fm-0.7.ebuild to use the previous patch (shell-fm-0.7.ebuild.patch,687 bytes, patch)
2009-09-27 13:05 UTC, Marco Leogrande
Details | Diff
Revised patch to allow compilation with --as-needed (shell-fm-0.7-asneeded.patch,1.15 KB, patch)
2009-09-28 19:19 UTC, Marco Leogrande
Details | Diff
Patch to allow compilation with --as-needed, using standard naming conventions (shell-fm-0.7-asneeded.patch,1.13 KB, patch)
2009-09-29 10:39 UTC, Marco Leogrande
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Marco Leogrande 2009-09-27 12:59:55 UTC
media-sound/shell-fm-0.7 fails compilation if linked if --as-needed, with an error like:

i686-pc-linux-gnu-gcc -o shell-fm -march=native -O2 -pipe -fomit-frame-pointer -march=native -O2 -pipe -fomit-frame-pointer -Wall -W -I./include/ -DLIBAO     main.c -Wl,--as-needed -lmad -lm   -lao -lpthread -ldl   libshellfm.a
libshellfm.a(play.o): In function `input':
play.c:(.text+0x26a): undefined reference to `mad_stream_buffer'
libshellfm.a(play.o): In function `playback':
play.c:(.text+0x57d): undefined reference to `ao_default_driver_id'
[.. other linking problems ...]

As suggested in http://www.gentoo.org/proj/en/qa/asneeded.xml#doc_chap2 , I have reordered the linker parameters and now the package compiles fine. I'll attach the Makefile and the ebuild patches in a few minutes.
Comment 1 Marco Leogrande 2009-09-27 13:04:41 UTC
Created attachment 205374 [details, diff]
Patch the Makefile to allow compilation with --as-needed
Comment 2 Marco Leogrande 2009-09-27 13:05:49 UTC
Created attachment 205375 [details, diff]
Patch shell-fm-0.7.ebuild to use the previous patch
Comment 3 Diego Elio Pettenò (RETIRED) gentoo-dev 2009-09-28 16:45:02 UTC
Comment on attachment 205374 [details, diff]
Patch the Makefile to allow compilation with --as-needed

This patch is wrong, please read the asneeded fixing guide ( http://www.gentoo.org/proj/en/qa/asneeded.xml ) for the proper order of parameters: ldflags should _not_ be at the end!
Comment 4 Marco Leogrande 2009-09-28 19:18:35 UTC
The problem is that the package Makefile handles $LDFLAGS and libraries together. I therefore suggest another, bigger patch that might solve the problem more cleanly.
Comment 5 Marco Leogrande 2009-09-28 19:19:27 UTC
Created attachment 205521 [details, diff]
Revised patch to allow compilation with --as-needed
Comment 6 Diego Elio Pettenò (RETIRED) gentoo-dev 2009-09-28 19:21:39 UTC
Yup, that's the correct one; although I would suggest for the future (and to send this upstream) to use the LDLIBS variable (it's a default in make for the libraries).
Comment 7 Marco Leogrande 2009-09-29 10:39:17 UTC
Created attachment 205574 [details, diff]
Patch to allow compilation with --as-needed, using standard naming conventions

OK :)
A little sed magic (not that difficult) and the patch uses LDLIBS...
Comment 8 Marco Leogrande 2009-10-06 19:49:07 UTC
The patch has been accepted upstream, so the correct behavior should show up with the next release.
Comment 9 Diego Elio Pettenò (RETIRED) gentoo-dev 2009-11-24 14:08:18 UTC
Thanks Marco, committed now.