[Fontconfig] Cross-compiling options for configure

David Foster potentiallyspam at gmail.com
Sun Aug 29 17:16:01 PDT 2010


I am trying to determine how to cross-compile fontconfig. This is so 
that I can integrate fontconfig into HandBrake's build system, which 
supports cross-compiling to many architectures.

I am starting by trying to determine how to cross-compile fontconfig by 
itself. For the initial attempt, the build-arch is ppc and the host-arch 
x86_64.

Under normal circumstances I would override the compile flags like so:

$ ./configure CFLAGS="-arch x86_64" CXXFLAGS="-arch x86_64" 
CPPFLAGS="-arch x86_64" LDFLAGS="-arch x86_64" 
--host=x86_64-apple-darwin9.8.0 && make

 > Output: http://handbrake.fr/pastebin/pastebin.php?show=1608

This does not work because fontconfig attempts to build and run some 
fc-* tools. Since the above flag-overriding behavior will cause the fc-* 
tools to be built under the host-arch (x86_64), they won't be executable 
on the build-arch (ppc).

You would think that the following configure line would work correctly:

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

 > Output: http://handbrake.fr/pastebin/pastebin.php?show=1609

However this doesn't actually result in the libfontconfig.a library 
being cross-compiled at all. Inspecting the .a file reveals ppc, not 
x86_64 assembly.

$ otool -tv src/.libs/libfontconfig.a | head -n 10

Archive : src/.libs/libfontconfig.a
src/.libs/libfontconfig.a(fcatomic.o):
(__TEXT,__text) section
_FcAtomicCreate:
00000000        mfspr   r0,lr
00000004        stmw    r26,0xffe8(r1)
00000008        or      r26,r3,r3
0000000c        bcl     20,31,0x10
00000010        mfspr   r31,lr
00000014        stw     r0,0x8(r1)

How do I configure fontconfig to actually cross-compile correctly?

David


More information about the Fontconfig mailing list