Gthread.h array size negative

I have the following configuration in my .pro file

INCLUDEPATH += /home/vickey/ossbuild-read-only/Shared/Build/Linux/x86/include/glib-2.0/
CONFIG += link_pkgconfig
PKGCONFIG += gstreamer-0.10
LIBS            += -L/usr/lib `pkg-config --cflags --libs gstreamer-0.10`
LIBS        += -L. -L/usr/lib -lphonon -lcurl -ltag -fopenmp -lsayonara_gstreamer

When I try to build a project, I get the following error:

/home/vickey/src/player/../../../../ossbuild-read-only/Shared/Build/Linux/x86/include/glib-2.0/glib/gthread.h:-1: In function 'gboolean g_once_init_enter(volatile gsize*)':

/home/vickey/src/player/../../../../ossbuild-read-only/Shared/Build/Linux/x86/include/glib-2.0/glib/gthread.h:348: error: size of array is negative

Double-clicking by mistake leads me to the gthread.h file with the lines below

g_once_init_enter (volatile gsize *value_location)
{
  if G_LIKELY ((gpointer) g_atomic_pointer_get (value_location) != NULL)
    return FALSE;
  else
    return g_once_init_enter_impl (value_location);
}

What is the problem?

+3
source share
1 answer

I had the same error compiling the ancient glib and pango for a 64-bit platform.

Here's what the g_atomic_pointer_getsource looks like in this version:

# define g_atomic_pointer_get(atomic) \
 ((void) sizeof (gchar [sizeof (*(atomic)) == sizeof (gpointer) ? 1 : -1]), \
  (g_atomic_pointer_get) ((volatile gpointer G_GNUC_MAY_ALIAS *) (volatile void *) (atomic)))

So, here atomicthere is gsize, which should have the same sizeofas gpointer, i.e. void*.

This helped me override gsizeand gssizeas an 8-byte in the 64 bit architecture in glibconfig.h.

Also update GLIB_SIZEOF_VOID_P, GLIB_SIZEOF_LONGand GLIB_SIZEOF_SIZE_T.

0
source

All Articles