I'm reporting this bug because the package in summary fails to build when forcing --as-needed on through spec files (check out http://blog.flameeyes.eu/2008/11/14/problems-and-mitigation-strategies-for-as-needed for details).
Please note that this bug _might_ apply to -Wl,--as-needed in LDFLAGS as well; in both cases it should be fixed. Also, if this is due to the package in question not respecting user-defined LDFLAGS, you should get to fix that too.
Check the attached build log.
Created attachment 216510 [details]
Created attachment 216517 [details, diff]
adding patch to ebuild and running autotools
Created attachment 216518 [details, diff]
fixing as-needed issues
Thanks for your patch, though some questions, I don't understand all of it:
-SUBDIRS = freegetopt src
+SUBDIRS = src
What's that supposed to do? Does it have to do anything with --as-needed?
Same for this.
Also, did you send your patch to the upstream developers?
(In reply to comment #4)
> -SUBDIRS = freegetopt src
> +SUBDIRS = src
Freegetopt dir is empty so it's not necessary. However if it wasn't it would bundle lib that is provided by core system packages. We should always use system-wide libraries in favour of bundled ones in order to prevent security issues. I've removed it from build system as a preemptive measure.
-lz was needlessly hardcoded in Makefile.am and in wrong place
apart from that:
rwpng.c:(.text+0xbe4): undefined reference to `zlibVersion'
Maybe it would be better to change it to
instead of gzopen
pngcomp.c:(.text+0x251): undefined reference to `sqrt'
AC_SEARCH_LIBS appends libs to LIBS variable, which is used in correct order during linking. That automatically fixes most as-needed issues.
> Also, did you send your patch to the upstream developers?
No, I didn't.
The change to src/Makefile.am drops -Wall, --pedantic, and -std=gnu99. I can understand dropping -Wall, since most Gentoo users will not be reading the warnings. Did you intend to drop -std=gnu99 though? In gcc 4.3, the default is gnu89, with the note that it will be changed to gnu99 in a future release.
Created attachment 216695 [details, diff]
fixing as-needed issues
(In reply to comment #6)
> The change to src/Makefile.am drops -Wall, --pedantic, and -std=gnu99.
Clearly that was my mistake. I thought that those flags are not necessary, which may not always be the case. Thanks for pointing that out.
I've also corrected SEARCH_LIBS to look for func actually used by package instead of random ones.
committed and sent upstream, thanks.