Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 301002

Summary: media-gfx/pngnq-1.0: fails with forced --as-needed
Product: Gentoo Linux Reporter: Diego Elio Pettenò (RETIRED) <flameeyes>
Component: New packagesAssignee: Hanno Böck <hanno>
Status: RESOLVED FIXED    
Severity: QA CC: xarthisius
Priority: High    
Version: unspecified   
Hardware: All   
OS: Linux   
URL: http://www.gentoo.org/proj/en/qa/asneeded.xml
Whiteboard:
Package list:
Runtime testing required: ---
Bug Depends on:    
Bug Blocks: 129413    
Attachments: Build log
adding patch to ebuild and running autotools
fixing as-needed issues
fixing as-needed issues

Description Diego Elio Pettenò (RETIRED) gentoo-dev 2010-01-14 16:13:22 UTC
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.

Thanks,
Diego
Comment 1 Diego Elio Pettenò (RETIRED) gentoo-dev 2010-01-14 16:14:24 UTC
Created attachment 216510 [details]
Build log
Comment 2 Kacper Kowalik (Xarthisius) (RETIRED) gentoo-dev 2010-01-14 17:15:57 UTC
Created attachment 216517 [details, diff]
adding patch to ebuild and running autotools
Comment 3 Kacper Kowalik (Xarthisius) (RETIRED) gentoo-dev 2010-01-14 17:16:12 UTC
Created attachment 216518 [details, diff]
fixing as-needed issues
Comment 4 Hanno Böck gentoo-dev 2010-01-16 17:07:31 UTC
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?

+AC_SEARCH_LIBS([gzopen],[z])
+AC_SEARCH_LIBS([pow],[m])
Same for this.

Also, did you send your patch to the upstream developers?
Comment 5 Kacper Kowalik (Xarthisius) (RETIRED) gentoo-dev 2010-01-16 17:25:39 UTC
(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.

> +AC_SEARCH_LIBS([gzopen],[z])
-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
AC_SEARCH_LIBS([zlibVersion],[z])
instead of gzopen

> +AC_SEARCH_LIBS([pow],[m])
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.

Comment 6 Kevin Pyle 2010-01-16 18:37:45 UTC
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.
Comment 7 Kacper Kowalik (Xarthisius) (RETIRED) gentoo-dev 2010-01-16 19:12:32 UTC
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.
Comment 8 Hanno Böck gentoo-dev 2010-01-17 22:47:29 UTC
committed and sent upstream, thanks.