build glib2 universal binary on PPC

Ryan Schmidt ryandesign at
Mon Mar 5 16:21:26 PST 2007

On Mar 5, 2007, at 06:15, Isaac Huang wrote:

> The glib2 configure script makes conclusions about endianness and
> atomic operations from host cpu type, and generates headers with such
> assumptions inside. I've searched this list and someone said glib2
> needed a patch for this. But I couldn't find this patch, and I also
> lack enough knowledge about glib2 to fix it myself.
> Any hint or suggestion is appreciated.
> BTW, I don't have an Intel Mac so I can't build and lipo.

Well, building twice and using lipo can be possible on a single Mac,  
depending on the software. However, that's not the way that MacPorts  
will attempt to make the universal binary, so it's not relevant here.

When I was researching how to compile glib2 universal, I found these  

Specifically this part:

> If you are on a PowerPC Macintosh, comment out one line in  
> config.h: // #define G_ATOMIC_POWERPC 1

You do that after you run ./configure, and before you run make. You  
can make that one change by hand, or use the attached patch.

It looks like glib uses some assembly code, so if you're building on  
a 32-bit PowerPC Mac, it tries to include 32-bit PowerPC assembly  
even in the Intel executable, which fails.

glib doesn't appear to have any 32-bit Intel assembly code which is  
why the problem shouldn't occur when building a universal binary on a  
32-bit Intel Mac.

glib does include 64-bit Intel assembly, however, so I wonder if the  
same problem will occur when attempting to build a universal binary  
on a 64-bit Intel Mac, like an Xserve. But I don't have access to an  
Intel Xserve to test it.

Jim, you'll probably want to add this patch file to glib2 when  
building the +universal variant.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: glib2-config.h-ppc.diff
Type: application/octet-stream
Size: 314 bytes
Desc: not available
Url :

More information about the macports-dev mailing list