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.
Created attachment 172837 [details]
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.
Actually the patch is perfectly good so I'll just apply it even if I can't seem to build it. Thanks Kevin!
Reopening bug because Thilo dropped the patch.
Created attachment 214294 [details]
(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?
(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
flameeyes: could you run ink-0.5.0 on the tinderbox and verify that this issue is resolved?
Given it merged fine it seems good to go now.