[fpc-pascal] getting cross with the cross compiler

pascalX at piments.com pascalX at piments.com
Sat Oct 7 11:39:53 CEST 2017


On 07/10/17 10:01, Sven Barth via fpc-pascal wrote:
> Am 07.10.2017 10:57 schrieb <pascalX at piments.com 
> <mailto:pascalX at piments.com>>:
>  >
>  > Hi,
>  >
>  > I am having trouble getting fpc to cross-compiler for win64 target.
>  >
>  > I'm using fedora 26 which supplies 3.0.2
>  >
>  > I used instructions here to create the cross compiler using trunk fpc 
> since the fedora fpc-src does not seem to have the full Makefile structure:
>  >
>  > 
> http://wiki.lazarus.freepascal.org/Cross_compiling_for_Win32_under_Linux#Free_Pascal
>  >
>  > I have a simple test file:
>  >
>  > {$MACRO ON}
>  > program Hello;
>  > begin
>  >   Writeln('Hello world, from FPC ', FPC_FULLVERSION, '!');
>  > end.
>  >
>  >
>  > This builds fine using the stock fpc 3.0.2 with linux target.  
> However, the supposed cross-compiler seems to be trying to build for linux.
>  >
>  > $/usr/lib/fpc/3.1.1/ppcrossx64  /back/coredata/hello.pas
>  > Free Pascal Compiler version 3.1.1 [2017/10/06] for x86_64
>  > Copyright (c) 1993-2017 by Florian Klaempfl and others
>  > Target OS: Linux for x86-64
>  > Compiling /back/coredata/hello.pas
>  > Fatal: Can't find unit system used by Hello
>  > Fatal: Compilation aborted
>  >
>  >
>  > $/usr/lib/fpc/3.1.1/ppcrossx64  -iTO
>  > linux
>  >
>  >
>  >
>  > 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.
> 
> Regards,
> Sven
> 
> 
Thanks Sven,

I have resolved this issue. It was due to having a distro based fpc 
which installs in /usr/lib64  and svn trunk which installs in /usr/lib .

Once I reunited both under /usr/lib64 I was able to compile native and 
cross versions. of my test prog.

I'm a little unclear when you say any compiler can always compile for 
all supported targets. All I have read indicates a specific make 
sequence to get a cross compiler.

make all OS_TARGET=win32 CPU_TARGET=i386
make crossinstall OS_TARGET=win32 CPU_TARGET=i386


Could you clarify ?

Thanks.



More information about the fpc-pascal mailing list