GNOME Bugzilla – Bug 631353
glib broken on 5 OpenBSD platforms (gatomic.c related?) since 2.26
Last modified: 2011-05-18 16:27:11 UTC
The platforms below built and ran correctly with glib up to 2.24.2, but fail with 2.26.0. The platforms are: - sh4 - mips64 (big/little endian) - vax - hp pa-risc They fail as such: cc -DHAVE_CONFIG_H -I. -I.. -I.. -I../glib -I../glib -I.. -I/usr/local/include -DG_LOG_DOMAIN="GLib" -DG_DISABLE_CAST_CHECKS -DG_DISABLE_DEPRECATED -DGLIB_COMPILATION -DPCRE_STATIC -I/usr/local/include -D_POSIX_MONOTONIC_CLOCK=200112L -DG_DISABLE_SINGLE_INCLUDES -pthread -O2 -pipe -Wall -MT gatomic.lo -MD -MP -MF .deps/gatomic.Tpo -c gatomic.c -fPIC -DPIC -o .libs/gatomic.o gatomic.c:885: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token gatomic.c: In function 'g_atomic_int_exchange_and_add': gatomic.c:906: warning: implicit declaration of function 'g_mutex_lock' gatomic.c:906: error: 'g_atomic_mutex' undeclared (first use in this function) gatomic.c:906: error: (Each undeclared identifier is reported only once gatomic.c:906: error: for each function it appears in.) gatomic.c:909: warning: implicit declaration of function 'g_mutex_unlock' gatomic.c: In function 'g_atomic_int_add': gatomic.c:928: error: 'g_atomic_mutex' undeclared (first use in this function) gatomic.c: In function 'g_atomic_int_compare_and_exchange': gatomic.c:954: error: 'g_atomic_mutex' undeclared (first use in this function) gatomic.c: In function 'g_atomic_pointer_compare_and_exchange': gatomic.c:988: error: 'g_atomic_mutex' undeclared (first use in this function) gatomic.c: In function 'g_atomic_int_get': gatomic.c:1019: error: 'g_atomic_mutex' undeclared (first use in this function) gatomic.c: In function 'g_atomic_int_set': gatomic.c:1040: error: 'g_atomic_mutex' undeclared (first use in this function) gatomic.c: In function 'g_atomic_pointer_get': gatomic.c:1061: error: 'g_atomic_mutex' undeclared (first use in this function) gatomic.c: In function 'g_atomic_pointer_set': gatomic.c:1082: error: 'g_atomic_mutex' undeclared (first use in this function) gatomic.c: In function '_g_atomic_thread_init': gatomic.c:1155: error: 'g_atomic_mutex' undeclared (first use in this function) gatomic.c:1155: warning: implicit declaration of function 'g_mutex_new' Error while executing cc -DHAVE_CONFIG_H -I. -I.. -I.. -I../glib -I../glib -I.. -I/usr/local/include -DG_LOG_DOMAIN="GLib" -DG_DISABLE_CAST_CHECKS -DG_DISABLE_DEPRECATED -DGLIB_COMPILATION -DPCRE_STATIC -I/usr/local/include -D_POSIX_MONOTONIC_CLOCK=200112L -DG_DISABLE_SINGLE_INCLUDES -pthread -O2 -pipe -Wall -MT gatomic.lo -MD -MP -MF .deps/gatomic.Tpo -c gatomic.c -fPIC -DPIC -o .libs/gatomic.o gmake[4]: *** [gatomic.lo] Error 1 Any idea what's causing this? A real solution would probably to write the asm for these, right? ATOMIC_INT_CMP_XCHG, g_atomic_int_exchange_and_add, g_atomic_int_add, g_atomic_int_compare_and_exchange, g_atomic_pointer_compare_and_exchange, G_ATOMIC_MEMORY_BARRIER.
Created attachment 172137 [details] [review] Add missing header which caused gatomic.c compile errors.
Also affects Solaris 10 when using gcc and building for a target without builtin atomic operations (i.e. -march=i386) The provided patch fix the issue.
I can confirm you patch fix the problem on Linux too when using things like -march=i386.
NetBSD's pkgsrc has a similar patch to fix the build on NetBSD/i386<=5.x (where the compiler defaults to -march=i386)
If someone could change the bug status to NEW, that would be great.
Does any GLIB developer care about *BSD/Solaris?
(In reply to comment #6) > Does any GLIB developer care about *BSD/Solaris? There are also some people affected in Gentoo ;-) http://bugs.gentoo.org/show_bug.cgi?id=351387 Thanks for applying it upstream if possible :-D
Anyone?? Why is this still "unconfirmed" when Gentoo ran into it, and confirmed this patch fixes it? Seems nobody cares for non-standard architectures...
commit 3f3b2bd82b9674d22cd64d76af68ddbc9cf80115 Author: Jasper Lievisse Adriaanse <jasper@humppa.nl> Date: Wed May 18 12:01:44 2011 -0400 gatomic: #include gthread.h to fix compilation on nonoptimized architectures The fallback case of implementing atomic integers with mutexes needs gthread.h. Commit message written by Colin Walters <walters@verbum.org> https://bugzilla.gnome.org/show_bug.cgi?id=631153
In the future please see: https://live.gnome.org/GnomeLove/SubmittingPatches This tells you how to submit "git format-patch" style patches.
Thanks for committing. Though the mentioned bug should be #631353 not #631153 ;-)
(In reply to comment #11) > Thanks for committing. > Though the mentioned bug should be #631353 not #631153 ;-) Argh. Oh well.