Source: lvm2 Version: 2.02.168-2 I downloaded the package source files by running "apt-get source lvm2" Then I ran "./configure --enable-static-link && make"
Configuration was successful but compilation throws up linker errors when it gets to dmsetup.c. Below is the last part of the compiler log: gcc -c -I. -I../include -DHAVE_CONFIG_H -Wall -Wcast-align -Wfloat-equal -Wformat-security -Winline -Wmissing-format-attribute -Wmissing-include-dirs -Wmissing-noreturn -Wpointer-arith -Wredundant-decls -Wshadow -Wundef -Wwrite-strings -Wclobbered -Wempty-body -Wignored-qualifiers -Wlogical-op -Wtype-limits -Wsync-nand -Wmissing-declarations -Wmissing-prototypes -Wnested-externs -Wold-style-definition -Wstrict-prototypes -Wuninitialized -Wjump-misses-init -Wmissing-parameter-type -Wold-style-declaration -Woverride-init -O2 -fPIC dmsetup.c -o dmsetup.o gcc -O2 -fPIC -O2 -L../libdm -L../lib -L../libdaemon/client -L../libdm -o dmsetup dmsetup.o -ldevmapper -lrt gcc -O2 -fPIC -O2 -L../libdm -L../lib -L../libdaemon/client -static -L../libdm/ioctl -o dmsetup.static dmsetup.o -ldevmapper -lm -lpthread -lselinux -lsepol -lrt /usr/lib/gcc/x86_64-linux-gnu/6/../../../x86_64-linux-gnu/libselinux.a(seusers.o): In function `getseuserbyname': (.text+0x632): 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-linux-gnu/6/../../../x86_64-linux-gnu/libselinux.a(seusers.o): In function `getseuserbyname': (.text+0x5b0): 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-linux-gnu/6/../../../x86_64-linux-gnu/libselinux.a(seusers.o): In function `getseuserbyname': (.text+0x499): 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-linux-gnu/6/../../../x86_64-linux-gnu/libselinux.a(regex.o): In function `regex_writef': (.text+0x7b): undefined reference to `pcre_fullinfo' /usr/lib/gcc/x86_64-linux-gnu/6/../../../x86_64-linux-gnu/libselinux.a(regex.o): In function `regex_writef': (.text+0xef): undefined reference to `pcre_fullinfo' /usr/lib/gcc/x86_64-linux-gnu/6/../../../x86_64-linux-gnu/libselinux.a(regex.o): In function `regex_data_free': (.text+0x1ea): undefined reference to `pcre_free' /usr/lib/gcc/x86_64-linux-gnu/6/../../../x86_64-linux-gnu/libselinux.a(regex.o): In function `regex_data_free': (.text+0x1f8): undefined reference to `pcre_free_study' /usr/lib/gcc/x86_64-linux-gnu/6/../../../x86_64-linux-gnu/libselinux.a(regex.o): In function `regex_prepare_data': (.text+0x260): undefined reference to `pcre_compile' /usr/lib/gcc/x86_64-linux-gnu/6/../../../x86_64-linux-gnu/libselinux.a(regex.o): In function `regex_prepare_data': (.text+0x282): undefined reference to `pcre_study' /usr/lib/gcc/x86_64-linux-gnu/6/../../../x86_64-linux-gnu/libselinux.a(regex.o): In function `regex_load_mmap': (.text+0x38e): undefined reference to `pcre_fullinfo' /usr/lib/gcc/x86_64-linux-gnu/6/../../../x86_64-linux-gnu/libselinux.a(regex.o): In function `regex_load_mmap': (.text+0x414): undefined reference to `pcre_fullinfo' /usr/lib/gcc/x86_64-linux-gnu/6/../../../x86_64-linux-gnu/libselinux.a(regex.o): In function `regex_match': (.text+0x47f): undefined reference to `pcre_exec' /usr/lib/gcc/x86_64-linux-gnu/6/../../../x86_64-linux-gnu/libselinux.a(regex.o): In function `regex_cmp': (.text+0x4ed): undefined reference to `pcre_fullinfo' /usr/lib/gcc/x86_64-linux-gnu/6/../../../x86_64-linux-gnu/libselinux.a(regex.o): In function `regex_cmp': (.text+0x50a): undefined reference to `pcre_fullinfo' /usr/lib/gcc/x86_64-linux-gnu/6/../../../x86_64-linux-gnu/libselinux.a(regex.o): In function `regex_version': (.text+0x11): undefined reference to `pcre_version' collect2: error: ld returned 1 exit status Makefile:133: recipe for target 'dmsetup.static' failed make[1]: *** [dmsetup.static] Error 1 make[1]: Leaving directory '/home/user/myapps/src/stretch/lvm2-2.02.168/tools' make.tmpl:302: recipe for target 'tools.device-mapper' failed make: *** [tools.device-mapper] Error 2 I was able to fix this by appending -lpcre to STATIC_LIBS in make.tmpl.in. After running configure and make, linker errors appeared when it came to creating lvm.static. Below is the last part of the compiler log: gcc -O2 -fPIC -O2 -L../libdm -L../lib -L../libdaemon/client -static -L../libdm/ioctl -o lvm.static dumpconfig.o formats.o lvchange.o lvconvert.o lvconvert_poll.o lvcreate.o lvdisplay.o lvextend.o lvmchange.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 -lselinux -lsepol -lpcre -lrt ../lib/liblvm-internal.a(sharedlib.o): In function `load_shared_library': sharedlib.c:(.text+0x130): warning: Using 'dlopen' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking /usr/lib/gcc/x86_64-linux-gnu/6/../../../x86_64-linux-gnu/libselinux.a(seusers.o): In function `getseuserbyname': (.text+0x632): 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-linux-gnu/6/../../../x86_64-linux-gnu/libselinux.a(seusers.o): In function `getseuserbyname': (.text+0x5b0): 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-linux-gnu/6/../../../x86_64-linux-gnu/libselinux.a(seusers.o): In function `getseuserbyname': (.text+0x499): warning: Using 'getpwnam_r' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking ../libdm/ioctl/libdevmapper.a(pool.o): In function `dm_pool_create': pool.c:(.text+0xf4): undefined reference to `pthread_mutex_lock' pool.c:(.text+0x10f): undefined reference to `pthread_mutex_unlock' ../libdm/ioctl/libdevmapper.a(pool.o): In function `dm_pool_destroy': pool.c:(.text+0x199): undefined reference to `pthread_mutex_lock' pool.c:(.text+0x1ad): undefined reference to `pthread_mutex_unlock' ../libdm/ioctl/libdevmapper.a(pool.o): In function `dm_pools_check_leaks': pool.c:(.text+0x5e2): undefined reference to `pthread_mutex_lock' pool.c:(.text+0x67a): undefined reference to `pthread_mutex_unlock' pool.c:(.text+0x6c2): undefined reference to `pthread_mutex_unlock' /usr/lib/gcc/x86_64-linux-gnu/6/../../../x86_64-linux-gnu/libpcre.a(libpcre_la-pcre_jit_compile.o): In function `sljit_generate_code': (.text+0x816): undefined reference to `pthread_mutex_lock' /usr/lib/gcc/x86_64-linux-gnu/6/../../../x86_64-linux-gnu/libpcre.a(libpcre_la-pcre_jit_compile.o): In function `sljit_generate_code': (.text+0x91b): undefined reference to `pthread_mutex_unlock' /usr/lib/gcc/x86_64-linux-gnu/6/../../../x86_64-linux-gnu/libpcre.a(libpcre_la-pcre_jit_compile.o): In function `sljit_generate_code': (.text+0xcc5): undefined reference to `pthread_mutex_unlock' /usr/lib/gcc/x86_64-linux-gnu/6/../../../x86_64-linux-gnu/libpcre.a(libpcre_la-pcre_jit_compile.o): In function `sljit_generate_code': (.text+0xd28): undefined reference to `pthread_mutex_unlock' /usr/lib/gcc/x86_64-linux-gnu/6/../../../x86_64-linux-gnu/libpcre.a(libpcre_la-pcre_jit_compile.o): In function `sljit_free_exec': (.text+0xd6c): undefined reference to `pthread_mutex_lock' /usr/lib/gcc/x86_64-linux-gnu/6/../../../x86_64-linux-gnu/libpcre.a(libpcre_la-pcre_jit_compile.o): In function `pcre_jit_free_unused_memory': (.text+0x290d9): undefined reference to `pthread_mutex_lock' /usr/lib/gcc/x86_64-linux-gnu/6/../../../x86_64-linux-gnu/libpcre.a(libpcre_la-pcre_jit_compile.o): In function `sljit_free_exec': (.text+0xddb): undefined reference to `pthread_mutex_unlock' /usr/lib/gcc/x86_64-linux-gnu/6/../../../x86_64-linux-gnu/libpcre.a(libpcre_la-pcre_jit_compile.o): In function `pcre_jit_free_unused_memory': (.text+0x29149): undefined reference to `pthread_mutex_unlock' /usr/lib/gcc/x86_64-linux-gnu/6/libgcc_eh.a(unwind-dw2-fde-dip.o): In function `__register_frame_info.part.4': (.text+0x1692): undefined reference to `pthread_mutex_lock' /usr/lib/gcc/x86_64-linux-gnu/6/libgcc_eh.a(unwind-dw2-fde-dip.o): In function `__register_frame_info_bases': (.text+0x1717): undefined reference to `pthread_mutex_lock' /usr/lib/gcc/x86_64-linux-gnu/6/libgcc_eh.a(unwind-dw2-fde-dip.o): In function `__register_frame_info_table_bases': (.text+0x17eb): undefined reference to `pthread_mutex_lock' /usr/lib/gcc/x86_64-linux-gnu/6/libgcc_eh.a(unwind-dw2-fde-dip.o): In function `__deregister_frame_info_bases': (.text+0x188e): undefined reference to `pthread_mutex_lock' /usr/lib/gcc/x86_64-linux-gnu/6/libgcc_eh.a(unwind-dw2-fde-dip.o): In function `__deregister_frame_info_bases': (.text+0x1916): undefined reference to `pthread_mutex_unlock' /usr/lib/gcc/x86_64-linux-gnu/6/libgcc_eh.a(unwind-dw2-fde-dip.o): In function `_Unwind_Find_FDE': (.text+0x19e8): undefined reference to `pthread_mutex_lock' /usr/lib/gcc/x86_64-linux-gnu/6/libgcc_eh.a(unwind-dw2-fde-dip.o): In function `_Unwind_Find_FDE': (.text+0x1a32): undefined reference to `pthread_mutex_unlock' /usr/lib/gcc/x86_64-linux-gnu/6/libgcc_eh.a(unwind-dw2-fde-dip.o): In function `_Unwind_Find_FDE': (.text+0x1b2b): undefined reference to `pthread_mutex_unlock' /usr/lib/gcc/x86_64-linux-gnu/6/libgcc_eh.a(unwind-dw2-fde-dip.o): In function `__register_frame_info.part.4': (.text+0x16b1): undefined reference to `pthread_mutex_unlock' /usr/lib/gcc/x86_64-linux-gnu/6/libgcc_eh.a(unwind-dw2-fde-dip.o): In function `__register_frame_info_bases': (.text+0x1736): undefined reference to `pthread_mutex_unlock' /usr/lib/gcc/x86_64-linux-gnu/6/libgcc_eh.a(unwind-dw2-fde-dip.o): In function `__register_frame_info_table_bases': (.text+0x180a): undefined reference to `pthread_mutex_unlock' collect2: error: ld returned 1 exit status Makefile:150: recipe for target 'lvm.static' failed make[1]: *** [lvm.static] Error 1 make[1]: Leaving directory '/home/user/myapps/src/stretch/lvm2-2.02.168/tools' make.tmpl:299: recipe for target 'tools' failed make: *** [tools] Error 2 I was able to fix this by appending -lm -lpthread to STATIC_LIBS in make.tmpl.in I am not sure if I am doing the right thing and I am hoping this will be fixed. I am running Debian Stretch with all packages updated as of date. I've installed gcc using "apt-get install gcc"