[Lazarus] Cross-compiling to win32 from debian stretch

kardan kardan at riseup.net
Tue Nov 28 20:21:47 CET 2017


Hi,

summary: my fpc and ppcross* have different versions, because I can't
build fpc with the installed version. Why does this happen:

~/src/fpc(master)$ make all
Makefile:2918: *** The only supported starting compiler version is
3.0.2. You are trying to build with 3.0.4..  Stop.

On Tue, 28 Nov 2017 08:18:29 +0100
Péter Gábor via Lazarus <lazarus at lists.lazarus-ide.org> wrote:

> You may have a different fpc.cfg (named .fpc.cfg << spot the dot on
> Linux) in your home folder.

$ find /|grep 'fpc*.cfg'
/etc/fpc.cfg
/etc/fpc.cfg.bak
/usr/lib/fpc/3.0.4/ide/text/fp.cfg
/usr/share/fpcsrc/3.0.4/utils/fpcmkcfg/fpccfg.inc
/home/tomboy/src/fpc/utils/fpcmkcfg/fpccfg.inc

$ /home/tomboy/src/fpc# ls -ls /usr/share/fpcsrc/
total 4
4 drwxr-xr-x 9 root root 4096 Nov 21 16:25 3.0.4
0 lrwxrwxrwx 1 root root    1 Nov 26 18:43 3.1.1 -> .
0 lrwxrwxrwx 1 root root    1 Nov 27 18:33 3.1.2 -> .

(These version numbers are nonsense, just needed a way to
separate the version from zip (3.1.1) and trunk (3.1.2) before I
dropped the first.)

On Tue, 28 Nov 2017 11:36:25 +0100
Mattias Gaertner via Lazarus <lazarus at lists.lazarus-ide.org> wrote:

> And where are your fpc's i386-win32 ppu files?

/usr/lib/fpc/3.1.1/units/i386-win32

$ find /usr/lib/fpc/3.1.1/units/i386-win32 -name '*.ppu'|grep system
/usr/lib/fpc/3.1.1/units/i386-win32/winunits-base/mmsystem.ppu
/usr/lib/fpc/3.1.1/units/i386-win32/rtl/system.ppu

> > # searchpath for units and other system dependent things
> > -Fu/usr/lib/fpc/$fpcversion/units/$fpctarget
> > -Fu/usr/lib/fpc/$fpcversion/units/$fpctarget/*
> > -Fu/usr/lib/fpc/$fpcversion/units/$fpctarget/rtl

So it should be found, no?

The term ppu was new to me. I just return from reading [1] and
installed the binutils:
$ sudo apt-get install binutils-mingw-w64 binutils-powerpc-linux-gnu
binutils-powerpc64-linux-gnu

[1] http://wiki.lazarus.freepascal.org/Cross_compiling#Units_for_target

> > From that I can't see why 3.0.4rc1 is used for win32.  
> 
> Maybe ppc386 is in the PATH.
> fpc -Pi386 -Twin32

true.

$ for fpc in /usr/bin/ppc*; do echo -n "$fpc: "; $fpc -V|head -n1; done
/usr/bin/ppc386: Free Pascal Compiler version 3.0.4rc1 [2017/08/07] for
i386
/usr/bin/ppcross386: Free Pascal Compiler version 3.1.1 [2017/11/27]
for i386
/usr/bin/ppcrossx64: Free Pascal Compiler version 3.1.1 [2017/11/27]
for x86_64

$ cd ~/src/tomboy/src/tomboy-ng
$ fpc -Pi386 -Twin32 -Fu/usr/lib/fpc/3.1.1/units/i386-win32 mainunit.pas
Free Pascal Compiler version 3.0.4rc1 [2017/08/07] for i386
Copyright (c) 1993-2017 by Florian Klaempfl and others
Target OS: Win32 for i386
Compiling tomboy-ng/mainunit.pas
Fatal: Can't find unit system used by MainUnit
Fatal: Compilation aborted
Error: /usr/bin/ppc386 returned an error exitcode

$ fpc -Pi386 -Twin32 -Fu/usr/lib/fpc/3.1.1/units/i386-win32 \
-Fu/usr/lib/fpc/3.1.1/units/i386-win32/rtl mainunit.pas
Free Pascal Compiler version 3.0.4rc1 [2017/08/07] for i386
Copyright (c) 1993-2017 by Florian Klaempfl and others
Target OS: Win32 for i386
Compiling mainunit.pas
PPU Loading /usr/lib/fpc/3.1.1/units/i386-win32/rtl/system.ppu
PPU Invalid Version 196
Fatal: Can't find unit system used by MainUnit
Fatal: Compilation aborted
Error: /usr/bin/ppc386 returned an error exitcod

$ /usr/bin/ppc386 -Pi386 -Twin32 -Fu/usr/lib/fpc/3.1.1/units/i386-win32
-Fu/usr/lib/fpc/3.1.1/units/i386-win32/rtl mainunit.pas
Free Pascal Compiler version 3.0.4rc1 [2017/08/07] for i386
Copyright (c) 1993-2017 by Florian Klaempfl and others
Target OS: Win32 for i386
Compiling mainunit.pas
PPU Loading /usr/lib/fpc/3.1.1/units/i386-win32/rtl/system.ppu
PPU Invalid Version 196
Fatal: Can't find unit system used by MainUnit
Fatal: Compilation aborted

$ /usr/bin/ppcross386 -Pi386 -Twin32
-Fu/usr/lib/fpc/3.1.1/units/i386-win32
-Fu/usr/lib/fpc/3.1.1/units/i386-win32/rtl mainunit.pas
Free Pascal Compiler version 3.1.1 [2017/11/27] for i386
Copyright (c) 1993-2017 by Florian Klaempfl and others
Target OS: Win32 for i386
Compiling mainunit.pas
mainunit.pas(57,24) Fatal: Can't find unit FileUtil used by MainUnit
Fatal: Compilation aborted

$ lazbuild Tomboy_NG.lpi
Free Pascal Compiler version 3.1.1 [2017/11/27] for x86_64
Copyright (c) 1993-2017 by Florian Klaempfl and others
(1002) Target OS: Linux for x86-64
(3104) Compiling fcllaz.pas
Fatal: (10022) Can't find unit system used by fcllaz
Fatal: (1018) Compilation aborted
Error: /usr/bin/ppcrossx64 returned an error exitcode
Error: (lazarus) Compile package FCL 1.0.1: stopped with exit code 256
Error: (lazarus) [TLazPackageGraph.CompileRequiredPackages] "Exit code
256"
Error: (lazbuild) Project dependencies
of /home/tomboy/src/tomboy/src/tomboy-ng/Tomboy_NG.lpi

> You can specify the compiler that lazbuild uses with --compiler=
       --compiler=<ppcXXX>
              override the default compiler. e.g. ppc386, ppcx64,
ppcppc etc.

$ lazbuild --compiler=ppc386 Tomboy_NG.lpi
<compiles a lot>
(3104) Compiling /home/tomboy/src/tomboy/lib/tkweb-kcontrols-9fab2d710a8c/source/kdbgrids.pas
(1010) Writing Resource String Table file: kdbgrids.rsj
(1008) 77290 lines compiled, 9.4 sec
(1021) 10 warning(s) issued
(1023) 9 note(s) issued
TCompiler.WriteError Error: invalid compiler: file "ppc386" does not exist
Error: (lazbuild) failed compiling of project /home/tomboy/src/tomboy/src/tomboy-ng/Tomboy_NG.lpi

Now it's time to learn from you again.

> > Kardan


More information about the Lazarus mailing list