如何构建libdevmapper静态库?

时间:2017-06-28 09:56:06

标签: c linux docker

我想在centos 7中构建docker源,它使用go和c ++,它依赖于lib lvm(libdevmapper),我的问题是:如何构建libdevmapper静态库?

当我用configure flags编译它时: [test @ localhost lvm2] $ ./configure --enable-static_link --disable-selinux

make && make install

make[1]: Entering directory `/home/test/modi-source/thirdSoftware/lvm2/tools'
gcc -O2  -fPIC -O2  -L../libdm -L../lib -L../libdaemon/client -static -L../libdm/ioctl -o lvm.static \
      command.o dumpconfig.o formats.o lvchange.o lvconvert.o lvconvert_poll.o lvcreate.o lvdisplay.o lvextend.o lvmcmdline.o lvmdiskscan.o lvreduce.o lvremove.o lvrename.o lvresize.o lvscan.o polldaemon.o pvchange.o pvck.o pvcreate.o pvdisplay.o pvmove.o pvmove_poll.o pvremove.o pvresize.o pvscan.o reporter.o segtypes.o tags.o toollib.o vgcfgbackup.o vgcfgrestore.o vgchange.o vgck.o vgcreate.o vgconvert.o vgdisplay.o vgexport.o vgextend.o vgimport.o vgmerge.o vgmknodes.o lvpoll.o vgimportclone.o vgreduce.o vgremove.o vgrename.o vgscan.o vgsplit.o  lvm-static.o -llvm-internal -ldaemonclient  -ldl  -ldevmapper    -lrt 
../lib/liblvm-internal.a(sharedlib.o): In function `load_shared_library':
sharedlib.c:(.text+0x131): warning: Using 'dlopen' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
../libdm/ioctl/libdevmapper.a(libdm-string.o): In function `dm_size_to_string':
libdm-string.c:(.text+0x11d0): undefined reference to `nearbyint'
libdm-string.c:(.text+0x11e5): undefined reference to `floor'
../libdm/ioctl/libdevmapper.a(pool.o): In function `dm_pool_create':
pool.c:(.text+0x15c): undefined reference to `pthread_mutex_lock'
pool.c:(.text+0x177): undefined reference to `pthread_mutex_unlock'
../libdm/ioctl/libdevmapper.a(pool.o): In function `dm_pool_destroy':
pool.c:(.text+0x1f9): undefined reference to `pthread_mutex_lock'
pool.c:(.text+0x20d): undefined reference to `pthread_mutex_unlock'
../libdm/ioctl/libdevmapper.a(pool.o): In function `dm_pools_check_leaks':
pool.c:(.text+0x640): undefined reference to `pthread_mutex_lock'
pool.c:(.text+0x6d5): undefined reference to `pthread_mutex_unlock'
pool.c:(.text+0x720): undefined reference to `pthread_mutex_unlock'
/usr/lib/gcc/x86_64-redhat-linux/4.8.5/libgcc_eh.a(unwind-dw2-fde-dip.o): In function `__register_frame_info_bases':

任何一个构建libdevmapper的人都可以静态吗? wuwuwuuwuw ......

1 个答案:

答案 0 :(得分:0)

我修正了,当DM版本> 97时。并且glibc将被更新,因此,所有的lib都将在静态lib文件中进行压缩(exp.libdevmapper.a使用libudev.a)。