Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 370217 - >=sys-fs/lvm2-2.02.97-r1[udev,static,static-libs]: undefined reference to `clock_gettime' (missing -lrt)
Summary: >=sys-fs/lvm2-2.02.97-r1[udev,static,static-libs]: undefined reference to `cl...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: AMD64 Linux
: Normal major (vote)
Assignee: Robin Johnson
URL:
Whiteboard:
Keywords:
: 475902 (view as bug list)
Depends on:
Blocks:
 
Reported: 2011-06-06 02:24 UTC by Pshem Kowalczyk
Modified: 2013-08-01 07:57 UTC (History)
15 users (show)

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


Attachments
build.log (build.log.gz,285 bytes, application/gzip)
2011-06-06 02:25 UTC, Pshem Kowalczyk
Details
environment (environment.gz,32.49 KB, application/gzip)
2011-06-06 02:25 UTC, Pshem Kowalczyk
Details
build.log (build.log.gz,10.54 KB, application/gzip)
2011-06-09 01:01 UTC, Pshem Kowalczyk
Details
build with "defaults" (build-lvm2-notr.log.bz2,8.88 KB, application/octet-stream)
2011-11-17 07:43 UTC, Markus Duft (RETIRED)
Details
build with LIBS=-lrt (build-lvm2-rt.log.bz2,8.84 KB, application/octet-stream)
2011-11-17 07:43 UTC, Markus Duft (RETIRED)
Details
add static udev library flags, if building statically (lvm2-2.02.97-r1.ebuild.diff,628 bytes, patch)
2013-07-22 19:38 UTC, Ivan Labáth
Details | Diff
failing build log for reference (build.log,96.80 KB, text/plain)
2013-07-22 22:08 UTC, Ivan Labáth
Details
Requested build log (LVM2.2.02.98-build.log,410.02 KB, application/octet-stream)
2013-07-22 22:20 UTC, Thomas Deutschmann (RETIRED)
Details
build system patch to set proper static lib values for udev (lvm2-2.02.98-static.patch,1.14 KB, patch)
2013-07-31 23:16 UTC, Ian Stakenvicius (RETIRED)
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Pshem Kowalczyk 2011-06-06 02:24:20 UTC
Attempt to emerge sys-fs/lvm2-2.02.73-r1 always fail with:


/usr/lib/gcc/x86_64-pc-linux-gnu/4.4.5/../../../../lib64/libudev.a(libudev-util.o): In function `now_usec':
(.text+0x26d): undefined reference to `clock_gettime'

Emerge --info:
Portage 2.1.9.50 (default/linux/amd64/10.0/no-multilib, gcc-4.4.5, glibc-2.12.2-r0, 2.6.39-gentoo x86_64)
=================================================================
System uname: Linux-2.6.39-gentoo-x86_64-AMD_Athlon-tm-_II_X4_620_Processor-with-gentoo-2.0.2
Timestamp of tree: Sun, 05 Jun 2011 13:15:01 +0000
app-shells/bash:          4.1_p9
dev-lang/python:          2.6.6-r2, 2.7.1-r1, 3.1.3-r1
dev-util/cmake:           2.8.4-r1
sys-apps/baselayout:      2.0.2
sys-apps/openrc:          0.8.2-r1
sys-apps/sandbox:         2.4
sys-devel/autoconf:       2.65-r1
sys-devel/automake:       1.9.6-r3, 1.10.3, 1.11.1
sys-devel/binutils:       2.20.1-r1
sys-devel/gcc:            4.4.5
sys-devel/gcc-config:     1.4.1-r1
sys-devel/libtool:        2.2.10
sys-devel/make:           3.82
sys-kernel/linux-headers: 2.6.36.1 (virtual/os-headers)
sys-libs/glibc:           2.12.2
ACCEPT_KEYWORDS="amd64"
ACCEPT_LICENSE="*"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-march=amdfam10 -O2 -pipe"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /var/bind"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/php/apache2-php5.3/ext-active/ /etc/php/cgi-php5.3/ext-active/ /etc/php/cli-php5.3/ext-active/ /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo"
CXXFLAGS="-march=amdfam10 -O2 -pipe"
DISTDIR="/usr/portage/distfiles"
FEATURES="assume-digests binpkg-logs distlocks fixlafiles fixpackages news parallel-fetch protect-owned sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch"
FFLAGS=""
GENTOO_MIRRORS="ftp://gentoo.llarian.net/pub/gentoo"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
MAKEOPTS="-j5"
PKGDIR="/usr/portage/packages"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/usr/local/portage/layman/webapps-experimental /usr/local/portage/layman/mt-mythtv /usr/local/portage/jmdgentoooverlay"
SYNC="rsync://rsync.nz.gentoo.org/gentoo-portage"
USE="3dnow 3dnowext 3dnowprefetch X a52 aac acc acl acpi alsa amd64 apache2 apm autostart bash-completion berkdb bluetooth bzip2 cdr cli consolekit cracklib crypt cups curl cxx dbus dts dvb dvd dvdr enca encode exif faad faad2 fbcondecor ffmpeg fftw flac fortran freetype gd gdbm git gpm h264 hddtemp iconv imagemagick ipv6 java6 jpeg lame latm libfaad libvisual lirc lm_sensors matroska mjpeg mmx mmxext modules mp3 mp4 mpeg mplayer mudflap mysql mythtv ncurses nforce2 nls nptl nptlonly nuv nvidia ogg opengl openmp pam pcntl pcre perl php png posix pppd python qt3support qt4 readline schroedinger sdl sensord session snmp spl sse sse2 sse4a ssl subversion svg sysfs syslog tcpd theora threads tiff tk truetype unicode usb v4l v4l2 vcd vdpau vdr vhosts vim-syntax vorbis x264 xml xorg xv xvid xvmc zlib" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mmap_emul mulaw multi null plug rate route share shm softvol" APACHE2_MODULES="actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="braindump flow karbon kexi kpresenter krita tables words" CAMERAS="ptp2" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" DVB_CARDS="usb-dib0700 tda10046" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf superstar2 timing tsip tripmate tnt ubx" INPUT_DEVICES="keyboard mouse evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIRC_DEVICES="devinput" PHP_TARGETS="php5-3" RUBY_TARGETS="ruby18" USERLAND="GNU" VIDEO_CARDS="nvidia" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account"
Unset:  CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LANG, LC_ALL, LINGUAS, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS



Reproducible: Always

Steps to Reproduce:
1. Attempt to emerge the package
Actual Results:  
Package fails to emerge.

Expected Results:  
Package emerges correctly.
Comment 1 Pshem Kowalczyk 2011-06-06 02:25:25 UTC
Created attachment 275967 [details]
build.log
Comment 2 Pshem Kowalczyk 2011-06-06 02:25:48 UTC
Created attachment 275969 [details]
environment
Comment 3 Jeroen Roovers (RETIRED) gentoo-dev 2011-06-08 15:22:55 UTC
Comment on attachment 275967 [details]
build.log

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>403 Forbidden</title>
</head><body>
<h1>Forbidden</h1>
<p>You don't have permission to access /build.log.gz
on this server.</p>
<hr>
<address>Apache Server at data.riverbank.gen.nz Port 80</address>
</body></html>

What's that?
Comment 4 Pshem Kowalczyk 2011-06-09 01:01:25 UTC
Created attachment 276319 [details]
build.log
Comment 5 Pshem Kowalczyk 2011-06-09 01:03:06 UTC
Added build.log again. This time should be correct.
Comment 6 Jeroen Roovers (RETIRED) gentoo-dev 2011-06-10 02:22:01 UTC
Thanks.
Comment 7 Javier Andres Galaz Jeria 2011-06-20 16:57:50 UTC
Same here...
Comment 8 Javier Andres Galaz Jeria 2011-06-20 17:01:17 UTC
This should be fixed by appending -lrt to the compile libraries, how can I do that and send a patch for portage?
Comment 9 Javier Andres Galaz Jeria 2011-06-20 17:21:51 UTC
On the other hand removing static USE flag works for me. I don't need static lvm2.
Comment 10 George L. Emigh 2011-08-27 19:24:03 UTC
(In reply to comment #9)
> On the other hand removing static USE flag works for me. I don't need static
> lvm2.

removing static worked for me as well.
Comment 11 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2011-09-13 05:29:50 UTC
Does this problem still exist with the latest version of LVM (2.02.88)?
Comment 12 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2011-09-13 05:47:25 UTC
I can't reproduce it here. I need more info.
Comment 13 Christian Ruppert (idl0r) gentoo-dev 2011-09-26 17:52:17 UTC
I can't reproduce it either but lib/misc/timestamp.c uses "clock_gettime" so adding the rt depend seems fine to me.
Comment 14 Scott Alfter 2011-09-30 14:25:35 UTC
(In reply to comment #11)
> Does this problem still exist with the latest version of LVM (2.02.88)?

2.02.73-r1 fails to build with the same error given by the OP.  2.02.88, once it's keyworded ~*, builds OK.
Comment 15 Markus Duft (RETIRED) gentoo-dev 2011-11-17 07:24:22 UTC
all versions from 2.02.73-r1 to 2.02.88 fail to build for me with the same problem. actually there are /two/ compile failures because of clock_gettime. one is "fixable" with LIBS=-lrt, but dmsetup only builds for me when USE=-static.

i'm on a smallish atom netbook, running x86, doing an initial gnome3 setup. more info required? tell me :)
Comment 16 Markus Duft (RETIRED) gentoo-dev 2011-11-17 07:26:52 UTC
interstingly, on my desktop it worked without problems:

Installed versions:  2.02.73-r1(11:21:41 PM 05/05/2011)(lvm1 readline static -clvm -cman -selinux)
Comment 17 Markus Duft (RETIRED) gentoo-dev 2011-11-17 07:43:12 UTC
Created attachment 292855 [details]
build with "defaults"

as you can see, two build errors related to clock_gettime...
Comment 18 Markus Duft (RETIRED) gentoo-dev 2011-11-17 07:43:50 UTC
Created attachment 292857 [details]
build with LIBS=-lrt

... as opposed to only one left over with -lrt
Comment 19 Markus Duft (RETIRED) gentoo-dev 2011-11-17 11:53:46 UTC
i left build directories for both versions on disk just fyi. they can be found here:

[1] http://dev.gentoo.org/~mduft/build-lvm2-nort.tar.bz2
[2] http://dev.gentoo.org/~mduft/build-lvm2-rt.tar.bz2
Comment 20 Christian Ruppert (idl0r) gentoo-dev 2011-11-17 17:38:47 UTC
(In reply to comment #18)
> Created attachment 292857 [details]
> build with LIBS=-lrt
> 
> ... as opposed to only one left over with -lrt

<snip>
/usr/lib/gcc/i686-pc-linux-gnu/4.5.3/../../../libudev.a(libudev-util.o): In function `now_usec':
(.text.now_usec+0x19): undefined reference to `clock_gettime'
collect2: ld returned 1 exit status
distcc[13810] ERROR: compile (null) on localhost failed
</snip>

I wonder if this actually is a udev bug.. may not..
So -lrt is missing during dmeventd linking.
Comment 21 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2012-03-27 02:30:52 UTC
Something is broken on your system that -lrt is being lost by glibc. Maybe a broken pkgconfig somewhere, but the problem isn't in LVM itself.
Comment 22 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2013-01-18 01:36:04 UTC
Please retest on 2.02.98
Comment 23 Manuel Rüger (RETIRED) gentoo-dev 2013-06-25 18:17:52 UTC
Seems to be related to udev.

I can built lvm2 USE="static" with udev-200, but not with udev-204. 
But lvm2 with USE="-static" compiles with udev-204.

lvm2-2.02.98 doesn't fix the problem here.


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/client -L./daemons/dmeventd -Wl,-O1 -Wl,--as-needed -O2 -L../libdm -L../lib -L../libdaemon/client -L../daemons/dmeventd -L../libdm \
      -o dmsetup dmsetup.o -ldevmapper  -ludev 
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/client -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  -ludev   -ludev 
/usr/lib/gcc/x86_64-pc-linux-gnu/4.7.3/../../../../lib64/libudev.a(util.o): In function `gid_to_name':
(.text.gid_to_name+0x31): 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): In function `get_group_creds':
(.text.get_group_creds+0xd2): 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(libudev_la-libudev-util.o): In function `util_lookup_group':
(.text.util_lookup_group+0xcf): 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): In function `get_user_creds':
(.text.get_user_creds+0x16b): 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): In function `get_user_creds':
(.text.get_user_creds+0xef): 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(libudev_la-libudev-util.o): In function `util_lookup_user':
(.text.util_lookup_user+0xcc): 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(util.o): In function `lookup_uid':
(.text.lookup_uid+0x8e): 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(time-util.o): In function `now':
(.text.now+0x8): undefined reference to `clock_gettime'
collect2: error: ld returned 1 exit status
Comment 24 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2013-06-25 18:25:25 UTC
Reopening as requested by mrueg.
Comment 25 Dale 2013-06-27 12:37:32 UTC
I get the same error while using eudev.  Going to post some info to see if this helps.  

sys-devel/gcc-4.6.3:4.6 [4.6.3:4.6.3] USE="cxx fortran gtk mudflap (multilib) multislot nls nptl openmp (-altivec) -doc (-fixed-point) -gcj -graphite (-hardened) (-libssp) -lto -nopie -nossp -objc -objc++ -objc-gc -regression-test -vanilla" 0 kB
sys-fs/eudev-1.0  USE="gudev hwdb introspection keymap kmod modutils openrc rule-generator static-libs -doc (-selinux)" 0 kB
sys-fs/lvm2-2.02.97-r1  USE="lvm1 readline static thin udev (-clvm) (-cman) (-selinux) -static-libs" 0 kB

If you need more info, let me know.
Comment 26 Samuli Suominen (RETIRED) gentoo-dev 2013-07-07 13:37:23 UTC
*** Bug 475902 has been marked as a duplicate of this bug. ***
Comment 27 Samuli Suominen (RETIRED) gentoo-dev 2013-07-07 13:40:56 UTC
Same bug resurfaced with 2.02.97-r1, 2.02.98:

Latest config.log:

https://bugs.gentoo.org/attachment.cgi?id=352712

Latest build.log:

https://bugs.gentoo.org/attachment.cgi?id=352714

https://bugs.gentoo.org/show_bug.cgi?id=475902#c6
Comment 28 Samuli Suominen (RETIRED) gentoo-dev 2013-07-07 13:42:57 UTC
$ pkg-config --static --libs libudev
-ludev -lrt 

Looks like bug in LVM2 not picking up Libs.private: from libudev.pc
As in, -ludev can't be linked without getting the libs it uses with it
Comment 29 Ivan Labáth 2013-07-12 01:15:47 UTC
On my systems the -lrt library is only listed for the static version of libudev:

$ pkg-config --libs --static libudev
-ludev -lrt 
$ pkg-config --libs libudev
-ludev 

lvm2 configure script does not differentiate between dynamic and static library dependencies, having only UDEV_LIBS, no STATIC_UDEV_LIBS or anything like that.

Relevant line in configure.in is:
        PKG_CHECK_MODULES(UDEV, libudev >= 143, [UDEV_PC="libudev"])

which expands to things like:
  pkg_cv_UDEV_CFLAGS=`$PKG_CONFIG --cflags "libudev >= 143" 2>/dev/null`
  pkg_cv_UDEV_LIBS=`$PKG_CONFIG --libs "libudev >= 143" 2>/dev/null`


The configure script lets you override the library detection, so one could use a band aid like
  export UDEV_LIBS="$(pkg-config --libs --static libudev)"
Comment 30 eeL 2013-07-22 12:11:09 UTC
(In reply to Ivan Labáth from comment #29)
> On my systems the -lrt library is only listed for the static version of
> libudev:
> 
> $ pkg-config --libs --static libudev
> -ludev -lrt 
> $ pkg-config --libs libudev
> -ludev 
> 
> lvm2 configure script does not differentiate between dynamic and static
> library dependencies, having only UDEV_LIBS, no STATIC_UDEV_LIBS or anything
> like that.
> 
> Relevant line in configure.in is:
>         PKG_CHECK_MODULES(UDEV, libudev >= 143, [UDEV_PC="libudev"])
> 
> which expands to things like:
>   pkg_cv_UDEV_CFLAGS=`$PKG_CONFIG --cflags "libudev >= 143" 2>/dev/null`
>   pkg_cv_UDEV_LIBS=`$PKG_CONFIG --libs "libudev >= 143" 2>/dev/null`
> 
> 
> The configure script lets you override the library detection, so one could
> use a band aid like
>   export UDEV_LIBS="$(pkg-config --libs --static libudev)"

used Ivan trick on both 2.02.97-r1, 2.02.98, works perfectly!
Thanks, by the way :°)
Comment 31 Ivan Labáth 2013-07-22 19:38:25 UTC
Created attachment 353922 [details, diff]
add static udev library flags, if building statically

Can anyone actually build current lvm2[static,udev] e.g. sys-fs/udev-2.02.97-r1 or sys-fs/udev-2.02.98 ?

If not, I would propose this patch.
Comment 32 Thomas Deutschmann (RETIRED) gentoo-dev 2013-07-22 20:18:20 UTC
(In reply to Ivan Labáth from comment #31)
> Can anyone actually build current lvm2[static,udev] e.g.
> sys-fs/udev-2.02.97-r1 or sys-fs/udev-2.02.98 ?
> 
> If not, I would propose this patch.

No problem here:

System uname: Linux-3.9.11-x86_64-Intel-R-_Core-TM-_i7-3770K_CPU_@_3.50GHz-with-gentoo-2.2
KiB Mem:     4050980 total,   3604296 free
KiB Swap:    1048572 total,   1048572 free
Timestamp of tree: Mon, 22 Jul 2013 12:15:01 +0000
ld GNU ld (GNU Binutils) 2.23.1
app-shells/bash:          4.2_p45
dev-lang/python:          2.7.5-r1, 3.2.5-r1, 3.3.2-r1
dev-util/pkgconfig:       0.28
sys-apps/baselayout:      2.2
sys-apps/openrc:          0.11.8
sys-apps/sandbox:         2.6-r1
sys-devel/autoconf:       2.13, 2.69
sys-devel/automake:       1.13.4, 1.14
sys-devel/binutils:       2.23.1
sys-devel/gcc:            4.7.3
sys-devel/gcc-config:     1.8
sys-devel/libtool:        2.4.2
sys-devel/make:           3.82-r4
sys-kernel/linux-headers: 3.9 (virtual/os-headers)
sys-libs/glibc:           2.17

[...]

sys-fs/lvm2-2.02.98 was built with the following:
USE="readline static udev -clvm -cman -lvm1 (-selinux) -static-libs -thin"

sys-fs/udev-205 was built with the following:
USE="acl firmware-loader gudev kmod openrc static-libs -doc -hwdb -introspection -keymap (-selinux)"
Comment 33 Ivan Labáth 2013-07-22 21:47:39 UTC
(In reply to Thomas D. from comment #32)
> No problem here

Interesting.

What does "pkg-config --libs --static libudev" and "pkg-config --libs libudev" say?
Comment 34 Thomas Deutschmann (RETIRED) gentoo-dev 2013-07-22 21:59:39 UTC
# pkg-config --libs --static libudev
-ludev -lrt 

# pkg-config --libs libudev
-ludev
Comment 35 Ivan Labáth 2013-07-22 22:08:20 UTC
Created attachment 353942 [details]
failing build log for reference
Comment 36 Ivan Labáth 2013-07-22 22:13:50 UTC
(In reply to Thomas D. from comment #34)
> # pkg-config --libs --static libudev
> -ludev -lrt 
> 
> # pkg-config --libs libudev
> -ludev

Then how does it manage to link on your machine?

I have tried updating lvm2, also udev to your versions and matching use flags, but that does not help. Perhaps the new gcc version can link without -lrt.

Could you post your lvm2 build log, or the matching command that fails in my build?
Comment 37 Ivan Labáth 2013-07-22 22:18:44 UTC
My system info

Portage 2.1.12.2 (default/linux/x86/13.0/desktop, gcc-4.6.3, glibc-2.15-r3, 3.9.7-ck i686)
=================================================================
System uname: Linux-3.9.7-ck-i686-Intel-R-_Celeron-R-_M_CPU_440_@_1.86GHz-with-gentoo-2.2
KiB Mem:     1541008 total,    247300 free
KiB Swap:    1048572 total,   1047576 free
Timestamp of tree: Wed, 10 Jul 2013 00:45:01 +0000
ld GNU ld (GNU Binutils) 2.23.1
distcc 3.1 i686-pc-linux-gnu [disabled]
app-shells/bash:          4.2_p45
dev-java/java-config:     2.1.12-r1
dev-lang/python:          2.7.5, 3.2.5-r1
dev-util/cmake:           2.8.10.2-r2
dev-util/pkgconfig:       0.28
sys-apps/baselayout:      2.2
sys-apps/openrc:          0.11.8
sys-apps/sandbox:         2.6-r1
sys-devel/autoconf:       2.13, 2.69
sys-devel/automake:       1.9.6-r3, 1.11.6, 1.12.6
sys-devel/binutils:       2.23.1
sys-devel/gcc:            4.6.3
sys-devel/gcc-config:     1.7.3
sys-devel/libtool:        2.4-r1
sys-devel/make:           3.82-r4
sys-kernel/linux-headers: 3.7 (virtual/os-headers)
sys-libs/glibc:           2.15-r3
Comment 38 Thomas Deutschmann (RETIRED) gentoo-dev 2013-07-22 22:20:27 UTC
Created attachment 353944 [details]
Requested build log

Could it be gcc-related? As request, my build log.
Comment 39 Ivan Labáth 2013-07-22 22:41:07 UTC
(In reply to Thomas D. from comment #38)
> Created attachment 353944 [details]
> Requested build log
> 
> Could it be gcc-related? As request, my build log.

x86_64-pc-linux-gnu-gcc -O[...] -Wl,-O1 -Wl,--as-needed -O2 -L./libdm -L./lib -L./libdaemon/client -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  -ludev   -ludev 

On your system, dmsetup.static links happily without -lrt.

According to man clock_gettime:
>  Link with -lrt (only for glibc versions before 2.17).

So it could be that a more permissive glibc version (you have 2.17 I have 2.15-r3) enables a successful build.

Nevertheless, dmsetup.static is linked without -lrt, ignoring this requirement from pkg-config --libs --static. This is a bug on lvm2's side, that should preferably be fixed and it is the reason build fails asking for clock_gettime.
Comment 40 Ivan Labáth 2013-07-22 23:58:59 UTC
After upgrading to glibc-2.17, lvm2 builds fine, though it does not solve the underlying issue. As I am not familiar with autotools, I do not know whether it comes from lvm2 or is it an underlying issue from autoconf.

I still propose to force feed the library flags to configure with the proposed patch, if it doesn't have breakage potential. In particular, I do not know whether it is OK to call pkg-config under unusual/cross-compile/chroot/something builds.
Comment 41 William Hubbs gentoo-dev 2013-07-26 06:26:59 UTC
I also am a base-system dev, and I have thought about looking at this bug, so I am looking to be educated.
Why do we need static lvm in the first place?

Thanks,

William
Comment 42 Thomas Deutschmann (RETIRED) gentoo-dev 2013-07-26 08:16:07 UTC
I cannot tell you why you would want a lvm2[static] on a 'normal' system but most cryptosetup/LUKS tutorials, [1,2,3] for example, say "You need a static lvm2 binary!". [4] for example is also LUKS-based.

I am also using LUKS-crypted systems, but I am using genkernel to generate the initramfs or better-initramfs.




[1] http://wiki.gentoo.org/wiki/DM-Crypt_LUKS#Generating_an_initramfs

[2] http://wiki.polymorf.fr/index.php?title=Howto:Gentoo_LVM_LUKS#System_tools

[3] http://webcache.googleusercontent.com/search?q=cache:http://en.gentoo-wiki.com/wiki/Root_filesystem_over_LVM2,_DM-Crypt_and_RAID

[4] http://forums.gentoo.org/viewtopic-t-963004.html
Comment 43 Ivan Labáth 2013-07-26 10:24:06 UTC
> Why do we need static lvm in the first place?

Static lvm is quite useful when hand building initramfs for a system with root on lvm, so you don't have to bundle libraries. That being said, lvm2[static] builds a default dynamic and a lvm.static binary.


Normally, genkernel (used to) hand compile packages for the initramfs, but I have read somewhere about plans to switch to using system packages.

From http://www.gentoo.org/doc/en/genkernel.xml
> Initialization Flags
>  --lvm: Includes support for storage using via Logical Volume Management (LVM2) from static binaries, if available to the system. Relevant (static) LVM2 binaries are compiled if they are unavailable. Be sure to install the lvm2 package on your system with emerge lvm2 before enabling this flag, and review the LVM article on the Gentoo wiki.
Comment 44 Ian Stakenvicius (RETIRED) gentoo-dev 2013-07-31 19:18:58 UTC
Just out of curiosity -- did the resolution of bug 466282 not fix this??
Comment 45 Ivan Labáth 2013-07-31 20:15:45 UTC
(In reply to Ian Stakenvicius from comment #44)
> Just out of curiosity -- did the resolution of bug 466282 not fix this??

I am not sure I understood the metioned bug correctly, does it imply that one could build lvm[static-libs] with udev[-static-libs], which would subsequently fail to link in an application?

Anyway lvm2-2.02.98, which has
> 	udev? ( virtual/udev[static-libs?] )

gives

/usr/lib/gcc/i686-pc-linux-gnu/4.6.3/../../../../lib/libudev.a(time-util.o): In function `now':
(.text.now+0x26): undefined reference to `clock_gettime'
Comment 46 Ian Stakenvicius (RETIRED) gentoo-dev 2013-07-31 23:16:44 UTC
Created attachment 354776 [details, diff]
build system patch to set proper static lib values for udev

(In reply to Ivan Labáth from comment #45)
> (In reply to Ian Stakenvicius from comment #44)
> > Just out of curiosity -- did the resolution of bug 466282 not fix this??
> 
> I am not sure I understood the metioned bug correctly, does it imply that
> one could build lvm[static-libs] with udev[-static-libs], which would
> subsequently fail to link in an application?


That did seem to be the case, when i read through this -- specifically, that when virtual/udev[static-libs] existed, then -lrt was provided in the pkg-config output from libudev.

> 
> Anyway lvm2-2.02.98, which has
> > 	udev? ( virtual/udev[static-libs?] )
> 

The actual line that matters is in DEPEND:
        static? ( udev? ( virtual/udev[static-libs] ) )


> [...] gives
> 
> /usr/lib/gcc/i686-pc-linux-gnu/4.6.3/../../../../lib/libudev.a(time-util.o):
> In function `now':
> (.text.now+0x26): undefined reference to `clock_gettime'


...and that shows there is still something wrong, separate from the other bug.  Well, "wrong" might not be the proper way to describe this -- it seems from what I can tell that PKG_CHECK_MODULES (nor any other currently-existing autotools macro) provides the output of 'pkg-config --static --libs [lib]' to the build system.  So yes it's broken, but it's due to configure.in not having any logic to find and set the correct values.  I've attached a patch that takes care of this; it should be upstream-ready.
Comment 47 Ian Stakenvicius (RETIRED) gentoo-dev 2013-08-01 00:10:59 UTC
+  01 Aug 2013; Ian Stakenvicius <axs@gentoo.org>
+  +files/lvm2-2.02.97-udev-static.patch, lvm2-2.02.97-r1.ebuild,
+  lvm2-2.02.98.ebuild:
+  fixed compile error when building with USE='static udev', bug 370217
+
Comment 48 Ivan Labáth 2013-08-01 07:57:57 UTC
Works for me.