Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

A Gentoo install still in the livecd stage (unable to boot so far) fails to emerge LVM statically. I need a statically compiled lvm in order to use it in my initrd.

My make.conf:

CFLAGS="-O2 -march=native -pipe"
CXXFLAGS="${CFLAGS}"
CHOST="x86_64-pc-linux-gnu"
USE="bindist mmx sse sse2 static"

The emerge compile error:

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

I also note that:

  • Warning, we no longer overwrite /sbin/lvm and /sbin/dmsetup with
  • their static versions. If you need the static binaries,
  • you must append .static to the filename!

What does this mean? How am I supposed to append this ".static" to the filename?

I see that this person had the same issue, but with no answer: http://archives.gentoo.org/gentoo-user/msg_eb40f5d76161fda72d134551cc26d989.xml

I also notice this thread: http://forums.gentoo.org/viewtopic-p-4892618.html?sid=e41b07d9b8554c10430619e1f51d564a

I tried export LDFLAGS=" -lrt "

However it didn't appear to change anything, still the same error.

share|improve this question
    
May I suggest building your initramfs with dracut. It is very good at finding all the dependencies for dynamic builds and bringing them along to your initramfs. Lots of headaches eliminated ever since I switched. –  lkraav Jul 4 '13 at 1:52

1 Answer 1

up vote 3 down vote accepted

Works fine for me (in ~amd64 Gentoo), however try removing the udev useflag from lvm2 as a workaround, as udev is not important at initramfs stage. The static binary is called /sbin/lvm.static (requires static useflag to be built). You can check whether a binary is static or not using ldd.

echo sys-fs/lvm2 static -udev >> /etc/portage/package.use

Also check whether you have the static-libs useflag enabled, for the dependencies of the packages you wish to be built statically. Usually the ebuilds should check those dependencies for you, but better to double check.

share|improve this answer
    
That actually worked. However I'm not sure if it was the -udev or the static-libs that did it, or both. –  ioctlvoid Jul 2 '13 at 20:49

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.