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

Bug 484560

Summary: sys-apps/busybox-1.20.2[static,selinux]: link fails due to "-l-pthread" from pkgconfig
Product: Gentoo Linux Reporter: thaehaid
Component: [OLD] Core systemAssignee: Embedded Gentoo Team <embedded>
Status: RESOLVED FIXED    
Severity: normal CC: f.baart, lukas.durdak, thaehaid
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
URL: http://lists.busybox.net/pipermail/busybox/2013-September/079738.html
Whiteboard:
Package list:
Runtime testing required: ---
Attachments: Updated busybox-1.20.2-selinux-pkg-config.patch
Patch against the portage tree

Description thaehaid 2013-09-11 08:34:22 UTC
From version 1.20.2 busybox gets libraries to link against via pkgconfig. When compiling static busybox on system with SElinux (USE="static selinux"), busybox build system runs:

pkg-config --static --libs libselinux

It returns:

-lselinux -lpthread -lsepol -lpcre -pthread

Busybox build system tries "-pthread" as a library name, converts it into LDFLAGS option "-l-pthread", and the whole thing fails while linking the final binary:

Trying libraries: -pthread crypt m pcre pthread selinux sepol
Failed: -Wl,--start-group -l-pthread -lcrypt -lm -lpcre -lpthread -lselinux -lsepol -Wl,--end-group

Maintainer has to edit busybox-1.20.2-selinux-pkg-config.patch to include smarter logic (namely invoking pkgconfig with "--libs-only-l" extra parameter). I'll attach updated busybox-1.20.2-selinux-pkg-config.patch in the next comment.
Comment 1 thaehaid 2013-09-11 08:38:11 UTC
Created attachment 358462 [details, diff]
Updated busybox-1.20.2-selinux-pkg-config.patch

This is not a patch against the busybox sourcecode, this is an updated busybox patch from ebuild system. In order words, you'd need to overwrite existing /usr/portage/sys-apps/busybox/files/busybox-1.20.2-selinux-pkg-config.patch with this one (and also update the Manifest, if you want to compile).
Comment 2 thaehaid 2013-09-11 08:48:01 UTC
Created attachment 358466 [details, diff]
Patch against the portage tree

Ok, here's the patch against the actual portage tree in /usr/portage, it shows the change needed.
Comment 3 SpanKY gentoo-dev 2013-09-12 04:28:08 UTC
Comment on attachment 358462 [details, diff]
Updated busybox-1.20.2-selinux-pkg-config.patch

we should fix the trylink script instead.  -pthread (and other flags) are valid at link time.
Comment 4 SpanKY gentoo-dev 2013-09-29 00:55:58 UTC
should be all set now in the tree; thanks for the report!

Commit message: Fix static linking against selinux
http://sources.gentoo.org/sys-apps/busybox/busybox-1.21.1.ebuild?r1=1.1&r2=1.2
http://sources.gentoo.org/sys-apps/busybox/files/busybox-1.21.1-trylink-only-prefix-libs-with-l.patch?rev=1.1
Comment 5 SpanKY gentoo-dev 2013-09-30 06:43:29 UTC
*** Bug 486286 has been marked as a duplicate of this bug. ***