[fpc-pascal]Cross-Compiling

Nikolay Nikolov nickysn1983 at netscape.net
Fri Aug 1 21:45:00 CEST 2003


James Mills wrote:

>How are you guys goins with crosscompiling ?
>I'd like to be able to cross compile from Debian/Linux to various other
>platforms... Or have you been crosscompiling the other way ?
>
First of all, you need binutils, compiled with support for the targets 
you want. Get the source, read the docs, and enable the targets you 
want, then compile it. It's C, so you need gcc environment.

http://www.gnu.org/directory/GNU/binutils.html

If you manage to compile the binutils successfully you should end up 
having as, ld, strip, etc... that support your target os & cpu.

You could also try looking for some precompiled binaries of the 
binutils, for the target you want.

After that you can do: ppc386 -Tyour_target_os 
-FD/path_to_cross_binutils yourfile.pas

You also need the Free Pascal RTL (and other OS-specific units), you can 
get them precompiled from the fpc website. They are part of the fpc 
binary distribution for your target os.



... or you can compile them yourself using the fpc source, but that's 
somewhat more complicated.

If you want to compile for another cpu (fpc 1.0.10 supports i386 and 
m68k; fpc 1.1 currently supports i386, powerpc and sparc) then you 
*must* compile the compiler. You can read the fpc docs, for compiling 
the compiler... :)

IIRC it was something like "make CPU_TARGET=m68k" in the compiler dir 
for the motorola 680x0 (ppc for powerpc, i386 for i386, sparc for sparc 
:) )... You end up having a ppc68k executable. Then you go to the rtl 
directory and compile the rtl using this new ppc68k "make PP=ppc68k 
OPT=-FD/path_to_cross_binutils" Perhaps you also need to add 
OPT=-Tyour_target_os... I did it 2 weeks ago (I compiled a crosscompiler 
for m68k amiga), and this is what I remember... There might be some 
mistakes here... just read the docs, read the fpc compiler options and 
play with it, until you get it working... :)

And you're done.





More information about the fpc-pascal mailing list