Bug 52032 - pkg-config 0.27 --with-internal-glib universal build fails
Summary: pkg-config 0.27 --with-internal-glib universal build fails
Status: RESOLVED NOTOURBUG
Alias: None
Product: pkg-config
Classification: Unclassified
Component: src (show other bugs)
Version: unspecified
Hardware: Other Mac OS X (All)
: medium normal
Assignee: Tollef Fog Heen
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-07-12 23:00 UTC by Ryan Schmidt
Modified: 2013-06-08 23:43 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments

Description Ryan Schmidt 2012-07-12 23:00:52 UTC
When building pkg-config 0.27 on OS X with the --with-internal-glib flag, and building a universal binary (i.e. supplying the flags "-arch i386 -arch x86_64" in CFLAGS, CXXFLAGS and LDFLAGS), the build fails with this error:

  CC     gvariant.lo
/bin/sh ../libtool --silent --tag=CC   --mode=compile ccache /usr/bin/gcc-4.2 -DHAVE_CONFIG_H -I. -I..  -I.. -I../glib -I../glib -I..  -DG_LOG_DOMAIN=\"GLib\" -DG_DISABLE_CAST_CHECKS -DGLIB_COMPILATION -DPCRE_STATIC -I/opt/local/include -D_REENTRANT  -pipe -O2 -arch x86_64 -arch i386 -Wall -c -o gvariant.lo gvariant.c
gvariant.c:4241: error: size of array '_GStaticAssertCompileTimeAssertion_4241' is negative

I can work around the problem by not using the --with-internal-glib flag, and instead letting pkg-config use the glib 2.32.3 that I already have installed.
Comment 1 Dan Nicholson 2012-08-14 22:52:31 UTC
Where it's bombing seems to be this line:

G_STATIC_ASSERT (sizeof (gdouble) == sizeof (guint64));

This appears to not be the case on OS X. Do you get the same problem when you build just glib? I haven't tried to do anything to glib besides strip out unwanted components of it. FWIW, it appears you're patching glib's types for the system glib:

http://svn.macosforge.org/repository/macports/trunk/dports/devel/glib2/files/patch-configure.diff

Does this fail when you build pkg-config with a single -arch? Which one fails?
Comment 2 Dan Nicholson 2012-08-14 23:47:55 UTC
Now that I look some more, glib out of the box definitely does not cater to building with multiarch support. The type sizes and alignments are computed one time in configure and then shoved into glibconfig.h. This is treated as an architecture specific header and intended to only be used on one platform.

This is going to be tough to fix from pkg-config. I googled around for a while and didn't see anything on gnome.org about this issue. I would be pretty hesitant to start patching glib here unless there was already a discussion going with upstream glib.

It seems for now that you'll either have to use your system glib or build pkg-config as a non-universal binary. The second option seems reasonable for a developer since I don't know what you'd do with a multiarch pkg-config anyway. For a packager trying to distribute universal binaries of pkg-config, I guess you'll need to continue with the first option.

I added some info to the README about handling this situation. I'm closing this NOTOURBUG for now. However, if any upstreamable patches for glib show up, I'll try to get them incorporated here. Thanks for reporting.
Comment 3 Ryan Schmidt 2012-08-15 00:49:58 UTC
Thanks. If that's all it is, I have no problem patching pkg-config's glib just like we're patching standalone glib. Eventually the developers of glib will hopefully understand why what they're doing is not appropriate in the multiarch Mac world.
Comment 4 Partha Bagchi 2013-06-08 23:43:30 UTC
This bug still exits in glib 2.37.1. My current worked around is to build the archs separately and lipo them together.


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.