Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
How to create a static lvm2 binary during Gentoo installatio
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Installing Gentoo
View previous topic :: View next topic  
Author Message
redcap
n00b
n00b


Joined: 10 Jul 2010
Posts: 22

PostPosted: Thu Jun 27, 2013 6:07 pm    Post subject: How to create a static lvm2 binary during Gentoo installatio Reply with quote

Hi there

I'm currently in the process of installing Gentoo on second box. The root fs will reside
in a lvm logical volume on top of a luks-encrypted device. I prefer to create my own initramfs
and consequently I need static binaries of lvm2 and cryptsetup. However

Quote:

livecd src # equery uses lvm2
[ Legend : U - final flag setting for installation]
[ : I - package is installed with flag ]
[ Colors : set, unset ]
* Found these USE flags for sys-fs/lvm2-2.02.97-r1:
U I
+ + lvm1 : Allow users to build lvm2 with lvm1 support
+ + readline : Enables support for libreadline, a GNU line-editing library that almost everyone wants
+ - static : !!do not set this during bootstrap!! Causes binaries to be statically linked instead of dynamically
+ + static-libs : Build static libraries
+ + thin : Support for thin volumes
+ + udev : Enable sys-fs/udev integration (device discovery, power and storage device support, etc)


Indeed, emerging lvm2 with static USE flag enabled doesn't work at all. Here's the build log:

http://pastebin.com/njY8ma6Z

Right now I'm puzzled. How am I supposed to create to finish bootstrapping/installation, if I won't be able to boot
my new system. Can anyone give me a little hint on how to obtain a static lvm2 binary in this situation?
Back to top
View user's profile Send private message
The Doctor
Veteran
Veteran


Joined: 27 Jul 2010
Posts: 1266

PostPosted: Thu Jun 27, 2013 7:32 pm    Post subject: Reply with quote

The use flag actually does work, although you may need to add static-libs. You can use ldd to confirm. A dynamic build will link to libraries. A static one will link to numbers. I would recommend you also use busybox. It makes the initramfs so much easier.

I don't know what is causing your build failure, but I suspect it is related to udev. You may be able to disable this use flag as a work around or update udev.
_________________
First things first, but not necessarily in that order.
Back to top
View user's profile Send private message
redcap
n00b
n00b


Joined: 10 Jul 2010
Posts: 22

PostPosted: Thu Jun 27, 2013 8:29 pm    Post subject: Reply with quote

Thanks for the input. You were indeed right. I changed USE flags to

Code:


Found these USE flags for sys-fs/lvm2-2.02.97-r1:
 U I
 + + lvm1        : Allow users to build lvm2 with lvm1 support
 + + readline    : Enables support for libreadline, a GNU line-editing library that almost everyone wants
 + + static      : !!do not set this during bootstrap!! Causes binaries to be statically linked instead of dynamically
 - - static-libs : Build static libraries
 + + thin        : Support for thin volumes
 - - udev        : Enable sys-fs/udev integration (device discovery, power and storage device support, etc)


and I was able to build lvm2. The relevant part of the build log seems to be

Code:

/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 found this post on in the Mailing List archives

http://archives.gentoo.org/gentoo-user/msg_eb40f5d76161fda72d134551cc26d989.xml

that seems to address a similar issue. Following the advice there I investigated /usr/lib64/librt.a

Code:

livecd initramfs # readelf -s /usr/lib64/librt.a | grep clock
File: /usr/lib64/librt.a(get_clockfreq.o)
     9: 0000000000000000   362 FUNC    GLOBAL DEFAULT    1 __get_clockfreq
File: /usr/lib64/librt.a(clock_getcpuclockid.o)
     7: 0000000000000000   207 FUNC    GLOBAL DEFAULT    1 clock_getcpuclockid
File: /usr/lib64/librt.a(clock_getres.o)
     9: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  UND __get_clockfreq
    10: 0000000000000060   403 FUNC    GLOBAL DEFAULT    1 clock_getres
File: /usr/lib64/librt.a(clock_gettime.o)
     9: 0000000000000000     0 NOTYPE  WEAK   DEFAULT  UND __pthread_clock_gettime
    10: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  UND _dl_cpuclock_offset
    11: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  UND __get_clockfreq
    12: 0000000000000090   375 FUNC    GLOBAL DEFAULT    1 clock_gettime
File: /usr/lib64/librt.a(clock_settime.o)
     8: 0000000000000000   410 FUNC    GLOBAL DEFAULT    1 clock_settime
    12: 0000000000000000     0 NOTYPE  WEAK   DEFAULT  UND __pthread_clock_settime
    13: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  UND _dl_cpuclock_offset
    14: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  UND __get_clockfreq
File: /usr/lib64/librt.a(clock_nanosleep.o)
     7: 0000000000000000   144 FUNC    GLOBAL DEFAULT    1 clock_nanosleep


I don't have any experience with these library issues and therefore I can not really interpret this output but it seems that `clock_gettime' is
defined. Well, maybe someone can shed some light on this issue. In the meantime I will try to proceed with lvm2 without udev support.

Thanks again for your help, very much appreciated :-)
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Installing Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum