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

Bug 195132

Summary: net-p2p/btpd-0.13 fails to compile with --as-needed
Product: Gentoo Linux Reporter: Hopeless <hopeless>
Component: Current packagesAssignee: Gentoo net-p2p team <net-p2p>
Status: RESOLVED FIXED    
Severity: normal CC: coldwind, flameeyes, Ricardo.Cordeiro, Sander.Sweers
Priority: High    
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---
Bug Depends on:    
Bug Blocks: 129413    
Attachments: btpd-0.13-as-needed.patch
btpd-0.13 ebuild with coldwind's patch applied
Makefile.in --as-needed patch
Ebuild patch
New btpd-0.13.ebuild patch

Description Hopeless 2007-10-08 17:30:44 UTC
When emergeing net-p2p/btpd-0.13 with "-Wl,--as-needed" in LDFLAGS, it fals with the following; 
x86_64-pc-linux-gnu-gcc  -O2 -march=athlon64 -msse3 -pipe -std=c99  -Wl,--as-needed -o btpd -lcrypto -lm btpd-active.o btpd-btpd.o btpd-cli_if.o btpd-content.o btpd-download.o btpd-download_subr.o btpd-http_tr_if.o btpd-main.o btpd-net.o btpd-net_buf.o btpd-opts.o btpd-peer.o btpd-tlib.o btpd-torrent.o btpd-tracker_req.o btpd-upload.o btpd-util.o ../misc/libmisc.a ../libevent/libevent.a 
btpd-content.o: In function `cm_create':
content.c:(.text+0x1ec): undefined reference to `ceil'
content.c:(.text+0x22c): undefined reference to `ceil'
btpd-content.o: In function `cm_put_bytes':
content.c:(.text+0x87f): undefined reference to `ceil'
btpd-content.o: In function `startup_test_end':
content.c:(.text+0xc4a): undefined reference to `ceil'
btpd-content.o: In function `cm_start':
content.c:(.text+0x1133): undefined reference to `ceil'
btpd-download_subr.o:download_subr.c:(.text+0x32b): more undefined references to `ceil' follow
../misc/libmisc.a(libmisc_a-metainfo.o): In function `mi_info_hash':
metainfo.c:(.text+0x483): undefined reference to `SHA1'
../misc/libmisc.a(libmisc_a-stream.o): In function `bts_sha':
stream.c:(.text+0x4df): undefined reference to `SHA1_Init'
stream.c:(.text+0x52a): undefined reference to `SHA1_Update'
stream.c:(.text+0x53b): undefined reference to `SHA1_Final'
../misc/libmisc.a(libmisc_a-subr.o): In function `rand_between':
subr.c:(.text+0x713): undefined reference to `rint'
collect2: ld returned 1 exit status
make[1]: *** [btpd] Error 1
make[1]: Leaving directory `/var/tmp/portage/net-p2p/btpd-0.13/work/btpd-0.13/btpd'
make: *** [all-recursive] Error 1

Remove --as-needed and it compiles fine.

This is on hardened amd64, however I get the same results with vanilla gcc 3.4.

Reproducible: Always
Comment 1 Santiago M. Mola (RETIRED) gentoo-dev 2007-10-08 19:25:56 UTC
Created attachment 132957 [details, diff]
btpd-0.13-as-needed.patch

This patch fixes the problem. It's backported from svn trunk.
Comment 2 Hopeless 2008-05-05 18:57:07 UTC
Created attachment 151963 [details]
btpd-0.13 ebuild with coldwind's patch applied

This is still an issue, and 0.13 is still the latest release, however the patch coldwind posted fixes it, so I've attached an updated ebuild which applies the patch.
Comment 3 Diego Elio Pettenò (RETIRED) gentoo-dev 2008-06-07 12:42:29 UTC
The source patch is correct, the ebuild is not, though. After the patch has been applied, eautomake from autotools.eclass should be called to rebuild all autotools. If it works its just because maintainer mode kicks in, but that's not good (see "Errors in build phase about autoconf version" in http://www.gentoo.org/proj/en/qa/autofailure.xml).
Comment 4 Sander Sweers 2009-04-22 14:40:31 UTC
Created attachment 189153 [details, diff]
Makefile.in --as-needed patch

Patching Makefile.in
Comment 5 Sander Sweers 2009-04-22 14:43:20 UTC
Created attachment 189154 [details, diff]
Ebuild patch

This implements what Diego was talking about.
* Add src_unpack
* patch Makefile.in
* call eautomake
Comment 6 Sander Sweers 2009-04-22 14:44:56 UTC
I just attached 2 new patches to fix the bug. I'll leave it to the maintainer to submit upstream.
Comment 7 Sander Sweers 2009-04-22 16:51:05 UTC
Comment on attachment 189153 [details, diff]
Makefile.in --as-needed patch

This is wrong :( Use the original patch.
Comment 8 Sander Sweers 2009-04-22 16:56:11 UTC
Created attachment 189181 [details, diff]
New btpd-0.13.ebuild patch

Oops. it needs WANT_AUTOMAKE="1.9".
Comment 9 Diego Elio Pettenò (RETIRED) gentoo-dev 2009-06-02 10:59:26 UTC
Fixed with a bump to 0.15; thanks anyway Sander!
Comment 10 Diego Elio Pettenò (RETIRED) gentoo-dev 2009-06-02 11:34:43 UTC
*** Bug 248148 has been marked as a duplicate of this bug. ***