Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 484560 - sys-apps/busybox-1.20.2[static,selinux]: link fails due to "-l-pthread" from pkgconfig
Summary: sys-apps/busybox-1.20.2[static,selinux]: link fails due to "-l-pthread" from ...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Embedded Gentoo Team
URL: http://lists.busybox.net/pipermail/bu...
Whiteboard:
Keywords:
: 486286 (view as bug list)
Depends on:
Blocks:
 
Reported: 2013-09-11 08:34 UTC by thaehaid
Modified: 2013-09-30 06:43 UTC (History)
3 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
Updated busybox-1.20.2-selinux-pkg-config.patch (busybox-1.20.2-selinux-pkg-config.patch,1.97 KB, patch)
2013-09-11 08:38 UTC, thaehaid
Details | Diff
Patch against the portage tree (busybox_1.20.2.USE_static_selinux.patch,879 bytes, patch)
2013-09-11 08:48 UTC, thaehaid
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
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. ***