GNOME Bugzilla – Bug 68944
linker errors when inline function is used in two different files
Last modified: 2004-12-22 21:47:04 UTC
Anuway, I've been having a problem when linking an XMMS plugin which I wrote (xmms-status-plugin a little status docklet thing). It uses GTK+ (not GNOME since it is a XMMS plugin). The problem is todo with the inlining of g_bit_storage, g_bit_nth_lsf and g_bit_nth_msf. I get the following errors from './configure && make': gcc -shared xmms-status-plugin.lo xmms-status-image.lo about.lo configure.lo -L/usr/lib -L/usr/X11R6/lib /usr/lib/libgtk.so /usr/lib/libgdk.so /usr/lib/libgmodule.so /usr/lib/libglib.so -ldl -lXi -lXext -lX11 -lm -lpthread -Wl,-soname -Wl,libstatusdocklet.so -o .libs/libstatusdocklet.so about.lo: In function `g_bit_nth_lsf': /home/ijc/development/xmms-status-plugin/src/about.c(.text+0x0): multiple definition of `g_bit_nth_lsf' xmms-status-image.lo(.text+0x0):/home/ijc/development/xmms-status-plugin/src/xmms-status-image.c: first defined here <etc for other functions/source files> The problem can be worked around by removing -O2 from CFLAGS (e.g. 'CFLAGS="-g" ./configure && make' compiles and links OK) I run Debian unstable on x86 (glib version 1.2.10-3) but I've had reports of the same from people on Red Hat 7.2. The plugin is tiny and is at http://www.hellion.org.uk/xmms-status-plugin if you want to try. Version 0.8 has the problem for sure. I've checked bugzilla.gnome.org, debian bugs and various list archives but found no solution (other than disabling -O2). The following Debian bug discusses the matter, it might be of interest: http://bugs.debian.org/93226
Sorry, I forgot to mention GCC version (might be relevant) $ dpkg -l libglib1.2 gcc | grep ^ii ii libglib1.2 1.2.10-3 The GLib library of C routines ii gcc 2.95.4-9 The GNU C compiler.
Presumably the problem is with "extern inline" as used by the G_INLINE_FUNC macro when using gcc with optimization on.
Please remove: /* Define as __inline if that's what the C compiler calls it. */ #undef inline From your config.h.in; you aren't using the corresponding configure checks and undefining inline (not suprisingly) causes problems for GLib.
For the record (From a private mail from Owen): The problem turned out to be adding -Werror to CFLAGS before the AC_C_INLINE (called by AM_GNU_GETTEXT), causing the inlining checks to fail. I guess it's a good idea to add -Werror last, after all other tests...