[fpc-pascal] getting cross with the cross compiler

pascalX at piments.com pascalX at piments.com
Sat Oct 7 12:53:57 CEST 2017

On 07/10/17 11:14, Sven Barth via fpc-pascal wrote:
> Am 07.10.2017 11:11 schrieb "Karoly Balogh (Charlie/SGR)" 
> <charlie at scenergy.dfmk.hu <mailto:charlie at scenergy.dfmk.hu>>:
>  >
>  > Hi,
>  >
>  > On Sat, 7 Oct 2017, Sven Barth via fpc-pascal wrote:
>  >
>  > > > So where is my cross compiler ??
>  > > >
>  > > > Thanks for any help and suggestions.
>  > >
>  > > A single compiler binary can always compile for all supported 
> targets of
>  > > that processor. So as long as all the units are available you simply
>  > > need to pass "-Twin64" as additional parameter to compile for
>  > > x86_64-win64.
>  >
>  > Sigh. :) Any reason why Windows is different? No other OS has different
>  > target arguments for different CPUs, because the CPU type already
>  > specifies if its for 32 or 64bit... (fix me?)
> I had asked the same some time ago and the historic reason was that 
> especially the system unit was considered too different to have both of 
> them be the same target... I don't agree either, but that's how it is... :/
> Regards,
> Sven

OK  so the earlier statement was not strictly true, and I do need an fpc 
build which has been build with the cross compiler. This seems to be 
missing from the distro pkg which is why I got myself several days work 
trying to set this up from trunk.

This is all made more complicated  by having to keep the distro fpc to 
build trunk.

Now I have two different version , with trunk being able to cross 
compile a win64 exe of my hello.pas.

This seems fine from command line but when I try to use Lazarus to with 
project options specifying a Win64 target , it fails to find system.ppu 
and friends. The project builds and runs native.

HINT: using config file /etc/fpc.cfg
ERROR: compiled FPC unit not found: system.ppu
ERROR: compiled FPC unit not found: objpas.ppu
ERROR: compiled FPC unit not found: sysutils.ppu

Laz does seem to be sending the right args to fpc ( presumably to fpc )

     Info: (lazarus) Execute Title="Test: Compiling an empty file"
     Info: (lazarus) Working Directory="/tmp/"
     Info: (lazarus) Executable="/usr/bin/fpc"
     Info: (lazarus) Param[0]="-Twin64"
     Info: (lazarus) Param[1]="-Px86_64"
     Info: (lazarus) Param[2]="-MObjFPC"
     Info: (lazarus) Param[3]="-Scghi"
     Info: (lazarus) Param[4]="-O1"

I had to move the trunk libs to /usr/lib64 to be in the same place as 
the distro files and thus agree with fpc.cfg settings.

I am wondering whether this non-std position of the libs is highlighting 
a a bug in Lazarus assuming /usr/lib . It seems odd that command line 
fpc works but laz fails to find the libs.

Can you make any sense of this?


More information about the fpc-pascal mailing list