]> git.ipfire.org Git - thirdparty/shadow.git/commitdiff
Link correctly with libdl
authorSam James <sam@gentoo.org>
Sun, 21 Jan 2024 14:58:33 +0000 (14:58 +0000)
committerAlejandro Colomar <alx@kernel.org>
Fri, 26 Jan 2024 12:32:08 +0000 (13:32 +0100)
This fixes build with glibc-2.33 (newer glibc merged libdl and libpthread
into libc):
```
libtool: link: x86_64-pc-linux-gnu-gcc -isystem /usr/include/bsd -DLIBBSD_OVERLAY -O2 -pipe -Wl,-O1 -o login login.o login_nopam.o  -Wl,--as-needed ../lib/.libs/libshadow.a -lcrypt -lsystemd -lpam -lpam_misc -lbsd
/usr/lib/gcc/x86_64-pc-linux-gnu/13/../../../../x86_64-pc-linux-gnu/bin/ld: ../lib/.libs/libshadow.a(libshadow_la-nss.o): undefined reference to symbol 'dlclose@@GLIBC_2.2.5'
/usr/lib/gcc/x86_64-pc-linux-gnu/13/../../../../x86_64-pc-linux-gnu/bin/ld: /lib64/libdl.so.2: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
```

In Debian, the needed macro from libtool seems to be in libltdl-dev.

Signed-off-by: Sam James <sam@gentoo.org>
Cc: Iker Pedrosa <ikerpedrosam@gmail.com>
Cherry-picked-from: 0f4e59fd00cf ("Link correctly with libdl")
Link: <https://github.com/shadow-maint/shadow/pull/917>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
configure.ac
lib/Makefile.am
share/containers/debian.dockerfile

index 5dcd22e3b439b97d9c17c1297196f02397321d93..79250fcafffaaf878cb7e4d33053e06361b1040a 100644 (file)
@@ -32,6 +32,7 @@ AC_PROG_CC
 AC_PROG_LN_S
 AC_PROG_YACC
 LT_INIT
+LT_LIB_DLLOAD
 
 dnl Checks for libraries.
 
index ca73313dc242f103c9d00918b3644e60ca5f6286..7db960c8cd192fcfb257a1a1ba0b8f9f45c009bd 100644 (file)
@@ -20,6 +20,7 @@ endif
 
 libshadow_la_CPPFLAGS += -I$(top_srcdir)
 libshadow_la_CFLAGS = $(LIBBSD_CFLAGS) $(LIBCRYPT_PAM) $(LIBSYSTEMD)
+libshadow_la_LIBADD = $(LIBADD_DLOPEN)
 
 libshadow_la_SOURCES = \
        addgrps.c \
index a9d5ba4bbb7bdfb688ce643b8487834c25ddeb59..70ea10fbceb4ff74778f595b2e8f1e8c1965288c 100644 (file)
@@ -9,7 +9,7 @@ RUN export DEBIAN_PRIORITY=critical \
 RUN apt-get update -y \
     && apt-get dist-upgrade -y
 RUN apt-get build-dep shadow -y
-RUN apt-get install libbsd-dev pkgconf -y
+RUN apt-get install libltdl-dev libbsd-dev pkgconf -y
 
 COPY ./ /usr/local/src/shadow/
 WORKDIR /usr/local/src/shadow/