[fpc-pascal] Cross compiling Linux to OS X

Torsten Bonde Christiansen tc at epidata.info
Wed Mar 27 22:28:12 CET 2019

Hi all.

I recently update from fpc 3.0.0 to 3.0.4 (yes, a little late i know...) 
for our range of application. In order to simplify our build i have a VM 
with linux running on it and in there i had it setup to crosscompile fra 
Linux -> Win32/Win64/Linux32/Darwin-i386.

But after the upgrade I can no longer cross-compile the fpc sources to 
Darwin. I get a linking error that I suspect is related to an old 
version of binutil (see below for the complete message).

Now my question is if there is someone on the list that has a setup 
where you can successfully build fpc to cross compile from linux -> mac 
os x. The guide on the wiki is very outdated so there is not a lot of 
help to get from there. I can still use the build command below on the 
sources for 3.0.0, so the previous approach i had seems to still be working.

Best regards

=================== Output ======================

 > make distclean crossall crossinstall OPT="-O2 -XX -CX -Xs -Xd 
-Fl/home/epidata/Apple/SDKs/MacOSX10.5.sdk/usr/lib" CPU_TARGET=i386 
OS_TARGET=darwin BINUTILSPREFIX=i686-apple-darwin10- 
INSTALL_PREFIX=~/fpc FPMAKEOPT="-o -Aas-darwin"

.... lots of lines ...

/home/epidata/FreePascal/release_3_0_4/compiler/ppc fpmake.pp -n 
-Fu/home/epidata/FreePascal/release_3_0_4/rtl/units/x86_64-linux -O2 -XX 
-CX -Xs -Xd -Fl/home/epidata/Apple/SDKs/MacOSX10.5.sdk/usr/lib
/usr/bin/ld: warning: link.res contains output sections; did you forget -T?
/usr/bin/ld: /usr/lib/libc_nonshared.a(elf-init.oS): in function 
(.text+0x2e): undefined reference to `_init'
fpmake.pp(47,1) Error: Error while linking
fpmake.pp(47,1) Fatal: There were 1 errors compiling module, stopping
Fatal: Compilation aborted

More information about the fpc-pascal mailing list