Package: gcc-9 Version: 9.2.1-19 Severity: important Dear Maintainer,
When compiling this short example: /* a.c begins here */ #include <stdio.h> #include <gmp.h> int main(void) { mpf_t y; mpf_init2(y, 128); mpf_sqrt_ui(y, 2UL); gmp_printf("%.*Ff\n", 38, y); return 0; } /* a.c ends here */ with the command : $ gcc -lgmp a.c gcc produces this error: /usr/bin/ld: /tmp/cclW7Wdd.o: in function `main': a.c:(.text+0x15): undefined reference to `__gmpf_init2' /usr/bin/ld: a.c:(.text+0x26): undefined reference to `__gmpf_sqrt_ui' /usr/bin/ld: a.c:(.text+0x43): undefined reference to `__gmp_printf' collect2: error: ld returned 1 exit status Notice, libgmp is installed, according to this commands: $ apt-cache policy libgmp-dev returns: libgmp-dev: Installed: 2:6.1.2+dfsg-4 Candidate: 2:6.1.2+dfsg-4 Version table: *** 2:6.1.2+dfsg-4 900 900 https://deb.debian.org/debian sid/main amd64 Packages 100 /var/lib/dpkg/status But that works as exepected when compiling with clang, and with gcc-8. That also works with the command: $ gcc -fuse-ld=gold -lgmp a.c It was also successful when I tried with lld from the package lld-8. I have obtained the same results with th following snippets: /* b.c begins here */ #include <glib.h> int main(void) { gchar *str="Just a string"; gchar *str2; str2 = g_strdup(str); return 0; } /* b.c ends here */ I compiled the latter with: $ gcc $(pkg-configs --cflags --libs glib-2.0) b.c which returns: /usr/bin/ld: /tmp/ccuQaGQ7.o: in function `main': b.c:(.text+0x1b): undefined reference to `g_strdup' collect2: error: ld returned 1 exit status But that linked properly with ld.gold and lld-8. I can't figure out how to correct this issue. One can symlinks /usr/bin/ld to /usr/bin/ld.gold to not have to pass --fuse-ld=gold, but this is twisted. The default bfd linker should work. Cheers -- Gilles Crèvecœur -- System Information: Debian Release: bullseye/sid APT prefers unstable APT policy: (900, 'unstable'), (100, 'experimental') Architecture: amd64 (x86_64) Foreign Architectures: i386 Kernel: Linux 5.3.1-e1 (SMP w/2 CPU cores; PREEMPT) Locale: LANG=fr_FR.UTF-8, LC_CTYPE=fr_FR.UTF-8 (charmap=UTF-8), LANGUAGE=fr (charmap=UTF-8) Shell: /bin/sh linked to /bin/dash Init: systemd (via /run/systemd/system) LSM: AppArmor: enabled Versions of packages gcc-9 depends on: ii binutils 2.33.1-2 ii cpp-9 9.2.1-19 ii gcc-9-base 9.2.1-19 ii libc6 2.29-3 ii libcc1-0 9.2.1-19 ii libgcc-9-dev 9.2.1-19 ii libgcc1 1:9.2.1-19 ii libgmp10 2:6.1.2+dfsg-4 ii libisl21 0.21-2 ii libmpc3 1.1.0-1 ii libmpfr6 4.0.2-1 ii libstdc++6 9.2.1-19 ii zlib1g 1:1.2.11.dfsg-1+b1 Versions of packages gcc-9 recommends: ii libc6-dev 2.29-3 Versions of packages gcc-9 suggests: ii gcc-9-doc 9.2.0-1 ii gcc-9-locales 9.2.1-19 pn gcc-9-multilib <none> pn libasan5-dbg <none> pn libatomic1-dbg <none> pn libgcc1-dbg <none> pn libgomp1-dbg <none> pn libitm1-dbg <none> pn liblsan0-dbg <none> pn libquadmath0-dbg <none> pn libtsan0-dbg <none> pn libubsan1-dbg <none> -- no debconf information