dmalloc icon indicating copy to clipboard operation
dmalloc copied to clipboard

Linking fails with GCC-14 and Clang-19

Open NHOrus opened this issue 1 year ago • 4 comments

https://bugs.gentoo.org/946814 ld.lld: error: non-exported symbol 'atexit' in '/usr/lib64/libc_nonshared.a(atexit.oS)' is referenced by DSO '/usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../lib64/libdmalloc.so' https://bugs.gentoo.org/930210 /usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../x86_64-pc-linux-gnu/bin/ld: bin/enblend: hidden symbol 'atexit' in /usr/lib64/libc_nonshared.a(atexit.oS) is referenced by DSO /usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../x86_64-pc-linux-gnu/bin/ld: final link failed: bad value

NHOrus avatar Dec 30 '24 09:12 NHOrus

I'm also hitting that issue in GNU Guix, using GCC 14 as well.

apteryks avatar Nov 24 '25 01:11 apteryks

More specifically, the exact problem I see is this, in the config.log file produced at configure-time when building the gtick program:

configure:5795: gcc -o conftest -g -O2   conftest.c -ldmalloc  -lsndfile -lm  >&5
ld: conftest: hidden symbol `atexit' in /gnu/store/yj053cys0724p7vs9kir808x7fivz17m-glibc-2.41/lib/libc_nonshared.a(atexit.oS) is referenced by DSO
ld: final link failed: bad value
collect2: error: ld returned 1 exit status
configure:5795: $? = 1
configure: failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME "gtick"
| #define PACKAGE_TARNAME "gtick"
| #define PACKAGE_VERSION "0.5.5"
| #define PACKAGE_STRING "gtick 0.5.5"
| #define PACKAGE_BUGREPORT ""
| #define PACKAGE_URL ""
| #define PACKAGE "gtick"
| #define VERSION "0.5.5"
| #define STDC_HEADERS 1
| #define HAVE_SYS_TYPES_H 1
| #define HAVE_SYS_STAT_H 1
| #define HAVE_STDLIB_H 1
| #define HAVE_STRING_H 1
| #define HAVE_MEMORY_H 1
| #define HAVE_STRINGS_H 1
| #define HAVE_INTTYPES_H 1
| #define HAVE_STDINT_H 1
| #define HAVE_UNISTD_H 1
| #define __EXTENSIONS__ 1
| #define _ALL_SOURCE 1
| #define _GNU_SOURCE 1
| #define _POSIX_PTHREAD_SEMANTICS 1
| #define _TANDEM_SOURCE 1
| #define HAVE_LIBM 1
| #define HAVE_LIBSNDFILE 1
| /* end confdefs.h.  */
| 
| /* Override any GCC internal prototype to avoid an error.
|    Use char because int might match the return type of a GCC
|    builtin and then its argument prototype would still apply.  */
| #ifdef __cplusplus
| extern "C"
| #endif
| char dmalloc_debug ();
| int
| main ()
| {
| return dmalloc_debug ();
|   ;
|   return 0;
| }

apteryks avatar Nov 24 '25 01:11 apteryks

A workaround is to only build the static version of the library.

apteryks avatar Nov 24 '25 01:11 apteryks

But it seems this is not the only issue, as there appear to be issues with the definitions that dmalloc makes when using GCC 14 and glibc 2.41. I've written more details in https://mail.gnu.org/archive/html/gtick-devel/2025-11/msg00001.html, but copying here the errors here:

gcc 
-DLOCALEDIR=\"/gnu/store/vhs5k9dn83qq8s1c0gk6i4alm66s1rip-gtick-0.5.5/share/locale\"
 -DHAVE_CONFIG_H -I. -I..  -I../src -I../intl -I../intl -pthread -D_REENTRANT 
-I/gnu/store/asa3sk99icdbfk0l7582xz1rk777ygyc-gtk+-2.24.33/include/gtk-2.0 
-I/gnu/store/asa3sk99icdbfk0l7582xz1rk777ygyc-gtk+-2.24.33/lib/gtk-2.0/include 
-I/gnu/store/a8n3im9wnpl5vkps3q35y4mc88l2ggkw-pango-1.54.0/include/pango-1.0 
-I/gnu/store/rzhjfzqjj5ay3lm3v0g3ki1k4hckvivd-glib-2.83.3/include/glib-2.0 
-I/gnu/store/rzhjfzqjj5ay3lm3v0g3ki1k4hckvivd-glib-2.83.3/lib/glib-2.0/include 
-I/gnu/store/6h9k3kvpxbhx6g19awyh7i4lj5aq5x1r-cairo-1.18.4/include/cairo 
-I/gnu/store/v9h9b6b03hppw4plkfxwqnb6ysc3wjxq-at-spi2-core-2.52.0/include/atk-1.0
 -I/gnu/store/0zppjimw3n4gr5mac3bhym2bh72y93ah-harfbuzz-11.4.4/include/harfbuzz 
-I/gnu/store/zx8fpb58zjs1mwp139csxq6ldv15lnm0-fribidi-1.0.12/include/fribidi 
-I/gnu/store/c2c17v4nv88ps4y20gl5qhji7zd6ywc3-freetype-2.13.3/include/freetype2 
-I/gnu/store/5d1349z0prywd2z0i7ri5jgmnrkjakb2-gdk-pixbuf-2.42.12/include/gdk-pixbuf-2.0
 
-I/gnu/store/z0pq3qzpbi48g6f07bb561qr9081q7zc-util-linux-2.40.4-lib/include/libmount
 
-I/gnu/store/z0pq3qzpbi48g6f07bb561qr9081q7zc-util-linux-2.40.4-lib/include/blkid
 -I/gnu/store/snmmg0kydz9drbn94nwp03j3y6fxn42a-pixman-0.46.4/include/pixman-1 
-I/gnu/store/84mnjlbbrpli5a9snpx9hgzx1w5hmx9p-libpng-1.6.39/include/libpng16    
 -DVERSION='"0.5.5"' -DPACKAGE='"gtick"' -DUSE_DMALLOC -g -O2 
-D_U_="__attribute__((unused))" -Wall -W -D_GNU_SOURCE -MT ../src/visualtick.o 
-MD -MP -MF $depbase.Tpo -c -o ../src/visualtick.o ../src/visualtick.c &&\
mv -f $depbase.Tpo $depbase.Po
/gnu/store/yj053cys0724p7vs9kir808x7fivz17m-glibc-2.41/include/string.h:187:14: 
error: expected declaration specifiers or ‘...’ before string constant
  187 | extern char *strdup (const char *__s)
      |              ^~~~~~
/gnu/store/yj053cys0724p7vs9kir808x7fivz17m-glibc-2.41/include/string.h:187:14: 
error: expected declaration specifiers or ‘...’ before numeric constant
  187 | extern char *strdup (const char *__s)
      |              ^~~~~~
In file included from ../src/visualtick.c:32:
/gnu/store/yj053cys0724p7vs9kir808x7fivz17m-glibc-2.41/include/string.h:187:14: 
error: expected declaration specifiers or ‘...’ before ‘(’ token
  187 | extern char *strdup (const char *__s)
      |              ^~~~~~
/gnu/store/yj053cys0724p7vs9kir808x7fivz17m-glibc-2.41/include/string.h:187:14: 
error: expected declaration specifiers or ‘...’ before ‘-’ token
  187 | extern char *strdup (const char *__s)
      |              ^~~~~~
/gnu/store/yj053cys0724p7vs9kir808x7fivz17m-glibc-2.41/include/string.h:187:14: 
error: expected declaration specifiers or ‘...’ before numeric constant
  187 | extern char *strdup (const char *__s)
      |              ^~~~~~
/gnu/store/yj053cys0724p7vs9kir808x7fivz17m-glibc-2.41/include/string.h:195:14: 
error: expected declaration specifiers or ‘...’ before string constant
  195 | extern char *strndup (const char *__string, size_t __n)
      |              ^~~~~~~
/gnu/store/yj053cys0724p7vs9kir808x7fivz17m-glibc-2.41/include/string.h:195:14: 
error: expected declaration specifiers or ‘...’ before numeric constant
  195 | extern char *strndup (const char *__string, size_t __n)
      |              ^~~~~~~
/gnu/store/yj053cys0724p7vs9kir808x7fivz17m-glibc-2.41/include/string.h:195:14: 
error: expected declaration specifiers or ‘...’ before ‘(’ token
  195 | extern char *strndup (const char *__string, size_t __n)
      |              ^~~~~~~
/gnu/store/yj053cys0724p7vs9kir808x7fivz17m-glibc-2.41/include/string.h:195:14: 
error: expected declaration specifiers or ‘...’ before ‘(’ token
  195 | extern char *strndup (const char *__string, size_t __n)
      |              ^~~~~~~
/gnu/store/yj053cys0724p7vs9kir808x7fivz17m-glibc-2.41/include/string.h:195:14: 
error: expected declaration specifiers or ‘...’ before numeric constant
  195 | extern char *strndup (const char *__string, size_t __n)
      |              ^~~~~~~
In file included from 
/gnu/store/asa3sk99icdbfk0l7582xz1rk777ygyc-gtk+-2.24.33/include/gtk-2.0/gtk/gtkobject.h:37,
                 from 
/gnu/store/asa3sk99icdbfk0l7582xz1rk777ygyc-gtk+-2.24.33/include/gtk-2.0/gtk/gtkwidget.h:36,
                 from 
/gnu/store/asa3sk99icdbfk0l7582xz1rk777ygyc-gtk+-2.24.33/include/gtk-2.0/gtk/gtkcontainer.h:35,
                 from 
/gnu/store/asa3sk99icdbfk0l7582xz1rk777ygyc-gtk+-2.24.33/include/gtk-2.0/gtk/gtkbin.h:35,
                 from 
/gnu/store/asa3sk99icdbfk0l7582xz1rk777ygyc-gtk+-2.24.33/include/gtk-2.0/gtk/gtkwindow.h:36,
                 from 
/gnu/store/asa3sk99icdbfk0l7582xz1rk777ygyc-gtk+-2.24.33/include/gtk-2.0/gtk/gtkdialog.h:35,
                 from 
/gnu/store/asa3sk99icdbfk0l7582xz1rk777ygyc-gtk+-2.24.33/include/gtk-2.0/gtk/gtkaboutdialog.h:32,
                 from 
/gnu/store/asa3sk99icdbfk0l7582xz1rk777ygyc-gtk+-2.24.33/include/gtk-2.0/gtk/gtk.h:33,
                 from ../src/metro.h:36,
                 from ../src/visualtick.c:37:
/gnu/store/asa3sk99icdbfk0l7582xz1rk777ygyc-gtk+-2.24.33/include/gtk-2.0/gtk/gtktypeutils.h:236:1:
 warning: ‘GTypeDebugFlags’ is deprecated [-Wdeprecated-declarations]
  236 | void            gtk_type_init   (GTypeDebugFlags    debug_flags);
      | ^~~~
In file included from 
/gnu/store/rzhjfzqjj5ay3lm3v0g3ki1k4hckvivd-glib-2.83.3/include/glib-2.0/gobject/gobject.h:26,
                 from 
/gnu/store/rzhjfzqjj5ay3lm3v0g3ki1k4hckvivd-glib-2.83.3/include/glib-2.0/gobject/gbinding.h:31,
                 from 
/gnu/store/rzhjfzqjj5ay3lm3v0g3ki1k4hckvivd-glib-2.83.3/include/glib-2.0/glib-object.h:24,
                 from 
/gnu/store/rzhjfzqjj5ay3lm3v0g3ki1k4hckvivd-glib-2.83.3/include/glib-2.0/gio/gioenums.h:30,
                 from 
/gnu/store/rzhjfzqjj5ay3lm3v0g3ki1k4hckvivd-glib-2.83.3/include/glib-2.0/gio/giotypes.h:30,
                 from 
/gnu/store/rzhjfzqjj5ay3lm3v0g3ki1k4hckvivd-glib-2.83.3/include/glib-2.0/gio/gio.h:28,
                 from 
/gnu/store/asa3sk99icdbfk0l7582xz1rk777ygyc-gtk+-2.24.33/include/gtk-2.0/gdk/gdkapplaunchcontext.h:30,
                 from 
/gnu/store/asa3sk99icdbfk0l7582xz1rk777ygyc-gtk+-2.24.33/include/gtk-2.0/gdk/gdk.h:32,
                 from 
/gnu/store/asa3sk99icdbfk0l7582xz1rk777ygyc-gtk+-2.24.33/include/gtk-2.0/gtk/gtk.h:32:
/gnu/store/rzhjfzqjj5ay3lm3v0g3ki1k4hckvivd-glib-2.83.3/include/glib-2.0/gobject/gtype.h:725:1:
 note: declared here
  725 | {
      | ^
In file included from 
/gnu/store/asa3sk99icdbfk0l7582xz1rk777ygyc-gtk+-2.24.33/include/gtk-2.0/gtk/gtktoolitem.h:31,
                 from 
/gnu/store/asa3sk99icdbfk0l7582xz1rk777ygyc-gtk+-2.24.33/include/gtk-2.0/gtk/gtktoolbutton.h:30,
                 from 
/gnu/store/asa3sk99icdbfk0l7582xz1rk777ygyc-gtk+-2.24.33/include/gtk-2.0/gtk/gtkmenutoolbutton.h:30,
                 from 
/gnu/store/asa3sk99icdbfk0l7582xz1rk777ygyc-gtk+-2.24.33/include/gtk-2.0/gtk/gtk.h:126:
/gnu/store/asa3sk99icdbfk0l7582xz1rk777ygyc-gtk+-2.24.33/include/gtk-2.0/gtk/gtktooltips.h:73:3:
 warning: ‘GTimeVal’ is deprecated: Use 'GDateTime' instead 
[-Wdeprecated-declarations]
   73 |   GTimeVal last_popdown;
      |   ^~~~~~~~
In file included from 
/gnu/store/rzhjfzqjj5ay3lm3v0g3ki1k4hckvivd-glib-2.83.3/include/glib-2.0/glib/galloca.h:34,
                 from 
/gnu/store/rzhjfzqjj5ay3lm3v0g3ki1k4hckvivd-glib-2.83.3/include/glib-2.0/glib.h:32,
                 from 
/gnu/store/rzhjfzqjj5ay3lm3v0g3ki1k4hckvivd-glib-2.83.3/include/glib-2.0/gobject/gbinding.h:30:
/gnu/store/rzhjfzqjj5ay3lm3v0g3ki1k4hckvivd-glib-2.83.3/include/glib-2.0/glib/gtypes.h:580:8:
 note: declared here
  580 | struct _GTimeVal
      |        ^~~~~~~~~
make[3]: *** [Makefile:770: ../src/visualtick.o] Error 1
make[3]: Leaving directory 
'/tmp/guix-build-gtick-0.5.5.drv-0/gtick-0.5.5/testsuite'
make[2]: *** [Makefile:1061: check-am] Error 2
make[2]: Leaving directory 
'/tmp/guix-build-gtick-0.5.5.drv-0/gtick-0.5.5/testsuite'
make[1]: *** [Makefile:1064: check] Error 2
make[1]: Leaving directory 
'/tmp/guix-build-gtick-0.5.5.drv-0/gtick-0.5.5/testsuite'
make: *** [Makefile:518: check-recursive] Error 1

Test suite failed, dumping logs.

This does not happen if building without dmalloc.

apteryks avatar Nov 24 '25 02:11 apteryks