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

Graeme Geldenhuys graeme at mastermaths.co.za
Mon Nov 9 13:49:20 CET 2009


Vincent Snijders wrote:
> Graeme Geldenhuys schreef:
>> Hi,
>> 
>> What can the 32bit FPC compiler (currently I run under Linux) 
>> cross-compile to 32bit Windows or 64bit Linux.
> 
> Do you mean that ppcx64 can generate code for win32? I don't think
> that is true.

See the output below. The 32bit Linux FPC can target 32bit & 64bit
platforms. But 64bit Linux FPC cannot target 32bit platforms. The later
can only cross-compile to other 64bit platforms.

----------------------
$ ppcx64 -i
Free Pascal Compiler version 2.3.1

Compiler Date      : 2009/10/22
Compiler CPU Target: x86_64

Supported targets:
  Linux for x86-64
  FreeBSD for x86-64
  Win64 for x64
  Darwin for x86_64

----------------------


----------------------
./ppc386 -i
Free Pascal Compiler version 2.2.5

Compiler Date      : 2009/05/28
Compiler CPU Target: i386

Supported targets:
  GO32 V2 DOS extender
  Linux for i386
  OS/2
  Win32 for i386
  FreeBSD/ELF for i386
  Solaris for i386 (under development)
  Beos for i386 (under development)
  NetBSD for i386 (under development)
  Netware for i386(clib)
  WDOSX DOS extender
  OpenBSD for i386 (under development)
  OS/2 via EMX
  Watcom compatible DOS extenders
  Netware for i386(libc)
  WinCE for i386
  Linux for x64_6432
  Darwin for i386
  Symbian OS for i386
----------------------



I'm new to supporting multiple compiler versions and now to add
cross-compilers to the mix. I don't know how I am supposed to structure
my directory layout or ~/.fpc.cfg file. Currently I have the following
layout.

/opt/
   .
   |-fpc_2.2.5
   |--- bin
   |--- lib
   |--- share
   |--- src
   |-fpc_2.3.1
   |--- bin
   |--- lib
   |--- share
   |--- src
   |-fpc_2.5.1
   |--- bin
   |--- lib
   |--- share
   |--- src


Example: When I compile a new 64-bit FPC 2.2.5 I do the following.

cd fpc_<ver>/src
make clean PP=/opt/fpc_2.2.5/bin/ppcx64
make all PP=/opt/fpc_2.2.5/bin/ppcx64
make install INSTALL_PREFIX=/opt/fpc_2.2.5 \
  PP=/opt/fpc_2.2.5/bin/ppcx64


I then do similar for other FPC versions too. The only problem being
that the 'bin' directory gets overwritten, so maybe I need to install
into a different directory for each version. Like this:

  INSTALL_PREFIX=/opt/fpc_2.2.5/64bit_linux
  INSTALL_PREFIX=/opt/fpc_2.2.5/32bit_linux
  INSTALL_PREFIX=/opt/fpc_2.2.5/32bit_windows  <- cross-compiler



Regards,
  - Graeme -

-- 
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://opensoft.homeip.net/fpgui/




More information about the fpc-pascal mailing list