[fpc-pascal] Why can't 64bit FPC cross-compile 32bit

Jonas Maebe jonas.maebe at elis.ugent.be
Mon Nov 9 14:48:26 CET 2009

On 09 Nov 2009, at 14:27, Graeme Geldenhuys wrote:

> Jonas Maebe wrote:
>> library search paths or so. The i386 compiler cannot generate x86_64
>> binaries. The appropriate code generator is simply not available.
> Ummm... I'll go read the wiki and buildfaq again. I'm a bit confused
> though. When I switched computers and moved from 32bit Linux to 64bit
> Linux, I used my 32bit Linux FPC 2.2.5 and cross-compiled a "what I
> thought was a 64bit FPC", and have been using that ever since as my
> 64bit FPC?

When you compile a compiler, there are three platforms that come into  
a) the platform on which you are compiling the new compiler
b) the platform on which you want to run the new compiler
c) the platform for which the new compiler should generate code

For the Linux/i386 compiler that we ship a = b = c = Linux/i386. With  
this compiler, you can however compile a compiler that ,e.g., runs on  
Linux/i386, but that generates code for x86_64 (it will be called  
ppcrossx64, and as the name implies it's a cross compiler)). And with  
this second compiler you can then compile a compiler that both runs on  
x86_64 and generates x86_64 (called ppcx64).

If you do a "make all CPU_TARGET=x86_64" in the FPC directory on a  
Linux/i386 platform, then the Makefile will automatically first  
compile a cross-compiler to x86_64 and then a native compiler for and  
to x86_64.


More information about the fpc-pascal mailing list