You need to sign in or sign up before continuing.
cryptsetup fails to link with Gold linker: "undefined reference to 'dlopen'"
Issue description
When the system default linker is GNU Gold, cryptsetup 2.4.0 fails to link with the following errors:
libtool: link: x86_64-pc-linux-gnu-gcc -Wall -pipe -march=native -O3 -ggdb -Wl,-O2 -o .libs/cryptsetup lib/utils_crypt.o lib/utils_loop.o lib/utils_io.o lib/utils_blkid.o src/utils_args.o src/utils_tools.o src/utils_password.o src/utils_luks2.o src/utils_blockdev.o src/cryptsetup.o -Wl,--as-needed -lm ./.libs/libcryptsetup.so -ldevmapper -lssl -lcrypto -ljson-c -lpopt -luuid -lblkid
./.libs/libcryptsetup.so: error: undefined reference to 'dlopen'
./.libs/libcryptsetup.so: error: undefined reference to 'dlerror'
./.libs/libcryptsetup.so: error: undefined reference to 'dlvsym'
./.libs/libcryptsetup.so: error: undefined reference to 'dlclose'
collect2: error: ld returned 1 exit status
make[2]: *** [Makefile:1721: cryptsetup] Error 1
make[2]: Leaving directory '/var/tmp/portage/sys-fs/cryptsetup-2.4.0/work/cryptsetup-2.4.0'
make[1]: *** [Makefile:2602: all-recursive] Error 1
make[1]: Leaving directory '/var/tmp/portage/sys-fs/cryptsetup-2.4.0/work/cryptsetup-2.4.0'
make: *** [Makefile:1258: all] Error 2
Steps for reproducing the issue
Install binutils with Gold as the default linker, and try to build cryptsetup 2.4.0.
Additional info
I ran into this when attempting to build cryptsetup using the Gentoo ebuild. See Gentoo bug #809608.
Debug log
See the full build log attached.