[cairo] My (unsuccessful) fight with compiling 1.12.0 on OSX 10.7

Travis Griggs travisgriggs at gmail.com
Tue Mar 27 19:43:50 PDT 2012


I am not a compiler wizard. I wrote this document

http://www.cairographics.org/end_to_end_build_for_mac_os_x/

a while ago. With the release of Cairo 1.12.0 and the exciting new features, I wanted to build a fresh version for OSX that could be bundled with apps. I've had a number of issues so far, and the latest has left me wondering where to go next. Any help/hints appreciated. I'm generally logged into the irc channel and can be pinged there too.

My environment is a relatively stock OSX 10.7.3 MBP, with the latest Xcode installed. Here's my gcc version...

iboard17-local:cairo travis$ gcc --version
i686-apple-darwin11-llvm-gcc-4.2 (GCC) 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.1.00)

1) I tried to use top-of-trunk versions for the 4 main packages involved. I was unable to configure pkg-config 0.26. When I ran the configure command, I eventually got

./configure: line 13540: --exists: command not found
configure: error: pkg-config and glib-2.0 not found, please set GLIB_CFLAGS and GLIB_LIBS to the correct values

Interestingly, at one point, I cleared everything and started over again with the whole thing, but forget to do this step, and got as far as configuring cairo before I discovered it's absence. It's not needed for the pixman or png builds. Is it really necessary for Cairo? If the dependency were simple enough to remove, it would be one less hindrance to compiling Cairo in an "out of Linux environment".

I backed off to the 0.25 version, and things worked fine. Glad I didn't have to work back too many versions.

2) When I tried to use a modified variant of the flags on that page 
	export MACOSX_DEPLOYMENT_TARGET=10.5
	export LDFLAGS=" -arch i386  -arch x86_64 -isysroot /Developer/SDKs/MacOSX10.5.sdk"
	export CFLAGS="-Os  -arch i386  -arch x86_64 -isysroot /Developer/SDKs/MacOSX10.5.sdk"

Neither 1.4.2 or 1.5.9 of libpng would compile. Not sure what the issue was. configure was trying to compile some little program and couldn't.

3) So I backed off to just using no special flags or env variables there. Success! Kind of. The Smalltalk application I'm trying to load these into is of arch type 386. But lipo informed me that the libraries I built were of arch type x86_64. So… back to the drawing board.

4) I tried with just
	export LDFLAGS=" -arch i386  -arch x86_64"
	export CFLAGS="-Os  -arch i386  -arch x86_64"
No DeploymentTarget or isysroot stuff. That blew up trying to compile libpng with the following:

/bin/sh ./libtool  --tag=CC   --mode=compile gcc -DHAVE_CONFIG_H -I.  -DPNG_CONFIGURE_LIBPNG   -Os -arch i386  -arch x86_64 -MT libpng15_la-png.lo -MD -MP -MF .deps/libpng15_la-png.Tpo -c -o libpng15_la-png.lo `test -f 'png.c' || echo './'`png.c
libtool: compile:  gcc -DHAVE_CONFIG_H -I. -DPNG_CONFIGURE_LIBPNG -Os -arch i386 -arch x86_64 -MT libpng15_la-png.lo -MD -MP -MF .deps/libpng15_la-png.Tpo -c png.c  -fno-common -DPIC -o .libs/libpng15_la-png.o
llvm-gcc-4.2: -E, -S, -save-temps and -M options are not allowed with multiple -arch flags
make[1]: *** [libpng15_la-png.lo] Error 1
make: *** [all] Error 2

5) So I tried with just
	export LDFLAGS=" -arch i386"
	export CFLAGS="-Os  -arch i386"

This makes it as far as Cairo compile. And even link I think, where this happens:

  CCLD   libcairo.la
ld: lto: could not merge in .libs/cairo-analysis-surface.o because Unknown instruction for architecture i386
collect2: ld returned 1 exit status
make[3]: *** [libcairo.la] Error 1
make[2]: *** [all] Error 2
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2

Any help or explanation on any of these much appreciated. Is anyone else producing an osx binary with all of the X11/fontconfig features disabled?

--
Travis Griggs
Objologist
I multiply all time estimates by pi, to account for running around in circles.





More information about the cairo mailing list