Summary: | net-print/ink: fails with forced --as-needed | ||
---|---|---|---|
Product: | Gentoo Linux | Reporter: | Diego Elio Pettenò (RETIRED) <flameeyes> |
Component: | New packages | Assignee: | Printing Team <printing> |
Status: | RESOLVED FIXED | ||
Severity: | normal | CC: | bangert |
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: | 204248 | ||
Bug Blocks: | 129413 | ||
Attachments: |
Build log
Patch to fix CFLAGS override and failure to link with --as-needed Build log |
Description
Diego Elio Pettenò (RETIRED)
![]() Created attachment 172837 [details]
Build log
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]
Build log
(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 (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? thanks Given it merged fine it seems good to go now. |