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

Bug 246902

Summary: app-misc/beanstalkd: fails with forced --as-needed
Product: Gentoo Linux Reporter: Diego Elio Pettenò (RETIRED) <flameeyes>
Component: New packagesAssignee: Caleb Tennis (RETIRED) <caleb>
Status: RESOLVED FIXED    
Severity: normal    
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
Patch to beanstalkd-1.0.ebuild to fix several QA issues in upstream Makefile

Description Diego Elio Pettenò (RETIRED) gentoo-dev 2008-11-15 14:31: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).

Check the attached build log.

Thanks,
Diego
Comment 1 Diego Elio Pettenò (RETIRED) gentoo-dev 2008-11-15 14:31:33 UTC
Created attachment 171853 [details]
Build log
Comment 2 Caleb Tennis (RETIRED) gentoo-dev 2008-11-23 23:50:45 UTC
Note to self: this seems to get fixed by moving -levent to the end of the link line

cc -Wl,-O1 -levent  beanstalkd.o conn.o job.o ms.o net.o pq.o prot.o tube.o util.o   -o beanstalkd

becomes

cc -Wl,-O1 beanstalkd.o conn.o job.o ms.o net.o pq.o prot.o tube.o util.o   -o beanstalkd -levent
Comment 3 Kevin Pyle 2009-02-14 21:08:41 UTC
Created attachment 182052 [details, diff]
Patch to beanstalkd-1.0.ebuild to fix several QA issues in upstream Makefile

This patch modifies the ebuild to fix several QA issues in the upstream Makefile.  The upstream Makefile does not set CC, nor does its build system have a way to determine the correct compiler name.  To address this, the patch adds a tc-export CC, as recommended in Diego's bug reports about various packages not respecting CC.  Next, as reported here, linking fails with --as-needed because the library is listed too early.  A sed transform replaces the assignment to LDFLAGS with one to LDLIBS, which resolves this issue.  Finally, though not specifically a QA issue, this patch changes a CFLAGS assignment in the upstream Makefile.  Originally, it did:

CFLAGS := $(CFLAGS) -O2

This forced the package to compile with -O2, without regard to what the user put in CFLAGS in /etc/make.conf.  The sed expression changes it to:

CFLAGS := -O2 $(CFLAGS)

This keeps -O2 as a default if one is not specified, but allows CFLAGS from the user to choose a different optimization level if desired.

(In reply to comment #2)
Yes, that is the typical solution to this type of bug.
Comment 4 Diego Elio Pettenò (RETIRED) gentoo-dev 2009-06-02 10:40:21 UTC
Given 1.2 uses autotools (and does not fail) I'd say this is done for. Thanks anyway Kevin! :)