Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 248163 - net-print/ink: fails with forced --as-needed
Summary: net-print/ink: fails with forced --as-needed
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: New packages (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Printing Team
URL: http://www.gentoo.org/proj/en/qa/asne...
Whiteboard:
Keywords:
Depends on: 204248
Blocks: as-needed
  Show dependency tree
 
Reported: 2008-11-22 12:13 UTC by Diego Elio Pettenò (RETIRED)
Modified: 2010-01-15 14:37 UTC (History)
1 user (show)

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


Attachments
Build log (ink-0.4.1:20081122-120721.log,1.65 KB, text/plain)
2008-11-22 12:14 UTC, Diego Elio Pettenò (RETIRED)
Details
Patch to fix CFLAGS override and failure to link with --as-needed (ink-as-needed.patch,341 bytes, patch)
2009-01-17 18:48 UTC, Kevin Pyle
Details | Diff
Build log (ink-0.5.0:20091227-033558.log,2.05 KB, text/plain)
2009-12-27 13:44 UTC, Diego Elio Pettenò (RETIRED)
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Diego Elio Pettenò (RETIRED) gentoo-dev 2008-11-22 12:13:41 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).

Check the attached build log.

Thanks,
Diego
Comment 1 Diego Elio Pettenò (RETIRED) gentoo-dev 2008-11-22 12:14:06 UTC
Created attachment 172837 [details]
Build log
Comment 2 Kevin Pyle 2009-01-17 18:48:16 UTC
Created attachment 178806 [details, diff]
Patch to fix CFLAGS override and failure to link with --as-needed

This is the typical problem of placing the library list before the objects that require the symbols.  The upstream Makefile placed the library list in $CFLAGS, which happened to work since only one file is compiled, and it is compiled directly from ink.c to an output file, bypassing creation of ink.o.

This patch drops the overwrite of CFLAGS, so that the Makefile will honor user CFLAGS, and adds -linklevel to LDLIBS, which a quick check with "make -n -p" shows is used in the correct place in the implicit rule that make uses to compile a .c file directly to an output file.
Comment 3 Diego Elio Pettenò (RETIRED) gentoo-dev 2009-06-02 13:20:52 UTC
Actually the patch is perfectly good so I'll just apply it even if I can't seem to build it. Thanks Kevin!
Comment 4 Diego Elio Pettenò (RETIRED) gentoo-dev 2009-12-27 13:44:25 UTC
Reopening bug because Thilo dropped the patch.
Comment 5 Diego Elio Pettenò (RETIRED) gentoo-dev 2009-12-27 13:44:46 UTC
Created attachment 214294 [details]
Build log
Comment 6 Thilo Bangert (RETIRED) (RETIRED) gentoo-dev 2010-01-02 12:13:44 UTC
(In reply to comment #4)
> Reopening bug because Thilo dropped the patch.
> 

hhm, weird. it worked for me and i have --as-needed turned on.
nevertheless, the usage of CFLAGS is strange. i added a similar patch to 0.5.0 - could you test if it makes your build failure go away?

thanks
Thilo
Comment 7 Kevin Pyle 2010-01-02 18:36:45 UTC
(In reply to comment #6)
> hhm, weird. it worked for me and i have --as-needed turned on.

Do you have it via LDFLAGS in /etc/make.conf, or via the "forced" --as-needed that Diego uses?  net-print/ink-0.5.0 as shipped (without any Gentoo patches) has a Makefile that would not exhibit problems for LDFLAGS-based as-needed:

> make -n LDFLAGS=--as-needed
gcc -Wall -O2 -linklevel  --as-needed  ink.c   -o ink

Since the --as-needed appears after -linklevel, libinklevel will be brought in regardless of whether there is any need for it, so the build will succeed.  If I recall correctly, Diego's "forced" --as-needed not only guarantees its use, but places it before any other flags, so his command line is effectively:

gcc --as-needed -Wall -O2 -linklevel   ink.c   -o ink
Comment 8 Thilo Bangert (RETIRED) (RETIRED) gentoo-dev 2010-01-15 13:13:35 UTC
flameeyes: could you run ink-0.5.0 on the tinderbox and verify that this issue is resolved?

thanks
Comment 9 Diego Elio Pettenò (RETIRED) gentoo-dev 2010-01-15 14:37:55 UTC
Given it merged fine it seems good to go now.