Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2017-11

Cross-compiling to win32 from debian stretch

12 messages · 4 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

kardan

Hallo,

As a I am new to this list, FreePascal and Lazarus I need a little help by you to crosscompile our project to win32. Compiling to win64 however succeeds:

$ lazbuild --pcp=../../lazconf --os=win64 --cpu=x86_64 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: Win64 for x64
(3104) Compiling Tomboy_NG.lpr
(9022) Compiling
resource /home/tomboy/src/tomboy/src/tomboy-ng/lib/x86_64-win64/Tomboy_NG.obj (9015) Linking tomboy-ng.exe (1008) 25 lines compiled, 13.7 sec, 2336192 bytes code, 408468 bytes data (1022) 2 hint(s) issued

As you see, I installed FPC from trunk with the steps documented here: https://github.com/traumschule/tomboy/issues/2

I had to use the repository as the zip version
ftp.freepascal.org/pub/fpc/snapshot/trunk/source/fpc.zip (3.1.1) did not create ppcross386 for OS_TARGET=win32". With the version from trunk it works however.

Now compiling our project for i386 compared to above output another fpc is used and fails:

$ lazbuild --pcp=../../lazconf --os=win32 --cpu=i386 Tomboy_NG.lpi Free Pascal Compiler version 3.0.4rc1 [2017/08/07] for i386 Copyright (c) 1993-2017 by Florian Klaempfl and others (1002) Target OS: Win32 for i386
(3104) Compiling fcllaz.pas
Fatal: (10022) Can't find unit system used by fcllaz Fatal: (1018) Compilation aborted
Error: /usr/bin/ppc386 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

$ which fpc
/usr/local/bin/fpc
$ fpc -V|head -n1
Free Pascal Compiler version 3.0.4rc1 [2017/08/07] for i386 $ ls /usr/lib/fpc/*/units
/usr/lib/fpc/3.0.4/units:
i386-linux

/usr/lib/fpc/3.1.1/units:
i386-win32 x86_64-win64
$ ls /usr/bin/ppcross*
/usr/bin/ppcross386 /usr/bin/ppcrossx64
$ /usr/bin/ppcross386 -V|head -n1
Free Pascal Compiler version 3.1.1 [2017/11/27] for i386 $ /usr/bin/ppcrossx64 -V|head -n1
Free Pascal Compiler version 3.1.1 [2017/11/27] for x86_64

I assume the solution is to specify another compiler in ../../lazconf/environmentoptions.xml so I attached it. I am using Lazarus 1.8.0RC5 installed via deb from sourceforge. Without other advise I will try again with Lazarus from trunk.

If you want to try my steps, this repository may be of help: https://github.com/tomboy-notes/tomboy-ng

To build it, I use ansible for automation:
https://github.com/traumschule/tomboy

To explain the funny path above, these are the steps I did: cd ~/src
git clone https://github.com/traumschule/tomboy
cd tomboy
./bin/configure.sh # this installs lazarus, patches KControls and checks out tomboy-ng cd src/tomboy-ng
lazbuild --pcp=../../lazconf --os=win32 --cpu=i386 Tomboy_NG.lpi

Thanks!
kardan
-------------- next part --------------
A non-text attachment was scrubbed...
Name: environmentoptions.xml
Type: application/xml
Size: 1060 bytes
Desc: not available
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20171128/3c3f02c8/attachment-0001.xml>

Reply by email

Mattias Gaertner
to kardan
Show quoted text 7 lines
[...] $ lazbuild --pcp=../../lazconf --os=win32 --cpu=i386 Tomboy_NG.lpi Free Pascal Compiler version 3.0.4rc1 [2017/08/07] for i386 Copyright (c) 1993-2017 by Florian Klaempfl and others (1002) Target OS: Win32 for i386 (3104) Compiling fcllaz.pas Fatal: (10022) Can't find unit system used by fcllaz

Check your -Fu paths in /etc/fpc.cfg. They should contain the paths to fpc's i386-win32 ppu files.

Mattias

Reply by email

kardan
to Mattias Gaertner

Really appreciate the fast reply!

Check your -Fu paths in /etc/fpc.cfg. They should contain the paths to fpc's i386-win32 ppu files. Mattias

This is what i found related to -Fu in /etc/fpc.cfg:

# 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

#ifdef cpui8086
-Fu/usr/lib/fpc/$fpcversion/units/$fpctarget/$fpcsubarch-$fpcmemorymodel -Fu/usr/lib/fpc/$fpcversion/units/$fpctarget/$fpcsubarch-$fpcmemorymodel/* -Fu/usr/lib/fpc/$fpcversion/units/$fpctarget/$fpcsubarch-$fpcmemorymodel/rtl #endif

#IFDEF FPCAPACHE_1_3
-Fu/usr/lib/fpc/$fpcversion/units/$fpctarget/httpd13/ #ELSE
#IFDEF FPCAPACHE_2_0
-Fu/usr/lib/fpc/$fpcversion/units/$fpctarget/httpd20 #ELSE
-Fu/usr/lib/fpc/$fpcversion/units/$fpctarget/httpd22 #ENDIF
#ENDIF

# searchpath for fppkg user-specific packages
-Fu~/.fppkg/lib/fpc/$fpcversion/units/$FPCTARGET/*

~/.fpkg does not exist, but there is another version in /etc:

$ ls /etc/fpc*
/etc/fpc-3.0.0.cfg  /etc/fpc.bak  /etc/fpc.cfg  /etc/fpc.cfg.bak

$ diff /etc/fpc.cfg /etc/fpc-3.0.0.cfg
2c2
< # Config file generated by fpcmkcfg on 21-11-17 - 14:07:55 ---

# Config file generated by fpcmkcfg on 10-11-17 - 07:19:33

145c145
< -FM/usr/lib/fpc/../../share/fpc/$fpcversion/unicode/ ---

-FM/unicode/

283a284,289

Show quoted text 6 lines
# multiarch library search path -Fl/usr/lib/$fpctarget-* # Third party units should be installe in a, multi-arch compatible location. # Units should be installed in /usr/lib/$fpctarget-gnu/fp-units-2.6.2/$pkg/. # Ech fp-units package should install a configuration file called $pkg.cfg in #CFGDIR /etc/fpc-$fpcversion.cfg.d/$fpctarget

From that I can't see why 3.0.4rc1 is used for win32. Kardan

Reply by email

Péter Gábor
to kardan

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

2017-11-28 00:41 keltezéssel, kardan via Lazarus írta:

Show quoted text 62 lines
Really appreciate the fast reply! On Tue, 28 Nov 2017 00:20:29 +0100 Mattias Gaertner via Lazarus wrote: > Check your -Fu paths in /etc/fpc.cfg. They should contain the > paths to fpc's i386-win32 ppu files. > > Mattias This is what i found related to -Fu in /etc/fpc.cfg: # 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 #ifdef cpui8086 -Fu/usr/lib/fpc/$fpcversion/units/$fpctarget/$fpcsubarch-$fpcmemorymodel -Fu/usr/lib/fpc/$fpcversion/units/$fpctarget/$fpcsubarch-$fpcmemorymodel/* -Fu/usr/lib/fpc/$fpcversion/units/$fpctarget/$fpcsubarch-$fpcmemorymodel/rtl #endif #IFDEF FPCAPACHE_1_3 -Fu/usr/lib/fpc/$fpcversion/units/$fpctarget/httpd13/ #ELSE #IFDEF FPCAPACHE_2_0 -Fu/usr/lib/fpc/$fpcversion/units/$fpctarget/httpd20 #ELSE -Fu/usr/lib/fpc/$fpcversion/units/$fpctarget/httpd22 #ENDIF #ENDIF # searchpath for fppkg user-specific packages -Fu~/.fppkg/lib/fpc/$fpcversion/units/$FPCTARGET/* ~/.fpkg does not exist, but there is another version in /etc: $ ls /etc/fpc* /etc/fpc-3.0.0.cfg /etc/fpc.bak /etc/fpc.cfg /etc/fpc.cfg.bak $ diff /etc/fpc.cfg /etc/fpc-3.0.0.cfg 2c2 < # Config file generated by fpcmkcfg on 21-11-17 - 14:07:55 --- > # Config file generated by fpcmkcfg on 10-11-17 - 07:19:33 145c145 < -FM/usr/lib/fpc/../../share/fpc/$fpcversion/unicode/ --- > -FM/unicode/ 283a284,289 > # multiarch library search path > -Fl/usr/lib/$fpctarget-* > # Third party units should be installe in a, multi-arch compatible location. > # Units should be installed in /usr/lib/$fpctarget-gnu/fp-units-2.6.2/$pkg/. > # Ech fp-units package should install a configuration file called $pkg.cfg in > #CFGDIR /etc/fpc-$fpcversion.cfg.d/$fpctarget From that I can't see why 3.0.4rc1 is used for win32. Kardan
Péter Gábor

Reply by email

Mattias Gaertner
to kardan: Really appreciate the fast reply! On Tue, 28 Nov 2017 00:20:29 +0100 This is what i found…
Show quoted text 16 lines
Really appreciate the fast reply! On Tue, 28 Nov 2017 00:20:29 +0100 Mattias Gaertner via Lazarus wrote: > Check your -Fu paths in /etc/fpc.cfg. They should contain the > paths to fpc's i386-win32 ppu files. > > Mattias This is what i found related to -Fu in /etc/fpc.cfg: # 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

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

From that I can't see why 3.0.4rc1 is used for win32.

Maybe ppc386 is in the PATH.
fpc -Pi386 -Twin32

You can specify the compiler that lazbuild uses with --compiler=

Mattias

Reply by email

kardan
to Péter Gábor: You may have a different fpc.cfg (named .fpc.cfg << spot the dot on Linux) in your home…

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.

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.)

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

Reply by email

kardan
to kardan

Hi,

it looks like I need to train my patience a bit more.

Show quoted text 6 lines
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.

can I still expect an answer or what did I do wrong?

Thanks for your hints!
Kardan

Reply by email

Mattias Gaertner
to kardan: summary: my fpc and ppcross* have different versions, because I can't build fpc with the…
Show quoted text 8 lines
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.

In general you need the last release of FPC to build the new FPC. And with release I don't mean release candidates. So 3.0.2 was the last release.
FPC 3.0.4 was released today, so FPC trunk will soon require 3.0.4.

Mattias

Reply by email

Péter Gábor
to kardan: it looks like I need to train my patience a bit more. On Tue, 28 Nov 2017 20:21:47 +0100…

First rebuild your normal (not the cross version) FPC from trunk.

Then change your path environment variable to contain the new compiler's path. You can change it if you open the file .profile in your home folder. Add a new line to the end of the file. An example: export PATH=/home/the-new-path-comes-here/:$PATH
Logout and Login again to apply the changes.
You can check which compiler will be used with the 'which fpc" command.

Now you can build your cross compiler with your new compiler on the new path. The old one will be bypassed if everything is okay.

I hope I didn't miss anything...

2017-11-30 10:58 keltezéssel, kardan via Lazarus írta:

Show quoted text 19 lines
Hi, it looks like I need to train my patience a bit more. On Tue, 28 Nov 2017 20:21:47 +0100 kardan via Lazarus wrote: > 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. can I still expect an answer or what did I do wrong? Thanks for your hints! Kardan
Péter Gábor

Reply by email

kardan
to Mattias Gaertner: On Tue, 28 Nov 2017 20:21:47 +0100 In general you need the last release of FPC to build…

Today I upgraded fpc* to 3.0.4+dfsg-2. Thanks for uploading the latest release to debian testing so fast!

Show quoted text 10 lines
> ~/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. In general you need the last release of FPC to build the new FPC. And with release I don't mean release candidates. So 3.0.2 was the last release. FPC 3.0.4 was released today, so FPC trunk will soon require 3.0.4. Mattias

Thanks for the info. Just tried it again:

$ git svn fetch && make all
Makefile:2918: *** The only supported starting compiler version is 3.0.2. You are trying to build with 3.0.4.. Stop.

$ fpc|head -n3
Free Pascal Compiler version 3.0.4 [2017/10/02] for i386 Copyright (c) 1993-2017 by Florian Klaempfl and others /usr/local/bin/fpc [options] <inputfile> [options]

$ export fpcoptions='OS_TARGET=win32 CPU_TARGET=i386' $ make all $fpcoptions
Makefile:215: *** The Makefile doesn't support target i386-win32, please run fpcmake first. Stop.
$ fpcmake && make all $fpcoptions
Processing Makefile.fpc
i386-linux requires:
Writing Makefile
Makefile:215: *** The Makefile doesn't support target i386-win32, please run fpcmake first. Stop.

What did I do wrong? Note that for me basic steps related to fpc are unknown, however I am able to follow the orders by the compiler output.

Thanks!
kardan

Reply by email

Unknown author
to kardan
kardan wrote 5 lines
Thanks for the info. Just tried it again: $ git svn fetch && make all Makefile:2918: *** The only supported starting compiler version is 3.0.2. You are trying to build with 3.0.4.. Stop.

as noted previously, you /MUST/ use 3.0.2 to build 3.0.4... after 3.0.4 is adopted and made the minimum version, then you can use it to build newer versions greater than 3.0.4 but to build 3.0.4 you will /always/ have to use 3.0.2, the last release before 3.0.4 became available...

NOTE: No off-list assistance is given without prior approval. *Please keep mailing list traffic on the list unless* *a signed and pre-paid contract is in effect with us.*

Reply by email

Mattias Gaertner
to kardan: Today I upgraded fpc* to 3.0.4+dfsg-2. Thanks for uploading the latest release to debian…
Show quoted text 5 lines
[...] $ export fpcoptions='OS_TARGET=win32 CPU_TARGET=i386' $ make all $fpcoptions Makefile:215: *** The Makefile doesn't support target i386-win32, please run fpcmake first. Stop.

The hint about 'run fpcmake' is misleading here. Do not run it. Please revert any changes.
svn revert -R .

What did I do wrong? Note that for me basic steps related to fpc are unknown, however I am able to follow the orders by the compiler output.

It works here with the svn checkout of fpc trunk.
Maybe you fetched the wrong repository or you have local modifications or you have a different 'make'.

Mattias

Reply by email