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

Bug 481782

Summary: <sys-libs/libsepol-2.1.9-r3 wrong 'pkg-config --libs' contents
Product: Gentoo Linux Reporter: Dennis Freise <dennis.freise>
Component: SELinuxAssignee: Sven Vermeulen (RETIRED) <swift>
Status: RESOLVED FIXED    
Severity: normal CC: freedesktop-bugs, jdhore, nenolod, selinux
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
See Also: https://bugs.gentoo.org/show_bug.cgi?id=502544
Whiteboard: selinux-utils
Package list:
Runtime testing required: ---

Description Dennis Freise 2013-08-20 19:47:34 UTC
While trying to build busybox-1.21.1, I stumbled upon this error:

----------------

Trying libraries: crypt -L/usr/lib m pcre pthread selinux sepol
Failed: -Wl,--start-group -lcrypt -l-L/usr/lib -lm -lpcre -lpthread -lselinux -lsepol -Wl,--end-group
Output of:
x86_64-pc-linux-gnu-gcc -march=atom -O2 -pipe -fno-strict-aliasing -Wall -Wshadow -Wwrite-strings -Wundef -Wstrict-prototypes -Wunused -Wunused-parameter -Wunused-function -Wunused-value -Wmissing-prototypes -Wmissing-declarations -Wno-format-security -Wdeclaration-after-statement -Wold-style-definition -fno-builtin-strlen -finline-limit=0 -ffunction-sections -fdata-sections -fno-guess-branch-probability -funsigned-char -fno-unwind-tables -fno-asynchronous-unwind-tables -static -Wl,-O1 -Wl,--as-needed -o busybox_unstripped -Wl,--sort-common -Wl,--sort-section,alignment -Wl,--start-group applets/built-in.o archival/lib.a archival/libarchive/lib.a console-tools/lib.a coreutils/lib.a coreutils/libcoreutils/lib.a debianutils/lib.a e2fsprogs/lib.a editors/lib.a findutils/lib.a init/lib.a libbb/lib.a libpwdgrp/lib.a loginutils/lib.a mailutils/lib.a miscutils/lib.a modutils/lib.a networking/lib.a networking/libiproute/lib.a networking/udhcp/lib.a printutils/lib.a procps/lib.a runit/lib.a selinux/lib.a shell/lib.a sysklogd/lib.a util-linux/lib.a util-linux/volume_id/lib.a archival/built-in.o archival/libarchive/built-in.o console-tools/built-in.o coreutils/built-in.o coreutils/libcoreutils/built-in.o debianutils/built-in.o e2fsprogs/built-in.o editors/built-in.o findutils/built-in.o init/built-in.o libbb/built-in.o libpwdgrp/built-in.o loginutils/built-in.o mailutils/built-in.o miscutils/built-in.o modutils/built-in.o networking/built-in.o networking/libiproute/built-in.o networking/udhcp/built-in.o printutils/built-in.o procps/built-in.o runit/built-in.o selinux/built-in.o shell/built-in.o sysklogd/built-in.o util-linux/built-in.o util-linux/volume_id/built-in.o -Wl,--end-group -Wl,--start-group -lcrypt -l-L/usr/lib -lm -lpcre -lpthread -lselinux -lsepol -Wl,--end-group
==========
/usr/lib/gcc/x86_64-pc-linux-gnu/4.7.3/../../../../x86_64-pc-linux-gnu/bin/ld: cannot find -l-L/usr/lib
collect2: Fehler: ld gab 1 als Ende-Status zurück
make: *** [busybox_unstripped] Fehler 1

-----------------

I tryed to find the package responsible for that obviosly wrong "-l-L/usr/lib" option, which brought me to libsepol.

odyssey src # pkg-config --libs libsepol
-L/usr/lib -lsepol

This can't be right. Tried recompiling both packages, but results are still the same.
Comment 1 Sven Vermeulen (RETIRED) gentoo-dev 2013-08-22 17:00:39 UTC
Hi embedded team

Is having "Libs: -L/usr/lib -lsepol" in the pkg-config file wrong?

If I look at http://people.freedesktop.org/~dbn/pkg-config-guide.html this doesn't seem to be wrong. Any idea why the busybox build system fails here?
Comment 2 Sven Vermeulen (RETIRED) gentoo-dev 2013-08-22 17:03:59 UTC
Ah wait, it's pkg-config that should filter out the -L/usr/lib part
Comment 3 Sven Vermeulen (RETIRED) gentoo-dev 2013-08-22 17:07:19 UTC
This is the contents of the libsepol.pc file at /usr/lib64/pkgconfig:

prefix=/usr
exec_prefix=${prefix}
libdir=${exec_prefix}/lib
includedir=/usr/include

Name: libsepol
Description: SELinux policy library
Version: 2.1.9
URL: http://userspace.selinuxproject.org/
Libs: -L${libdir} -lsepol
Cflags: -I${includedir}

That should be correct afaik. I'll check with the freedesktop team.

@freedesktop guys - why would/could pkg-config display the -L part?
Comment 4 Amadeusz Sławiński 2013-08-22 18:47:10 UTC
I also hit it, it seems to be incorrectly setting libdir path
libdir=${exec_prefix}/lib
other files have
libdir=${exec_prefix}/lib64
with this changed pkg-config returns correct result and busybox emerges
Comment 5 Samuli Suominen (RETIRED) gentoo-dev 2013-08-22 19:06:43 UTC
(In reply to Sven Vermeulen from comment #2)
> @freedesktop guys - why would/could pkg-config display the -L part?

It would display it when it's not a system path, like /usr/lib isn't for a multilib system when the libraries end up in ABI specific /lib/lib32 or /lib/lib64 directories
If you change line libdir=${exec_prefix}/lib to libdir=${exec_prefix}/lib64 then it will hide it on a multilib system

You should fix your package's pkg-config file to be multilib friendly, the way it's now in the libsepol.pc would be a violation against multilib-strict

I mean, that package fix should be done regardless of what I'm about reveal there is a possibility for, pkg-config supports also ./configure --with-system-library-path= can be used to alter the system paths, like adding /usr/lib to there also for multilib systems
I don't know if that is sane to do in addition to fixing libsepol's .pc? I'm really asking not telling :)
Comment 6 Samuli Suominen (RETIRED) gentoo-dev 2013-08-22 19:19:06 UTC
Plus I wonder how dev-util/pkgconf is behaving for this, do they even have a switch in configure to specific these paths? I mean, they should be generally kept in loop... CCing some maintainers.
Comment 7 Sven Vermeulen (RETIRED) gentoo-dev 2013-08-23 07:29:21 UTC
Aha got it. I had to pass on the LIBDIR and SHLIBDIR to the build (src_compile) as well, not online to src_install (cfr bug #480960).

sys-libs/libsepol-2.1.9-r3 now provides "-lsepol" only as output of the pkg-config command.
Comment 8 Dennis Freise 2013-08-23 17:43:00 UTC
Works like a charm - fixes compilation of busybox too.

Thank you.
Comment 9 Sven Vermeulen (RETIRED) gentoo-dev 2014-01-20 20:22:48 UTC
Stable in tree