我的.pro文件中有以下配置

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

当我尝试构建项目时,出现以下错误
/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

双击错误将我带到gthread.h文件,并指出以下几行
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);
}

似乎是什么问题?

最佳答案

在为64位平台编译古老的glib和pango时发生了相同的错误。

这是该版本中g_atomic_pointer_get源的外观:

# 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)))

因此,这里atomicgsize,它必须具有与sizeof相同的gpointer,即void*

它帮助我在gsize中将gssizeglibconfig.h重新定义为64位体系结构上的8字节。

同时更新GLIB_SIZEOF_VOID_PGLIB_SIZEOF_LONGGLIB_SIZEOF_SIZE_T

10-08 00:44