[Fontconfig] Cross-compiling options for configure

David Foster potentiallyspam at gmail.com
Sun Aug 29 19:05:12 PDT 2010

After hacking away a bit more at the problem, I think I found a 
solution. I'm posting it in case anyone else runs into the same problems 
and this solution works for them.

The trick was noticing that despite the --host and --with-arch flags, 
the configure script still wasn't convinced it was doing a cross-compile:

 > checking whether we are cross compiling... no

Digging into the configure script revealed that it was looking for a 
binary called <host_triplet>-gcc in the PATH that already had the 
correct -arch settings built-in.

So I created the following trampoline script 
'x86_64-apple-darwin9.8.0-gcc' and stuck it in my path:

gcc -arch x86_64 $@

Now configure correctly detects that it's in cross-compile mode.

I also found that I could avoid creating the trampoline altogether by 
setting the CC variable explicitly like so:

$ ./configure --host=x86_64-apple-darwin9.8.0 --with-arch=x86_64 CC="gcc 
-arch x86_64"

Much more elegant. The only thing left is to point configure at 
cross-compiled versions of its dependent libraries (libfreetype and 
libxml2). (You could also use pango instead of libxml2.)

$ ./configure --host=x86_64-apple-darwin9.8.0 --with-arch=x86_64 CC="gcc 
-arch x86_64" --enable-libxml2 LIBXML2_LIBS="-L/cross-prefix/lib -lxml2" 

Sweet success.


More information about the Fontconfig mailing list