After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 68944 - linker errors when inline function is used in two different files
linker errors when inline function is used in two different files
Status: RESOLVED NOTGNOME
Product: glib
Classification: Platform
Component: general
unspecified
Other Linux
: Normal normal
: ---
Assigned To: gtkdev
gtkdev
Depends on:
Blocks:
 
 
Reported: 2002-01-17 19:22 UTC by Ian Campbell
Modified: 2004-12-22 21:47 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Ian Campbell 2002-01-17 19:22:44 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
Comment 1 Ian Campbell 2002-01-17 19:27:14 UTC
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.

Comment 2 Darin Adler 2002-01-17 20:18:34 UTC
Presumably the problem is with "extern inline" as used by
the G_INLINE_FUNC macro when using gcc with optimization on.
Comment 3 Owen Taylor 2002-01-17 20:23:31 UTC
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.
Comment 4 Ian Campbell 2002-01-18 17:17:35 UTC
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...