[fpc-pascal] cross compiling enigma

Jonas Maebe jonas.maebe at elis.ugent.be
Sun Dec 9 12:24:05 CET 2007


On 08 Dec 2007, at 19:26, Sam Liddicott wrote:

>> So... because the makefile knew it was compiling for the same
>> architecture it decided that I wasn't building an fpc cross compiler
>> but cross building an fpc compiler? That's a bit unexpectedly  
>> clever...
> So... this time:
> $ make clean all CPU_TARGET=powerpc OS_TARGET=linux FPC=/usr/bin/ 
> ppc386
> BINUTILSPREFIX=/usr/bin/powerpc-linux-gnu-
>
> And, just like before, it has created a load of powerpc binaries:
>
> $ file /≈/usr/bin/postw32
> /tmp/fpc_patchdir/fpc_build/usr/bin/postw32: ELF 32-bit MSB  
> executable,
> PowerPC or cisco 4500, version 1 (SYSV), statically linked, stripped

"make clean all" does not put anything in usr/bin, so you at least alo  
have done a "make install" afterwards.

> So I'm still puzzled that the recipe for creating a cross compiler is
> actually cross-compiling a compiler and cross-compiling the tools.
>
> Of course,  compiler/ppcrossppc was created, but it seems as a  
> precursor
> to creating all the powerpc binaries.

It's a cross compiler, which is indeed necessary to create PowerPC  
binaries.

> So I still think I'm doing it wrong; was my make command line  
> correct to
> produce an fpc instance that will cross-compile for powerpc-linux?

Cross compilers are only intended as add-ons to a native compiler  
suite. If you do a plain install, the Makefiles assume you want to  
create a native install for the target platform (although currently  
this will only work consistently if both the source and target  
platform have the same endianess).

If you want to perform an add-on cross install (which will only  
install the cross compiler and units, but not the PowerPC-native  
compiler and utilities -- as the natively installed versions of those  
utilities will be used), do something like this:

make FPC=`pwd`/compiler/ppcrossppc INSTALL_PREFIX=/tmp/fpc_patchdir/ 
fpc_build/usr install CROSSINSTALL=1

(the CROSSINSTALL=1 may not even be necessary when you point FPC to  
the cross compiler, as the Makefile should detect that it's a cross  
compiler and set that variable itself)


Jonas


More information about the fpc-pascal mailing list