libgcrypt1.9.0: Failure on linking test executables

Kasumi Fukuda kasumi at rollingapple.net
Thu Jan 21 09:07:02 CET 2021


Let me share a repro step using docker:
----
#!/bin/bash
docker run -i amazon/aws-sam-cli-build-image-provided.al2 /bin/bash <<'EOF'

set -ex
cd /tmp
export MAKEFLAGS=-j$(nproc)

M=https://gnupg.org/ftp/gcrypt
curl $M/libgpg-error/libgpg-error-1.41.tar.bz2 | tar jx
curl $M/libgcrypt/libgcrypt-1.9.0.tar.bz2 | tar jx

cd /tmp/libgpg-error-1.41
./configure --prefix=/opt/libgpg-error --disable-doc
make && make install

export PATH=/opt/libgpg-error/bin:$PATH

cd /tmp/libgcrypt-1.9.0
./configure --prefix=/opt/libgcrypt --disable-doc
make && make install

EOF
----

On Thu, Jan 21, 2021 at 4:29 PM Kasumi Fukuda <kasumi at rollingapple.net> wrote:
>
> Thank you for your clarification, Niibe san
>
> On Thu, Jan 21, 2021 at 2:23 PM NIIBE Yutaka <gniibe at fsij.org> wrote:
> > What's the version of your GCC and linker (from binutils)?
>
> They are from the official Amazon Linux 2 repository.
>
> ----
> bash-4.2# gcc -v
> Using built-in specs.
> COLLECT_GCC=gcc
> COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-redhat-linux/7/lto-wrapper
> Target: x86_64-redhat-linux
> Configured with: ../configure --enable-bootstrap
> --enable-languages=c,c++,objc,obj-c++,fortran,ada,go,lto --prefix=/usr
> --mandir=/usr/share/man --infodir=/usr/share/info
> --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-shared
> --enable-threads=posix --enable-checking=release --enable-multilib
> --with-system-zlib --enable-__cxa_atexit
> --disable-libunwind-exceptions --enable-gnu-unique-object
> --enable-linker-build-id --with-gcc-major-version-only
> --with-linker-hash-style=gnu --enable-plugin --enable-initfini-array
> --with-isl --enable-libmpx --enable-libsanitizer
> --enable-gnu-indirect-function --enable-libcilkrts --enable-libatomic
> --enable-libquadmath --enable-libitm --with-tune=generic
> --with-arch_32=x86-64 --build=x86_64-redhat-linux
> Thread model: posix
> gcc version 7.3.1 20180712 (Red Hat 7.3.1-9) (GCC)
>
> bash-4.2# ld -v
> GNU ld version 2.29.1-30.amzn2
>
> bash-4.2# ld.gold -v
> GNU gold (version 2.29.1-30.amzn2) 1.14
> ----
>
> > I don't see the reason why your linker emits error when linking t-secmem
> > with libgcrypt.so.  The t-secmem.o object has no use of any libgpg-error
> > sympols. It seems that your linker tries to resolve all symbols in
> > linked library, which is not needed at all.
>
> I think you are right. And in fact, it has no dependency on
> libgpg-error symbols when I do `nm t-secmem.o` or `readelf -a
> t-secmem`.
>
> > I tried with my environment (Debian GNU/Linux): Clang-3.8, GCC 6, GCC 8,
> > GCC 9,... with ld.gold or ld.bfd.  I was unable to replicate the linkage
> > error.
>
> Switching the linker to gold (by symlinking ld -> ld.gold) resolved
> the issue in my case.
> So something wrong with my ld.bfd?
>
> --



More information about the Gcrypt-devel mailing list