Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 473714 - <sys-libs/libselinux-2.1.13-r3 src/libselinux.pc.in missing "Libs: -lpthread"
Summary: <sys-libs/libselinux-2.1.13-r3 src/libselinux.pc.in missing "Libs: -lpthread"
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: SELinux (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Sven Vermeulen (RETIRED)
URL: http://bugs.debian.org/cgi-bin/bugrep...
Whiteboard: selinux-utils
Keywords:
: 476866 (view as bug list)
Depends on:
Blocks:
 
Reported: 2013-06-18 15:24 UTC by Lari Korpi
Modified: 2013-08-22 17:10 UTC (History)
3 users (show)

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


Attachments
Tested ebuild (libselinux-2.1.13-r3.ebuild,3.29 KB, text/plain)
2013-06-18 15:32 UTC, Lari Korpi
Details
Patch for including required line (0007-missing-dependency-on-lpthread.patch,444 bytes, patch)
2013-06-18 15:33 UTC, Lari Korpi
Details | Diff
busybox failure (busybox-build.log,450.59 KB, text/plain)
2013-06-22 20:34 UTC, Amadeusz Sławiński
Details
cryptsetup failure (cryptsetup-build.log,63.26 KB, text/plain)
2013-06-22 20:37 UTC, Amadeusz Sławiński
Details
cryptsetup failure with -lpthread in Libs.private (cryptsetup-libsprivate-build.log,63.30 KB, text/plain)
2013-06-22 20:39 UTC, Amadeusz Sławiński
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Lari Korpi 2013-06-18 15:24:49 UTC
busybox emerge failed with the errors disclosed on the URL.

Reproducible: Always

Steps to Reproduce:
1.emerge =sys-libs/libselinux-2.1.13-r2
2.emerge =sys-apps/busybox-1.20.2

Actual Results:  
/usr/lib/gcc/x86_64-linux-gnu/4.7/../../../x86_64-linux-gnu/libselinux.a(procattr.o): In function `init_procattr': (.text+0x1d8): undefined reference to `pthread_atfork'

Expected Results:  
busybog emerged

This got fixed with following patch:
libselinux-2.1.13.orig/src/libselinux.pc.in libselinux-2.1.13/src/libselinux.pc.in
--- libselinux-2.1.13.orig/src/libselinux.pc.in 2013-02-06 03:43:22.000000000 +0200
+++ libselinux-2.1.13/src/libselinux.pc.in      2013-06-18 17:59:31.018121175 +0300
@@ -8,5 +8,6 @@
 Version: @VERSION@
 URL: http://userspace.selinuxproject.org/
 Requires.private: libsepol libpcre
+Libs.private: -lpthread
 Libs: -L${libdir} -lselinux
 Cflags: -I${includedir}
Comment 1 Lari Korpi 2013-06-18 15:32:14 UTC
Created attachment 351316 [details]
Tested ebuild

I used this ebuild to apply the patch probosed
Comment 2 Lari Korpi 2013-06-18 15:33:17 UTC
Created attachment 351318 [details, diff]
Patch for including required line

This is the proposed patch as file
Comment 3 Amadeusz Sławiński 2013-06-22 12:33:36 UTC
I would like to add that there is also similar problem with cryptsetup which (inspired by this bugreport) I fixed by adding -lpthread to Libs instead of Libs.private (it still failed with this one)

emerge cryptsetup with unpatched libselinux:
libtool: link: x86_64-pc-linux-gnu-gcc -Wall -O3 -march=native -pipe -static -Wl,-O1 -o veritysetup.static veritysetup_static-utils_crypt.o veritysetup_static-utils_loop.o veritysetup_static-utils_tools.o veritysetup_static-veritysetup.o  -Wl,--as-needed ../lib/.libs/libcryptsetup.a -L/lib64 -lpopt /usr/lib64/libgcrypt.a -lgpg-error -ldevmapper -lselinux -lsepol -lpcre -ludev -lrt -luuid
/usr/lib/gcc/x86_64-pc-linux-gnu/4.7.3/../../../../x86_64-pc-linux-gnu/bin/ld: error: cannot find -lselinux
/usr/lib/gcc/x86_64-pc-linux-gnu/4.7.3/../../../../x86_64-pc-linux-gnu/bin/ld: error: cannot find -lpcre
/usr/lib/gcc/x86_64-pc-linux-gnu/4.7.3/../../../../lib64/libdevmapper.a(libdm-common.o):function _selabel_lookup: error: undefined reference to 'selabel_lookup'
/usr/lib/gcc/x86_64-pc-linux-gnu/4.7.3/../../../../lib64/libdevmapper.a(libdm-common.o):function _selabel_lookup: error: undefined reference to 'selabel_open'
/usr/lib/gcc/x86_64-pc-linux-gnu/4.7.3/../../../../lib64/libdevmapper.a(libdm-common.o):function dm_prepare_selinux_context: error: undefined reference to 'is_selinux_enabled'
/usr/lib/gcc/x86_64-pc-linux-gnu/4.7.3/../../../../lib64/libdevmapper.a(libdm-common.o):function dm_prepare_selinux_context: error: undefined reference to 'setfscreatecon'
/usr/lib/gcc/x86_64-pc-linux-gnu/4.7.3/../../../../lib64/libdevmapper.a(libdm-common.o):function dm_prepare_selinux_context: error: undefined reference to 'freecon'
/usr/lib/gcc/x86_64-pc-linux-gnu/4.7.3/../../../../lib64/libdevmapper.a(libdm-common.o):function dm_prepare_selinux_context: error: undefined reference to 'setfscreatecon'
/usr/lib/gcc/x86_64-pc-linux-gnu/4.7.3/../../../../lib64/libdevmapper.a(libdm-common.o):function dm_prepare_selinux_context: error: undefined reference to 'freecon'
/usr/lib/gcc/x86_64-pc-linux-gnu/4.7.3/../../../../lib64/libdevmapper.a(libdm-common.o):function dm_set_selinux_context: error: undefined reference to 'is_selinux_enabled'
/usr/lib/gcc/x86_64-pc-linux-gnu/4.7.3/../../../../lib64/libdevmapper.a(libdm-common.o):function dm_set_selinux_context: error: undefined reference to 'lsetfilecon'
/usr/lib/gcc/x86_64-pc-linux-gnu/4.7.3/../../../../lib64/libdevmapper.a(libdm-common.o):function dm_set_selinux_context: error: undefined reference to 'freecon'
/usr/lib/gcc/x86_64-pc-linux-gnu/4.7.3/../../../../lib64/libdevmapper.a(libdm-common.o):function dm_set_selinux_context: error: undefined reference to 'freecon'
/usr/lib/gcc/x86_64-pc-linux-gnu/4.7.3/../../../../lib64/libdevmapper.a(libdm-common.o):function selinux_release: error: undefined reference to 'selabel_close'
/usr/lib/gcc/x86_64-pc-linux-gnu/4.7.3/../../../../lib64/libudev.a(libudev_la-libudev-util.o):function util_lookup_user: warning: Using 'getpwnam_r' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/usr/lib/gcc/x86_64-pc-linux-gnu/4.7.3/../../../../lib64/libudev.a(libudev_la-libudev-util.o):function util_lookup_group: warning: Using 'getgrnam_r' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/usr/lib/gcc/x86_64-pc-linux-gnu/4.7.3/../../../../lib64/libudev.a(util.o):function lookup_uid: warning: Using 'getpwuid_r' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/usr/lib/gcc/x86_64-pc-linux-gnu/4.7.3/../../../../lib64/libudev.a(util.o):function get_user_creds: warning: Using 'getpwuid' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/usr/lib/gcc/x86_64-pc-linux-gnu/4.7.3/../../../../lib64/libudev.a(util.o):function get_user_creds: warning: Using 'getpwnam' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/usr/lib/gcc/x86_64-pc-linux-gnu/4.7.3/../../../../lib64/libudev.a(util.o):function uid_to_name: warning: Using 'getpwuid' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/usr/lib/gcc/x86_64-pc-linux-gnu/4.7.3/../../../../lib64/libudev.a(util.o):function gid_to_name: warning: Using 'getgrgid' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/usr/lib/gcc/x86_64-pc-linux-gnu/4.7.3/../../../../lib64/libudev.a(util.o):function get_group_creds: warning: Using 'getgrgid' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/usr/lib/gcc/x86_64-pc-linux-gnu/4.7.3/../../../../lib64/libudev.a(util.o):function get_group_creds: warning: Using 'getgrnam' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/usr/lib/gcc/x86_64-pc-linux-gnu/4.7.3/../../../../lib64/libudev.a(util.o):function get_home_dir: warning: Using 'getpwuid' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
collect2: error: ld returned 1 exit status
make[2]: *** [cryptsetup.static] Error 1
make[2]: *** Waiting for unfinished jobs....
/usr/lib/gcc/x86_64-pc-linux-gnu/4.7.3/../../../../x86_64-pc-linux-gnu/bin/ld: error: cannot find -lselinux
/usr/lib/gcc/x86_64-pc-linux-gnu/4.7.3/../../../../x86_64-pc-linux-gnu/bin/ld: error: cannot find -lpcre
/usr/lib/gcc/x86_64-pc-linux-gnu/4.7.3/../../../../lib64/libdevmapper.a(libdm-common.o):function _selabel_lookup: error: undefined reference to 'selabel_lookup'
/usr/lib/gcc/x86_64-pc-linux-gnu/4.7.3/../../../../lib64/libdevmapper.a(libdm-common.o):function _selabel_lookup: error: undefined reference to 'selabel_open'
/usr/lib/gcc/x86_64-pc-linux-gnu/4.7.3/../../../../lib64/libdevmapper.a(libdm-common.o):function dm_prepare_selinux_context: error: undefined reference to 'is_selinux_enabled'
/usr/lib/gcc/x86_64-pc-linux-gnu/4.7.3/../../../../lib64/libdevmapper.a(libdm-common.o):function dm_prepare_selinux_context: error: undefined reference to 'setfscreatecon'
/usr/lib/gcc/x86_64-pc-linux-gnu/4.7.3/../../../../lib64/libdevmapper.a(libdm-common.o):function dm_prepare_selinux_context: error: undefined reference to 'freecon'
/usr/lib/gcc/x86_64-pc-linux-gnu/4.7.3/../../../../lib64/libdevmapper.a(libdm-common.o):function dm_prepare_selinux_context: error: undefined reference to 'setfscreatecon'
/usr/lib/gcc/x86_64-pc-linux-gnu/4.7.3/../../../../lib64/libdevmapper.a(libdm-common.o):function dm_prepare_selinux_context: error: undefined reference to 'freecon'
/usr/lib/gcc/x86_64-pc-linux-gnu/4.7.3/../../../../lib64/libdevmapper.a(libdm-common.o):function dm_set_selinux_context: error: undefined reference to 'is_selinux_enabled'
/usr/lib/gcc/x86_64-pc-linux-gnu/4.7.3/../../../../lib64/libdevmapper.a(libdm-common.o):function dm_set_selinux_context: error: undefined reference to 'lsetfilecon'
/usr/lib/gcc/x86_64-pc-linux-gnu/4.7.3/../../../../lib64/libdevmapper.a(libdm-common.o):function dm_set_selinux_context: error: undefined reference to 'freecon'
/usr/lib/gcc/x86_64-pc-linux-gnu/4.7.3/../../../../lib64/libdevmapper.a(libdm-common.o):function dm_set_selinux_context: error: undefined reference to 'freecon'
/usr/lib/gcc/x86_64-pc-linux-gnu/4.7.3/../../../../lib64/libdevmapper.a(libdm-common.o):function selinux_release: error: undefined reference to 'selabel_close'
/usr/lib/gcc/x86_64-pc-linux-gnu/4.7.3/../../../../lib64/libudev.a(libudev_la-libudev-util.o):function util_lookup_user: warning: Using 'getpwnam_r' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/usr/lib/gcc/x86_64-pc-linux-gnu/4.7.3/../../../../lib64/libudev.a(libudev_la-libudev-util.o):function util_lookup_group: warning: Using 'getgrnam_r' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/usr/lib/gcc/x86_64-pc-linux-gnu/4.7.3/../../../../lib64/libudev.a(util.o):function lookup_uid: warning: Using 'getpwuid_r' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/usr/lib/gcc/x86_64-pc-linux-gnu/4.7.3/../../../../lib64/libudev.a(util.o):function get_user_creds: warning: Using 'getpwuid' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/usr/lib/gcc/x86_64-pc-linux-gnu/4.7.3/../../../../lib64/libudev.a(util.o):function get_user_creds: warning: Using 'getpwnam' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/usr/lib/gcc/x86_64-pc-linux-gnu/4.7.3/../../../../lib64/libudev.a(util.o):function uid_to_name: warning: Using 'getpwuid' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/usr/lib/gcc/x86_64-pc-linux-gnu/4.7.3/../../../../lib64/libudev.a(util.o):function gid_to_name: warning: Using 'getgrgid' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/usr/lib/gcc/x86_64-pc-linux-gnu/4.7.3/../../../../lib64/libudev.a(util.o):function get_group_creds: warning: Using 'getgrgid' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/usr/lib/gcc/x86_64-pc-linux-gnu/4.7.3/../../../../lib64/libudev.a(util.o):function get_group_creds: warning: Using 'getgrnam' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/usr/lib/gcc/x86_64-pc-linux-gnu/4.7.3/../../../../lib64/libudev.a(util.o):function get_home_dir: warning: Using 'getpwuid' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
collect2: error: ld returned 1 exit status
make[2]: *** [veritysetup.static] Error 1
make[2]: Leaving directory `/var/tmp/portage/sys-fs/cryptsetup-1.6.1/work/cryptsetup-1.6.1/src'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/var/tmp/portage/sys-fs/cryptsetup-1.6.1/work/cryptsetup-1.6.1'
make: *** [all] Error 2
 * ERROR: sys-fs/cryptsetup-1.6.1 failed (compile phase):
 *   emake failed
 * 
 * If you need support, post the output of `emerge --info '=sys-fs/cryptsetup-1.6.1'`,
 * the complete build log and the output of `emerge -pqv '=sys-fs/cryptsetup-1.6.1'`.
 * The complete build log is located at '/var/tmp/portage/sys-fs/cryptsetup-1.6.1/temp/build.log'.
 * The ebuild environment file is located at '/var/tmp/portage/sys-fs/cryptsetup-1.6.1/temp/environment'.
 * Working directory: '/var/tmp/portage/sys-fs/cryptsetup-1.6.1/work/cryptsetup-1.6.1'
 * S: '/var/tmp/portage/sys-fs/cryptsetup-1.6.1/work/cryptsetup-1.6.1'

>>> Failed to emerge sys-fs/cryptsetup-1.6.1, Log file:

>>>  '/var/tmp/portage/sys-fs/cryptsetup-1.6.1/temp/build.log'

 * Messages for package sys-fs/cryptsetup-1.6.1:

 * ERROR: sys-fs/cryptsetup-1.6.1 failed (compile phase):
 *   emake failed
 * 
 * If you need support, post the output of `emerge --info '=sys-fs/cryptsetup-1.6.1'`,
 * the complete build log and the output of `emerge -pqv '=sys-fs/cryptsetup-1.6.1'`.
 * The complete build log is located at '/var/tmp/portage/sys-fs/cryptsetup-1.6.1/temp/build.log'.
 * The ebuild environment file is located at '/var/tmp/portage/sys-fs/cryptsetup-1.6.1/temp/environment'.
 * Working directory: '/var/tmp/portage/sys-fs/cryptsetup-1.6.1/work/cryptsetup-1.6.1'
 * S: '/var/tmp/portage/sys-fs/cryptsetup-1.6.1/work/cryptsetup-1.6.1'
Comment 4 Sven Vermeulen (RETIRED) gentoo-dev 2013-06-22 18:55:25 UTC
(In reply to Amadeusz Sławiński from comment #3)
> I would like to add that there is also similar problem with cryptsetup which
> (inspired by this bugreport) I fixed by adding -lpthread to Libs instead of
> Libs.private (it still failed with this one)
[...]
> ld: error: cannot find -lselinux
> /usr/lib/gcc/x86_64-pc-linux-gnu/4.7.3/../../../../x86_64-pc-linux-gnu/bin/
> ld: error: cannot find -lpcre

You're saying that adding -lpthread to the Libs allowed it to find the libselinux and libpcre libraries during linking phase?
Comment 5 Amadeusz Sławiński 2013-06-22 20:34:07 UTC
Created attachment 351670 [details]
busybox failure

Ok so that it's clear, suggested approach definitely fixes busybox (attached mine failure), seems to fail in the same place.
Comment 6 Amadeusz Sławiński 2013-06-22 20:37:03 UTC
Created attachment 351672 [details]
cryptsetup failure

Seems like I can't reproduce that log with cannot find -lpcre/-lselinux

However cryptsetup fails in similar way ie:

/usr/lib/gcc/x86_64-pc-linux-gnu/4.7.3/../../../../lib64/libselinux.a(procattr.o):function init_procattr: error: undefined reference to 'pthread_atfork'
Comment 7 Amadeusz Sławiński 2013-06-22 20:39:39 UTC
Created attachment 351676 [details]
cryptsetup failure with -lpthread in Libs.private

It also fails when -lpthread is defined in Libs.private

busybox and cryptsetup build both fine for me when I add -lpthread in Libs line
Comment 8 Sven Vermeulen (RETIRED) gentoo-dev 2013-06-23 08:36:50 UTC
Should be in libselinux-2.1.13-r3
Comment 9 Sven Vermeulen (RETIRED) gentoo-dev 2013-08-22 16:29:28 UTC
Stable in tree
Comment 10 Sven Vermeulen (RETIRED) gentoo-dev 2013-08-22 17:10:46 UTC
*** Bug 476866 has been marked as a duplicate of this bug. ***