Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 439414 - sys-fs/lvm2-2.02.88[selinux,static]: with sys-libs/libselinux-2.1.12-r1, link fails with pcre missing symbols
Summary: sys-fs/lvm2-2.02.88[selinux,static]: with sys-libs/libselinux-2.1.12-r1, link...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Robin Johnson
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-10-23 15:33 UTC by Vincent Brillault
Modified: 2013-08-06 18:10 UTC (History)
5 users (show)

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


Attachments
Use pkg-config for libselinux in the lvm2 configure script (lvm2-use-pkg-config.patch,1.42 KB, patch)
2012-10-23 15:33 UTC, Vincent Brillault
Details | Diff
Build log (undefined reference to `pcre_free') (lvm2-failed-build.log,101.30 KB, text/plain)
2013-04-10 21:13 UTC, Vincent Brillault
Details
Build log after patch: compiles with warnings (lvm2-patched-build.log,237.43 KB, text/plain)
2013-04-10 21:15 UTC, Vincent Brillault
Details
Trying to build without libselinux[static-libs] (build-no-libselinux-static.log,100.24 KB, text/plain)
2013-04-10 21:47 UTC, Vincent Brillault
Details
a re-write of the patch base don the one for udev[static-libs] (lvm2-2.02.97-selinux-static.patch,3.12 KB, patch)
2013-08-01 21:48 UTC, Ian Stakenvicius (RETIRED)
Details | Diff
lvm2-2.02.99 patch update (lvm2-2.02.99-selinux.patch,4.58 KB, patch)
2013-08-04 03:24 UTC, Jory A. Pratt
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Vincent Brillault 2012-10-23 15:33:21 UTC
Created attachment 327234 [details, diff]
Use pkg-config for libselinux in the lvm2 configure script

When linking, the lvm2 build system make direct reference to '-lselinux', bypassing pkg-config and thus not linking with '-lprce':

x86_64-pc-linux-gnu-gcc -march=native -O2 -pipe -march=native -O2 -pipe -fPIC -Wall -Wundef -Wshadow -Wcast-align -Wwrite-strings -Wmissing-prototypes -Wmissing-declarations -Wnested-externs -Winline -Wmissi
ng-noreturn -Wformat-security -Wredundant-decls -Wpointer-arith -O2 -march=native -O2 -pipe -fPIC -Wall -Wundef -Wshadow -Wcast-align -Wwrite-strings -Wmissing-prototypes -Wmissing-declarations -Wnested-exte
rns -Winline -Wmissing-noreturn -Wformat-security -Wredundant-decls -Wpointer-arith -O2 -Wl,-O1 -Wl,--as-needed -Wl,-O1 -Wl,--as-needed -Wl,--export-dynamic -L./libdm -L./lib -L./daemons/dmeventd -Wl,-O1 -Wl
,--as-needed -Wl,--export-dynamic -L../libdm -L../lib -L../daemons/dmeventd -Wl,--no-export-dynamic -static -L../libdm/ioctl \
      -o dmsetup.static dmsetup.o -ldevmapper -lselinux -lsepol -ludev -lrt    -ludev -lrt
/usr/lib/gcc/x86_64-pc-linux-gnu/4.5.4/../../../../lib64/libselinux.a(seusers.o): In function `getseuserbyname':
(.text+0x602): warning: Using 'getgrouplist' 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.5.4/../../../../lib64/libselinux.a(seusers.o): In function `getseuserbyname':
(.text+0x3a2): 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.5.4/../../../../lib64/libselinux.a(seusers.o): In function `getseuserbyname':
(.text+0xa5): 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.5.4/../../../../lib64/libselinux.a(label_file.o): In function `closef':
(.text+0x180): undefined reference to `pcre_free'
/usr/lib/gcc/x86_64-pc-linux-gnu/4.5.4/../../../../lib64/libselinux.a(label_file.o): In function `closef':
(.text+0x18b): undefined reference to `pcre_free_study'
/usr/lib/gcc/x86_64-pc-linux-gnu/4.5.4/../../../../lib64/libselinux.a(label_file.o): In function `compile_regex.clone.5':
(.text+0x2bf): undefined reference to `pcre_compile'
/usr/lib/gcc/x86_64-pc-linux-gnu/4.5.4/../../../../lib64/libselinux.a(label_file.o): In function `compile_regex.clone.5':
(.text+0x2de): undefined reference to `pcre_study'
/usr/lib/gcc/x86_64-pc-linux-gnu/4.5.4/../../../../lib64/libselinux.a(label_file.o): In function `lookup':
(.text+0x49d): undefined reference to `pcre_exec'
/usr/lib/gcc/x86_64-pc-linux-gnu/4.5.4/../../../../lib64/libselinux.a(label_file.o): In function `lookup':
(.text+0x530): undefined reference to `pcre_exec'
collect2: ld returned 1 exit status
make[1]: *** [dmsetup.static] Error 1
make[1]: Leaving directory `/var/tmp/portage/sys-fs/lvm2-2.02.88/work/LVM2.2.02.88/tools'
make: *** [tools.device-mapper] Error 2
emake failed

I attached some idea of patch (it works with sys-libs/libselinux-2.1.12-r1 from the overlay and libpcre[static] but I'm not sure it should be written like that, as I have close to no experience with pkg-config, autoreconf & co)
Comment 1 Jeroen Roovers (RETIRED) gentoo-dev 2012-10-23 15:34:25 UTC

*** This bug has been marked as a duplicate of bug 438998 ***
Comment 2 Olaf Leidinger 2012-11-20 07:35:14 UTC
Same problem here. Yet, unstable version sys-fs/lvm2-2.02.93-r1 compiles just fine. Later versions are blocked by openrc.
Comment 3 Vincent Brillault 2012-11-22 22:15:25 UTC
sys-fs/lvm2-2.02.93-r1 also compile fine here (Didn't tried to run it through).
There are some modifications in the Configure.in (e.g +STATIC_LDFLAGS="-Wl,--no-export-dynamic") that probably explains the 'fix'.

I just noticed that there is no mention of libselinux in the ebuild. Shouldn't there be a dev-libs/libselinux[static-libs?] in the RDEPEND ?
Comment 4 Vincent Brillault 2013-04-10 21:13:11 UTC
Created attachment 345148 [details]
Build log (undefined reference to `pcre_free')

I just checked sys-fs/lvm2-2.02.97-r1[selinux,static]: in fact it still doesn't work (I'm using non-static lvm2, thus I normally doesn't check it).

I've attached a build.log.
Steps to reproduce:
- Install a selinux enabled
- Install libselinux[static-libs] (I think a dependency to this should be added in the ebuild, e.g: 'selinux? ( static? ( libselinux[static-libs] ) )' )
- Try to install sys-fs/lvm2-2.02.97-r1[static]
Comment 5 Vincent Brillault 2013-04-10 21:15:51 UTC
Created attachment 345150 [details]
Build log after patch: compiles with warnings

The patch I proposed before is still 'working': it fixes the pcre linking problem and allows the compilation to end with no errors. I've added a full build.log to the bug report.

However, there are some strange warnings during the compilation:

x86_64-pc-linux-gnu-gcc -march=native -O2 -pipe -march=native -O2 -pipe -fPIC  -O2 -march=native -O2 -pipe -fPIC  -O2 -Wl,-O1 -Wl,--as-needed -Wl,-O1 -Wl,--as-needed -O2 -L./libdm -L./lib
-L./libdaemon/clien
t -L./daemons/dmeventd -Wl,-O1 -Wl,--as-needed -O2 -L../libdm -L../lib -L../libdaemon/client -L../daemons/dmeventd -Wl,--no-export-dynamic -static -L../libdm/ioctl \
      -o dmsetup.static dmsetup.o -ldevmapper -lselinux -lsepol -lpcre  -ludev -lrt   -ludev -lrt
/usr/lib/gcc/x86_64-pc-linux-gnu/4.6.3/../../../../lib64/libselinux.a(seusers.o): In function `getseuserbyname':
(.text+0x5f9): warning: Using 'getgrouplist' 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.6.3/../../../../lib64/libudev.a(util.o): In function `gid_to_name':
(.text.gid_to_name+0x2b): 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.6.3/../../../../lib64/libudev.a(util.o): In function `get_group_creds':
(.text.get_group_creds+0xce): 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.6.3/../../../../lib64/libselinux.a(seusers.o): In function `getseuserbyname':
(.text+0x360): 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.6.3/../../../../lib64/libudev.a(util.o): In function `get_user_creds':
(.text.get_user_creds+0x15d): 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.6.3/../../../../lib64/libudev.a(util.o): In function `get_user_creds':
(.text.get_user_creds+0xcf): 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.6.3/../../../../lib64/libselinux.a(seusers.o): In function `getseuserbyname':
(.text+0xa2): 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.6.3/../../../../lib64/libudev.a(util.o): In function `lookup_uid':
(.text.lookup_uid+0x85): warning: Using 'getpwuid_r' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking

Is the static compilation of lvm2 completely broken ?
Comment 6 Vincent Brillault 2013-04-10 21:47:30 UTC
Created attachment 345152 [details]
Trying to build without libselinux[static-libs]

Tried to build lvm2[static] without libselinux[static-libs], as expected it failed (I just wanted to have some proof for the modification of the ebuild, the need of dependency upon libselinux[static-libs] (libselinux is installed only as -static-libs here)):
/usr/lib/gcc/x86_64-pc-linux-gnu/4.6.3/../../../../x86_64-pc-linux-gnu/bin/ld: cannot find -lselinux
Comment 7 Sven Vermeulen (RETIRED) gentoo-dev 2013-04-11 18:01:09 UTC
For the libselinux stuff that uses glibc calls (like the "warning: Using 'getgrouplist' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking" warning), is there anything that I can patch inside libselinux for this (except using uclibc)?

Or is it "allowed" that statically linked applications do use glibc-related dynamic linking?
Comment 8 Ian Stakenvicius (RETIRED) gentoo-dev 2013-08-01 21:48:37 UTC
Created attachment 354860 [details, diff]
a re-write of the patch base don the one for udev[static-libs]

The following patch applies to 2.02.97 and above, and allowed me to build lvm2[selinux,static] without issue.  

Please not that in combination with applying this patch, dependencies on libselinux should also be adjusted:

--- lvm2-2.02.98.ebuild 2013-08-01 15:42:03.000000000 -0400
+++ lvm2-2.02.98.ebuild.new     2013-08-01 17:47:49.000000000 -0400
@@ -39,7 +39,10 @@
 DEPEND="${DEPEND_COMMON}
                virtual/pkgconfig
                >=sys-devel/binutils-2.20.1-r1
-               static? ( udev? ( virtual/udev[static-libs] ) )"
+               static? (
+                       udev? ( virtual/udev[static-libs] ) 
+                       selinux? ( sys-libs/libselinux[static-libs] ) 
+               )"
 
 S="${WORKDIR}/${PN/lvm/LVM}.${PV}"
Comment 9 Jory A. Pratt gentoo-dev 2013-08-04 03:24:30 UTC
Created attachment 355078 [details, diff]
lvm2-2.02.99 patch update

Here is a clean simple patch just add to end of ebuild and go :) All credit to AXS for his work on this.
Comment 10 Ian Stakenvicius (RETIRED) gentoo-dev 2013-08-06 18:10:28 UTC
Thanks Jory for the updated patch for .99

Vapier gave me the OK to commit after testing passed with a forced-install of libselinux et. al.; anyone using a full selinux system and still has issues, please reopen.

+  06 Aug 2013; Ian Stakenvicius <axs@gentoo.org>
+  +files/lvm2-2.02.97-selinux-static.patch,
+  +files/lvm2-2.02.99-selinux-static.patch, lvm2-2.02.97-r1.ebuild,
+  lvm2-2.02.98.ebuild, lvm2-2.02.99-r1.ebuild, lvm2-2.02.99.ebuild:
+  fixed compile error when building with USE='static selinux', bug 439414
+