[fpc-pascal] Cross Compiling from Linux to a Mac OS X 10.5 or 10.6 target. How?

Bruce Tulloch bruce at causal.com
Thu Aug 4 15:13:01 CEST 2011


So I've got cross-compilation working but I have one last problem.

I can't seem to get fpc to drive the linker to search the SDK path
BEFORE the default paths. Specifically, i386-darwin-ld finds

  /usr/lib/crt1.o

and NOT

  /opt/MacOSX10.5.sdk/usr/lib/crt1.o

despite fpc being passed the option

  -k-L/opt/MacOSX10.5.sdk/usr/lib

on the command line. I'm using Free Pascal Compiler version 2.4.2
[2011/06/07] for i386 and the complete command line is:

fpc \
-MDelphi \
-Scagi \
-O3 \
-Tdarwin \
-Pi386 \
-k-L/opt/MacOSX10.5.sdk/usr/lib \
-vew \
-l \
-Fi${BUILD}/i386/darwin/carbon \
-Fl/opt/MacOSX10.5.sdk/usr/lib \
-Fusrc \
-Fu${LAZARUS}/lcl/units/i386-darwin \
-Fu${LAZARUS}/lcl/units/i386-darwin/carbon \
-Fu${LAZARUS}/packager/units/i386-darwin \
-FU${BUILD}/i386/darwin/carbon/ \
-FE${BUILD}/ \
-oProject \
-gw \
-godwarfsets \
-dLCL \
-dLCLcarbon \
Project.lpr

I know it works because if I temporarily rename /usr/lib/crt1.o the
linker finds the correct SDK version and links the project properly.

What am I doing wrong that fpc does not appear to put the path

  /opt/MacOSX10.5.sdk/usr/lib

ahead of the default paths when calling i386-darwin-ld?

Many thanks, Bruce.



More information about the fpc-pascal mailing list