Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 80190 - glib 2.6.1 has a broken definition of G_INLINE_FUNC
Summary: glib 2.6.1 has a broken definition of G_INLINE_FUNC
Status: RESOLVED UPSTREAM
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Development (show other bugs)
Hardware: x86 Linux
: High major (vote)
Assignee: Gentoo Linux Gnome Desktop Team
URL: http://bugzilla.gnome.org/show_bug.cg...
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-01-31 03:48 UTC by Brian Tarricone
Modified: 2005-01-31 13:34 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments
short test app demonstrating the problem (inlinetest.c,321 bytes, text/plain)
2005-01-31 12:02 UTC, Brian Tarricone
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Brian Tarricone 2005-01-31 03:48:51 UTC
I just updated to dev-libs/glib-2.6.1 yesterday, and now my app, which uses the G_INLINE_FUNC macro, doesn't compile anymore.  Looking in /usr/include/glib-2.0/glib/gutils.h, it seems that the section dealing with G_INLINE_FUNC has changed considerably from 2.6.0.  In my case, it's now expanding to "extern inline", which causes an "undefined reference to `funcname'" error at link time.  G_INLINE_FUNC used to expand to "static inline", which should be correct.  Using gcc-3.4.3-r1.
Comment 1 Brian Tarricone 2005-01-31 03:52:05 UTC
Note that this only occurs for unoptimised builds - if you pass -O2 to the compiler, it succeeds (yet still, G_INLINE_FUNC expands to "extern inline").
Comment 2 Brian Tarricone 2005-01-31 03:57:41 UTC
Sorry for the spam; I should finish investigating this, and then post, but I have a little more info...

Here's the relevant part of gutils.h in 2.6.0:

#ifndef G_INLINE_FUNC
#  if defined (__GNUC__) && defined (__OPTIMIZE__)
#    define G_INLINE_FUNC extern inline
#  elif defined (G_CAN_INLINE) && !defined (__GNUC__)
#    define G_INLINE_FUNC static inline
#  else /* can't inline */
#    define G_INLINE_FUNC extern
#    undef G_CAN_INLINE
#  endif
#endif /* !G_INLINE_FUNC */

It appears that, if you're doing an optimised build, G_INLINE_FUNC is "extern inline", which for some reason works.  But if there's no optimisation going on, it expands to "static inline", which works properly.

Here's the relevant part of gutils from 2.6.1:

#ifdef G_IMPLEMENT_INLINES
#  define G_INLINE_FUNC
#elif defined (__GNUC__)
#  define G_INLINE_FUNC extern inline
#elif defined (G_CAN_INLINE)
#  define G_INLINE_FUNC static inline
#else /* can't inline */
#  define G_INLINE_FUNC
#endif /* !G_INLINE_FUNC */

Here, G_INLINE_FUNC is defined to "extern inline" regardless if we're doing an optimised build or not (as long as we're compiling with gcc).  We only get "static inline" if we're not using gcc, it seems.
Comment 3 foser (RETIRED) gentoo-dev 2005-01-31 11:12:42 UTC
your 'emerge info' please and what cflags do you use to compile your app ?
Comment 4 Brian Tarricone 2005-01-31 12:01:03 UTC
Here's emerge --info:

Portage 2.0.51-r15 (default-linux/x86/2004.3, gcc-3.4.3, glibc-2.3.4.20041102-r0, 2.6.10-gentoo-r1 i686)
=================================================================
System uname: 2.6.10-gentoo-r1 i686 AMD Athlon(tm) processor
Gentoo Base System version 1.6.8
Python:              dev-lang/python-2.2.3-r5,dev-lang/python-2.3.4 [2.3.4 (#1, Jun 17 2004, 02:12:09)]
distcc 2.18.3 i686-pc-linux-gnu (protocols 1 and 2) (default port 3632) [disabled]
ccache version 2.2 [enabled]
dev-lang/python:     2.2.3-r5, 2.3.4
sys-devel/autoconf:  2.13, 2.59-r6
sys-devel/automake:  1.5, 1.9.4, 1.8.5-r2, 1.4_p6, 1.6.3, 1.7.9
sys-devel/binutils:  2.15.92.0.2-r2
sys-devel/libtool:   1.5.10-r2
virtual/os-headers:  2.6.8.1-r2
ACCEPT_KEYWORDS="x86 ~x86"
AUTOCLEAN="yes"
CFLAGS="-march=athlon-tbird -O2 -pipe"
CHOST="i686-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/kde/2/share/config /usr/kde/3.1/share/config /usr/kde/3.2/share/config /usr/kde/3.3/env /usr/kde/3.3/share/config /usr/kde/3.3/shutdown /usr/kde/3/share/config /usr/lib/X11/xkb /usr/lib/mozilla/defaults/pref /usr/share/config /usr/share/texmf/dvipdfm/config/ /usr/share/texmf/dvips/config/ /usr/share/texmf/tex/generic/config/ /usr/share/texmf/tex/platex/config/ /usr/share/texmf/xdvi/ /var/qmail/control"
CONFIG_PROTECT_MASK="/etc/gconf /etc/terminfo /etc/env.d"
CXXFLAGS="-march=athlon-tbird -O2 -pipe"
DISTDIR="/usr/portage/distfiles"
FEATURES="autoaddcvs autoconfig ccache distlocks sandbox sfperms"
GENTOO_MIRRORS="ftp://mirrors.tds.net/gentoo http://open-systems.ufl.edu/mirrors/gentoo ftp://ftp.ussg.iu.edu/pub/linux/gentoo http://gentoo.osuosl.org/ http://gentoo.ccccom.com"
MAKEOPTS="-j3"
PKGDIR="/usr/portage/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/usr/local/portage"
SYNC="rsync://rsync.namerica.gentoo.org/gentoo-portage"
USE="x86 3dnow 3dnowex X aalib acpi4linux alsa apache2 apm audiofile avi berkdb bitmap-fonts bonobo cdparanoia cdr crypt cups curl dvd dvdr dvdread encode f77 fam fbcon ffmpeg flac flash font-server foomaticdb fortran gdbm gif gnome gphoto2 gpm gstreamer gtk gtk2 gtkhtml guile imagemagick imlib innodb ipv6 jack java joystick jpeg junit kerberos krb4 ldap libcaca libg++ libwww mad matroska mikmod mmx mmxext motif mpeg mysql ncurses nls nptl nptlonly nvidia oggvorbis opengl oss pam pdflib perl pic png python qt quicktime readline rtc samba sasl sdl slang speex spell sqlite sse ssl stencil-buffer svga tcltk tcpd tetex theora tiff truetype truetype-fonts type1-fonts ungif usb v4l2 xchattext xfs xml xml2 xv xvid xvmc zlib"
Unset:  ASFLAGS, CBUILD, CTARGET, LANG, LC_ALL, LDFLAGS

No CFLAGS at all on the app compilation cause linking to fail as I described.  "-O2" only causes linking to succeed.
Comment 5 Brian Tarricone 2005-01-31 12:02:51 UTC
Created attachment 50065 [details]
short test app demonstrating the problem

Compile fails when compiling against glib 2.6.1 without optimisation.  Succeeds
with 2.6.0, with or without optimisation.  Also succeeds on 2.6.1 with
optimisation.
Comment 6 foser (RETIRED) gentoo-dev 2005-01-31 13:34:29 UTC
filed upstream, we'll track it from there.

http://bugzilla.gnome.org/show_bug.cgi?id=165852