device-mapper ebuild fails with unresolved symbols with --as-needed and --no-undefined The problem is that the one of the makefiles puts the libraries before the regular objects on the link command line. --as-needed seems to scan the command line from left to right, so it ends up stripping out all the libraries that the regular objects reference. Luckily, I have --no-undefined in my linker options, and this caught the problem. Here is a patch for Makefile.in, which fixes the problem, and also a patch for the device-mapper-1.02.28.ebuild, to apply the patch. Reproducible: Always Steps to Reproduce: 1. add --as-needed and --no-undefined to your linker options 2. emerge device-mapper 3. observe stream of undefined reference errors. Actual Results: emerge fails with unsuccessful link step for libdevmapper-event.so Expected Results: successful emerge Not sure if this is a bug in the makefile or in the linker. Maybe --as-needed shouldn't be so picky about the order. Either way, it's gotta go upstream. In the meantime, these patches should make it work.
Created attachment 182518 [details, diff] Makefile patch to fix link order
Created attachment 182520 [details, diff] ebuild patch to apply makefile patch
The patch looks good to me.
+ 21 Dec 2009; Samuli Suominen <ssuominen@gentoo.org> + device-mapper-1.02.28.ebuild, +files/device-mapper-1.02.28-asneeded.patch: + Fix building with -Wl,--as-needed wrt #259569 by James C. Georgas.