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.
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).
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 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.
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
*** Bug 486286 has been marked as a duplicate of this bug. ***