lvmteam / lvm2

Mirror of upstream LVM2 repository
https://gitlab.com/lvmteam/lvm2
GNU General Public License v2.0
134 stars 72 forks source link

./configure fails with checking for pthread_mutex_lock in -lpthread... no #140

Closed PrajvalBadiger closed 9 months ago

PrajvalBadiger commented 9 months ago

We are seeing the following issue while compiling LVM2 after glibc upgrade from 2.30 to 2.38

checking for pthread_mutex_lock in -lpthread... no
configure: error: bailing out

LVM2 version: 2.02.177

Build commands:

CFLAGS='-g'
./configure --build=none --host=x86_64-linux-gnu --prefix=/usr --libdir=/usr/lib64 \
        --enable-udev_rules --enable-lvmetad --sbindir=/usr/bin \
        ac_cv_func_malloc_0_nonnull=yes ac_cv_func_realloc_0_nonnull=yes
make

Environment

Custom Linux OS kernel: 4.19.302 gcc: 8.4.0

Full Log:

./configure --build=none --host=x86_64-linux-gnu --prefix=/usr --libdir=/usr/lib64 --enable-udev_rules --enable-lvmetad --sbindir=/usr/bin ac_cv_func_malloc_0_nonnull=yes ac_cv_func_realloc_0_nonnull=yes
checking build system type... none-none-none
checking host system type... x86_64-pc-linux-gnu
checking target system type... x86_64-pc-linux-gnu
checking for a sed that does not truncate output... /bin/sed
checking for gawk... gawk
checking for x86_64-linux-gnu-gcc... x86_64-linux-gnu-gcc --sysroot=/root/prajval/build_repos/distro/work/x86_64/initramfs/x86_64-linux-gnu
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... yes
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether x86_64-linux-gnu-gcc --sysroot=/root/prajval/build_repos/distro/work/x86_64/initramfs/x86_64-linux-gnu accepts -g... yes
checking for x86_64-linux-gnu-gcc --sysroot=/root/prajval/build_repos/distro/work/x86_64/initramfs/x86_64-linux-gnu option to accept ISO C89... none needed
checking for x86_64-linux-gnu-g++... x86_64-linux-gnu-g++
checking whether we are using the GNU C++ compiler... yes
checking whether x86_64-linux-gnu-g++ accepts -g... yes
checking how to run the C preprocessor... x86_64-linux-gnu-gcc --sysroot=/root/prajval/build_repos/distro/work/x86_64/initramfs/x86_64-linux-gnu -E
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking whether x86_64-linux-gnu-gcc --sysroot=/root/prajval/build_repos/distro/work/x86_64/initramfs/x86_64-linux-gnu needs -traditional... no
checking for a BSD-compatible install... /usr/bin/install -c
checking whether ln -s works... yes
checking whether make sets $(MAKE)... yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for x86_64-linux-gnu-ranlib... x86_64-linux-gnu-ranlib
checking for x86_64-linux-gnu-ar... x86_64-linux-gnu-ar
checking for x86_64-linux-gnu-cflow... no
checking for cflow... no
checking for x86_64-linux-gnu-cscope... no
checking for cscope... no
checking for x86_64-linux-gnu-chmod... no
checking for chmod... /bin/chmod
configure: WARNING: using cross tools not prefixed with host triplet
checking for x86_64-linux-gnu-wc... no
checking for wc... /usr/bin/wc
checking for x86_64-linux-gnu-sort... no
checking for sort... /usr/bin/sort
checking for dirent.h that defines DIR... yes
checking for library containing opendir... none required
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking whether sys/types.h defines makedev... no
checking sys/mkdev.h usability... no
checking sys/mkdev.h presence... no
checking for sys/mkdev.h... no
checking sys/sysmacros.h usability... yes
checking sys/sysmacros.h presence... yes
checking for sys/sysmacros.h... yes
checking for stdbool.h that conforms to C99... yes
checking for _Bool... yes
checking for ANSI C header files... (cached) yes
checking for sys/wait.h that is POSIX.1 compatible... yes
checking whether time.h and sys/time.h may both be included... yes
checking assert.h usability... yes
checking assert.h presence... yes
checking for assert.h... yes
checking ctype.h usability... yes
checking ctype.h presence... yes
checking for ctype.h... yes
checking dirent.h usability... yes
checking dirent.h presence... yes
checking for dirent.h... yes
checking errno.h usability... yes
checking errno.h presence... yes
checking for errno.h... yes
checking fcntl.h usability... yes
checking fcntl.h presence... yes
checking for fcntl.h... yes
checking float.h usability... yes
checking float.h presence... yes
checking for float.h... yes
checking getopt.h usability... yes
checking getopt.h presence... yes
checking for getopt.h... yes
checking for inttypes.h... (cached) yes
checking langinfo.h usability... yes
checking langinfo.h presence... yes
checking for langinfo.h... yes
checking libgen.h usability... yes
checking libgen.h presence... yes
checking for libgen.h... yes
checking limits.h usability... yes
checking limits.h presence... yes
checking for limits.h... yes
checking locale.h usability... yes
checking locale.h presence... yes
checking for locale.h... yes
checking paths.h usability... yes
checking paths.h presence... yes
checking for paths.h... yes
checking signal.h usability... yes
checking signal.h presence... yes
checking for signal.h... yes
checking stdarg.h usability... yes
checking stdarg.h presence... yes
checking for stdarg.h... yes
checking stddef.h usability... yes
checking stddef.h presence... yes
checking for stddef.h... yes
checking stdio.h usability... yes
checking stdio.h presence... yes
checking for stdio.h... yes
checking for stdlib.h... (cached) yes
checking for string.h... (cached) yes
checking sys/file.h usability... yes
checking sys/file.h presence... yes
checking for sys/file.h... yes
checking sys/ioctl.h usability... yes
checking sys/ioctl.h presence... yes
checking for sys/ioctl.h... yes
checking syslog.h usability... yes
checking syslog.h presence... yes
checking for syslog.h... yes
checking sys/mman.h usability... yes
checking sys/mman.h presence... yes
checking for sys/mman.h... yes
checking sys/param.h usability... yes
checking sys/param.h presence... yes
checking for sys/param.h... yes
checking sys/resource.h usability... yes
checking sys/resource.h presence... yes
checking for sys/resource.h... yes
checking for sys/stat.h... (cached) yes
checking sys/time.h usability... yes
checking sys/time.h presence... yes
checking for sys/time.h... yes
checking for sys/types.h... (cached) yes
checking sys/utsname.h usability... yes
checking sys/utsname.h presence... yes
checking for sys/utsname.h... yes
checking for sys/wait.h... (cached) yes
checking time.h usability... yes
checking time.h presence... yes
checking for time.h... yes
checking for unistd.h... (cached) yes
checking termios.h usability... yes
checking termios.h presence... yes
checking for termios.h... yes
checking sys/statvfs.h usability... yes
checking sys/statvfs.h presence... yes
checking for sys/statvfs.h... yes
checking sys/timerfd.h usability... yes
checking sys/timerfd.h presence... yes
checking for sys/timerfd.h... yes
checking sys/vfs.h usability... yes
checking sys/vfs.h presence... yes
checking for sys/vfs.h... yes
checking linux/magic.h usability... yes
checking linux/magic.h presence... yes
checking for linux/magic.h... yes
checking linux/fiemap.h usability... yes
checking linux/fiemap.h presence... yes
checking for linux/fiemap.h... yes
checking asm/byteorder.h usability... yes
checking asm/byteorder.h presence... yes
checking for asm/byteorder.h... yes
checking linux/fs.h usability... yes
checking linux/fs.h presence... yes
checking for linux/fs.h... yes
checking malloc.h usability... yes
checking malloc.h presence... yes
checking for malloc.h... yes
checking for an ANSI C-conforming const... yes
checking for inline... inline
checking for struct stat.st_rdev... yes
checking for ptrdiff_t... yes
checking for struct stat.st_blocks... yes
checking whether struct tm is in sys/time.h or time.h... time.h
checking for off_t... yes
checking for pid_t... yes
checking return type of signal handlers... void
checking for size_t... yes
checking for mode_t... yes
checking for int8_t... yes
checking for int16_t... yes
checking for int32_t... yes
checking for int64_t... yes
checking for ssize_t... yes
checking for uid_t in sys/types.h... yes
checking for uint8_t... yes
checking for uint16_t... yes
checking for uint32_t... yes
checking for uint64_t... yes
checking for __builtin_clz... yes
checking for ftruncate... yes
checking for gethostname... yes
checking for getpagesize... yes
checking for gettimeofday... yes
checking for localtime_r... yes
checking for memchr... yes
checking for memset... yes
checking for mkdir... yes
checking for mkfifo... yes
checking for munmap... yes
checking for nl_langinfo... yes
checking for realpath... yes
checking for rmdir... yes
checking for setenv... yes
checking for setlocale... yes
checking for strcasecmp... yes
checking for strchr... yes
checking for strcspn... yes
checking for strdup... yes
checking for strerror... yes
checking for strncasecmp... yes
checking for strndup... yes
checking for strrchr... yes
checking for strspn... yes
checking for strstr... yes
checking for strtol... yes
checking for strtoul... yes
checking for uname... yes
checking for working alloca.h... yes
checking for alloca... yes
checking whether closedir returns void... yes
checking for unistd.h... (cached) yes
checking for working chown... no
checking vfork.h usability... no
checking vfork.h presence... no
checking for vfork.h... no
checking for fork... yes
checking for vfork... yes
checking for working fork... cross
configure: WARNING: result yes guessed because of cross compilation
checking for working vfork... (cached) yes
checking whether lstat correctly handles trailing slash... no
checking whether lstat accepts an empty string... yes
checking for stdlib.h... (cached) yes
checking for GNU libc compatible malloc... (cached) yes
checking for working memcmp... no
checking for sys/time.h... (cached) yes
checking for unistd.h... (cached) yes
checking for stdlib.h... (cached) yes
checking for sys/param.h... (cached) yes
checking for alarm... yes
checking for working mktime... no
checking for getpagesize... (cached) yes
checking for working mmap... no
checking for stdlib.h... (cached) yes
checking for GNU libc compatible realloc... (cached) yes
checking whether stat accepts an empty string... yes
checking for working strtod... no
checking for pow... no
checking for pow in -lm... yes
checking for vprintf... yes
checking for _doprnt... no
checking whether to enable dependency tracking... yes
checking whether to use static linking... no
checking whether x86_64-linux-gnu-gcc --sysroot=/root/prajval/build_repos/distro/work/x86_64/initramfs/x86_64-linux-gnu accepts -pie flag... yes
checking whether x86_64-linux-gnu-gcc --sysroot=/root/prajval/build_repos/distro/work/x86_64/initramfs/x86_64-linux-gnu accepts -Wl,-z,relro,-z,now ld flags... yes
checking file owner... 
checking group owner... 
checking device node uid... 0
checking device node gid... 0
checking device node mode... 0600
checking when to create device nodes... on resume
checking default name mangling... auto
checking whether to enable lvm1 fallback... no
checking whether to include support for lvm1 metadata... internal
checking whether to include support for GFS pool metadata... internal
checking whether to include support for cluster locking... internal
checking whether to include snapshots... internal
checking whether to include mirrors... internal
checking whether to include raid... internal
checking whether to include thin provisioning... internal
checking for x86_64-linux-gnu-thin_check... no
checking for thin_check... no
configure: WARNING: thin_check not found in path /root/prajval/build_repos/distro/work/x86_64/toolchain/bin:/root/prajval/build_repos/distro/work/host/utils/bin:/root/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/root/prajval/.dotfiles/src/fzf/bin
configure: WARNING: /usr/sbin/thin_check: Bad version "" found
checking for x86_64-linux-gnu-thin_dump... no
checking for thin_dump... no
configure: WARNING: thin_dump not found in path /root/prajval/build_repos/distro/work/x86_64/toolchain/bin:/root/prajval/build_repos/distro/work/host/utils/bin:/root/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/root/prajval/.dotfiles/src/fzf/bin
checking for x86_64-linux-gnu-thin_repair... no
checking for thin_repair... no
configure: WARNING: thin_repair not found in path /root/prajval/build_repos/distro/work/x86_64/toolchain/bin:/root/prajval/build_repos/distro/work/host/utils/bin:/root/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/root/prajval/.dotfiles/src/fzf/bin
checking for x86_64-linux-gnu-thin_restore... no
checking for thin_restore... no
configure: WARNING: thin_restore not found in path /root/prajval/build_repos/distro/work/x86_64/toolchain/bin:/root/prajval/build_repos/distro/work/host/utils/bin:/root/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/root/prajval/.dotfiles/src/fzf/bin
checking whether thin_check supports the needs-check flag... no
checking whether to include cache... internal
checking for x86_64-linux-gnu-cache_check... no
checking for cache_check... no
configure: WARNING: cache_check not found in path /root/prajval/build_repos/distro/work/x86_64/toolchain/bin:/root/prajval/build_repos/distro/work/host/utils/bin:/root/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/root/prajval/.dotfiles/src/fzf/bin
configure: WARNING: /usr/sbin/cache_check: Bad version "" found
checking for x86_64-linux-gnu-cache_dump... no
checking for cache_dump... no
configure: WARNING: cache_dump not found in path /root/prajval/build_repos/distro/work/x86_64/toolchain/bin:/root/prajval/build_repos/distro/work/host/utils/bin:/root/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/root/prajval/.dotfiles/src/fzf/bin
checking for x86_64-linux-gnu-cache_repair... no
checking for cache_repair... no
configure: WARNING: cache_repair not found in path /root/prajval/build_repos/distro/work/x86_64/toolchain/bin:/root/prajval/build_repos/distro/work/host/utils/bin:/root/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/root/prajval/.dotfiles/src/fzf/bin
checking for x86_64-linux-gnu-cache_restore... no
checking for cache_restore... no
configure: WARNING: cache_restore not found in path /root/prajval/build_repos/distro/work/x86_64/toolchain/bin:/root/prajval/build_repos/distro/work/host/utils/bin:/root/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/root/prajval/.dotfiles/src/fzf/bin
checking whether cache_check supports the needs-check flag... no
checking whether to enable realtime support... yes
checking whether to enable OCF resource agents... no
checking for default run directory... /run
checking whether to build cluster LVM daemon... none
checking whether to build cluster mirror log daemon... no
checking whether to enable debugging... no
checking whether x86_64-linux-gnu-gcc --sysroot=/root/prajval/build_repos/distro/work/x86_64/initramfs/x86_64-linux-gnu accepts -Wjump-misses-init flag... yes
checking whether x86_64-linux-gnu-gcc --sysroot=/root/prajval/build_repos/distro/work/x86_64/initramfs/x86_64-linux-gnu accepts -Wclobbered flag... yes
checking whether x86_64-linux-gnu-gcc --sysroot=/root/prajval/build_repos/distro/work/x86_64/initramfs/x86_64-linux-gnu accepts -Wsync-nand flag... yes
checking for C optimisation flag... -O2
checking whether to gather gcov profiling data... no
checking whether to enable unit testing... no
checking whether to enable valgrind awareness of pools... no
checking for x86_64-linux-gnu-pkg-config... /root/prajval/build_repos/distro/work/x86_64/toolchain/bin/x86_64-linux-gnu-pkg-config
checking pkg-config is at least version 0.9.0... yes
checking for PKGCONFIGINIT... no
pkg-config initialized
checking for VALGRIND... no
checking whether to use device-mapper... yes
checking whether to build LVMetaD... yes
checking whether to build lvmpolld... no
checking whether to build lvmlockdsanlock... no
checking whether to build lvmlockddlm... no
checking whether to build lvmlockd... no
checking defaults for use_lvmetad... 1
checking whether to build dmfilemapd... no
checking whether to build notifydbus... no
checking for BLKID... no
checking whether to enable libblkid detection of signatures when wiping... no
checking for SYSTEMD... no
checking whether to use udev-systemd protocol for jobs in background... no
checking whether to enable synchronisation with udev processing... no
checking whether to enable installation of udev rules required for synchronisation... yes
checking whether to enable executable path detection in udev rules... no
checking whether udev supports built-in blkid... no
checking whether to enable O_DIRECT... yes
checking whether to build liblvm2app.so application library... no
configure: WARNING: liblvm2app is deprecated. Use D-Bus API
checking whether to compile liblvm2cmd.so... no
checking whether to include Python D-Bus support... no
checking whether to build Python wrapper for liblvm2app.so... no
checking whether to build Python2 wrapper for liblvm2app.so... no
checking whether to build Python3 wrapper for liblvm2app.so... no
checking whether to install fsadm... yes
checking whether to install blkdeactivate... yes
checking whether to use dmeventd... no
checking for getline in -lc... yes
checking for canonicalize_file_name in -lc... yes
checking for dlopen in -ldl... no
checking for log10 in -lm... yes
checking for pthread_mutex_lock in -lpthread... no
configure: error: bailing out
zkabelac commented 9 months ago

Looks like failure in your CustomLinux OS installation. lvm2 needs pthreads - so if they are not available on your system possibly after faulty upgrade - lvm2 configure correctly failed - as it cannot be compiled without this library.

PrajvalBadiger commented 9 months ago

thanks for the response. I see that pthreads library is already installed on the system and is present in the /lib64 directory. ldconfig -v also shows pthread library.

[distro /lib64] # ldconfig -v | grep pthread
        libpthread.so.0 -> libpthread-2.30.so
        libevent_pthreads-2.1.so.7 -> libevent_pthreads.so

[distro /lib64] # ls -l libpthread*
-rwxr-xr-x 1 root root 114248 Jan  1 08:04 libpthread-2.30.so
lrwxrwxrwx 1 root root     18 Jan  1 14:11 libpthread.so.0 -> libpthread-2.30.so
[distro /lib64] #
zkabelac commented 9 months ago

Pthread is bit more trickier with glibc as it comes embedded into libc itself. So see 'objdump -t /lib64/libc.so.6 | grep pthread_mutex_lock'

Do you compile glibc yourself ?

PrajvalBadiger commented 9 months ago

objdump -t /lib64/libc.so.6 | grep pthread_mutex_lock - don't show anything maybe because the .so file is stripped

distro ~] # objdump -t /lib64/libc-2.30.so

/lib64/libc-2.30.so:     file format elf64-x86-64

SYMBOL TABLE:
no symbols

[distro ~] # file /lib64/libc-2.30.so
/lib64/libc-2.30.so: ELF 64-bit LSB shared object, x86-64, version 1 (GNU/Linux), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 3.2.0, stripped
[distro ~] #

Yes, we compile glibc ourselves. This issue is observed when glibc is upgraded from v2.30 to v2.38 or v2.35. I tried compiling a simple c program which uses the pthread_mutex_lock and passed -lpthread while compiling, the program compiles and runs without any issue.

zkabelac commented 9 months ago

Well it's quite hard to guess&diagnose the issue on your locally build distro.

You could likely try yourself what is being compiled by configure script - which should be approximately this:

----- test.c ---- char pthread_mutex_lock (); int main (void) { return pthread_mutex_lock (); ; return 0; }

gcc -o test test.c -lpthread

This should be compilable - if your libraries are properly buiit and installed. If this does not work - you will likely need to consult expert on glibc and your distro.

PrajvalBadiger commented 9 months ago

The test code fails with Segmentation fault (core dumped).

[distro ~] # cat test.c
char pthread_mutex_lock();
int main(void) {
  return pthread_mutex_lock();
  ;
  return 0;
}
[distro ~] # gcc -o test test.c -lpthread
[distro ~] # ./test
Segmentation fault (core dumped)
[distro ~] # gcc -g -o test test.c -lpthread
[distro ~] # gdb test
GNU gdb (GDB) 13.2
Copyright (C) 2023 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from test...
(gdb) r
Starting program: /root/test
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".

Program received signal SIGSEGV, Segmentation fault.
__GI___pthread_mutex_lock (mutex=0x1) at ../nptl/pthread_mutex_lock.c:67
67      ../nptl/pthread_mutex_lock.c: No such file or directory.
(gdb)
zkabelac commented 9 months ago

It's not supposed to be executed - only compiled - but your 'configure' suggested it's failing.

Can you attach config.log ?

(make distclean ; rm -f config.log

configure

and attach created config.log