Bug 1185266 - add lzma to pkg-config
add lzma to pkg-config
Product: Fedora
Classification: Fedora
Component: libselinux (Show other bugs)
Unspecified Unspecified
unspecified Severity high
: ---
: ---
Assigned To: Petr Lautrbach
Fedora Extras Quality Assurance
Depends On:
  Show dependency treegraph
Reported: 2015-01-23 05:51 EST by Karel Zak
Modified: 2015-05-10 19:59 EDT (History)
4 users (show)

See Also:
Fixed In Version: libselinux-2.3-9.fc21
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 1214494 (view as bug list)
Last Closed: 2015-04-28 09:10:15 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Karel Zak 2015-01-23 05:51:14 EST
libselinux.pc is incomplete and static builds against libselinux are broken now.

Actual results:
$ pkg-config --static --libs libselinux
-lselinux -lsepol -lpcre

Expected results:
$ pkg-config --static --libs libselinux
-lselinux -lsepol -lpcre -llzma -lpthread

Additional info:

All you need is to add "liblzma" to Requires.private field.
Comment 1 Petr Lautrbach 2015-04-21 11:12:55 EDT
Could you provide a reproducer please? It seems to work for me:

$ cat test_libselinux.c 
#include <selinux/selinux.h>

int main() {
        return is_selinux_enabled();

$ gcc -static test_libselinux.c `pkg-config --static --libs libselinux`

$ ./a.out 

$ echo $?
Comment 2 Karel Zak 2015-04-21 13:07:33 EDT
git clone http://github.com/karelzak/util-linux.git
cd util-linux
./configure --enable-static-programs --with-selinux

make mount.static V=1

gcc -std=gnu99 -fsigned-char -fno-common -Wall -Werror=sequence-point -Wextra -Wmissing-declarations -Wmissing-parameter-type -Wmissing-prototypes -Wno-missing-field-initializers -Wredundant-decls -Wsign-compare -Wtype-limits -Wuninitialized -Wunused-but-set-parameter -Wunused-but-set-variable -Wunused-parameter -Wunused-result -Wunused-variable -Wnested-externs -Wpointer-arith -Wstrict-prototypes -Wimplicit-function-declaration -I./libmount/src -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -fno-diagnostics-show-caret -static -o mount.static sys-utils/mount_static-mount.o  ./.libs/libcommon.a ./.libs/libmount.a /home/projects/util-linux/util-linux/.libs/libblkid.a /home/projects/util-linux/util-linux/.libs/libuuid.a -lrt -lselinux -lsepol -lpcre

/usr/lib/gcc/x86_64-redhat-linux/4.9.2/../../../../lib64/libselinux.a(load_policy.o): In function `selinux_mkload_policy':
(.text+0x310): undefined reference to `lzma_stream_decoder'


I'm not sure, maybe I blame sepol/selinux incorrectly (I don't see anything related to lzma in libselinux code), but the gcc message is obvious.

If I compile --without-selinux (and gcc command line contains only -lrt) then all works as expected.
Comment 3 Karel Zak 2015-04-21 13:11:30 EDT
Note that the code uses selinux_trans_to_raw_context(), getfilecon(), security_get_initial_context(), selinux_file_context_cmp().
Comment 4 Petr Lautrbach 2015-04-22 05:13:00 EDT
It's related to this [1] commit which apparently hasn't been upstreamed.

[1] https://github.com/fedora-selinux/selinux/commit/890c74c1295ee711796781d9e11e6f7a546bda07
Comment 5 Petr Lautrbach 2015-04-22 16:50:51 EDT

This is a scratch with reverted commit 90c74c1295ee711796781d9e11e6f7a546bda07. 
But static builds are still broken due to #1214494:

/usr/lib/gcc/x86_64-redhat-linux/5.0.1/../../../../lib64/libpcre.a(libpcre_la-pcre_jit_compile.o): In function `sljit_generate_code':
(.text+0x6b1): undefined reference to `pthread_mutex_lock'
/usr/lib/gcc/x86_64-redhat-linux/5.0.1/../../../../lib64/libpcre.a(libpcre_la-pcre_jit_compile.o): In function `sljit_generate_code':
(.text+0x7a6): undefined reference to `pthread_mutex_unlock'
/usr/lib/gcc/x86_64-redhat-linux/5.0.1/../../../../lib64/libpcre.a(libpcre_la-pcre_jit_compile.o): In function `sljit_generate_code':
(.text+0xb31): undefined reference to `pthread_mutex_unlock'
Comment 6 Fedora Update System 2015-04-23 05:20:43 EDT
libselinux-2.3-9.fc22 has been submitted as an update for Fedora 22.
Comment 7 Fedora Update System 2015-04-23 05:21:41 EDT
libselinux-2.3-9.fc21 has been submitted as an update for Fedora 21.
Comment 8 Fedora Update System 2015-04-24 18:47:31 EDT
Package libselinux-2.3-9.fc21:
* should fix your issue,
* was pushed to the Fedora 21 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing libselinux-2.3-9.fc21'
as soon as you are able to.
Please go to the following url:
then log in and leave karma (feedback).
Comment 9 Fedora Update System 2015-04-28 09:10:15 EDT
libselinux-2.3-9.fc22 has been pushed to the Fedora 22 stable repository.  If problems still persist, please make note of it in this bug report.
Comment 10 Fedora Update System 2015-05-10 19:59:07 EDT
libselinux-2.3-9.fc21 has been pushed to the Fedora 21 stable repository.  If problems still persist, please make note of it in this bug report.

Note You need to log in before you can comment on or make changes to this bug.