Sign in Join

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

Mailing lists / lazarus / 2018-11

How to build FPC/Lazarus from sources on Windows?

11 messages · 6 people · –

Reply by email Subscribe to this list Your subscription

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

Bo Berglund

I am used to installing FPC/Lazarus on Linux machines from sources via svn. I have created a script that does most of the necessary stuff for this.

Now I want to do the same on Windows7, but I am not really sure how. When I google I get old instructions from the Lazarus 0.9 times, so these are not especially useful.
Just one item: make

This is a necessary item to be able to build both FPC and Lazarus, yet on my machine the only make utility I find are these:

where make
C:\Programs\CodeGear\RAD Studio\6.0\bin\make.exe
C:\Programs\Embarcadero\RAD Studio\12.0\bin\make.exe C:\Programs\Borland\BDS\4.0\Bin\make.exe
C:\Programs\CodeGear\RAD Studio\5.0\bin\make.exe
C:\Programs\Borland\Delphi7\Bin\make.exe

As you can see there are no less than 5 different make utilities all coming from various installations of Delphi/RAD Studio.

Are these OK to use or do I need to get (how?) some other make utility? Maybe a GNU version???

Is there an up-to-date page describing the exact procedure to build FPC and Lazarus from sources retrieved via SVN on Windows?

I do have several older versions of Lazarus/fpc installed already (1.6, 1.8, 1.8.4 32 bit) but none seems to put fpc.exe on path. The fpc version for the 1.8.x lazarus is 3.0.4 bundeled with their respective and 1.6 uses fpc 3.0.0.

I want to move forward with this and not rely on some binary package if possible.

Bo Berglund Developer in Sweden

Reply by email

Bo Berglund
to Bo Berglund
Bo Berglund wrote 13 lines
On Wed, 07 Nov 2018 11:51:36 +0100, Bo Berglund via lazarus wrote: >Is there an up-to-date page describing the exact procedure to build >FPC and Lazarus from sources retrieved via SVN on Windows? > After posting I found this page: http://wiki.lazarus.freepascal.org/Installing_Lazarus#Compiling.2Finstalling_FPC_and_Lazarus_from_Sources_of_SVN_.28Win32.29 Maybe this is the definite instruction? I will have a look and see if it works out like I need...

A question:
This page deals with 32 bit fpc/lazarus at least on Windows... If I want to build the 64 bit version, where should I then put the 64 bit binutils?
The suggested path c:\freepascal\binutils\i386-win32\ seems incorrect.

Could I set it to c:\freepascal\binutils\x86_64-win64\ ? Or does it not matter? I really would like to have both 32 and 64 bit available.

Bo Berglund Developer in Sweden

Reply by email

John Landmesser
to Bo Berglund

have a look at:

http://wiki.freepascal.org/fpcupdeluxe

that should be sufficient?!!

Bo Berglund wrote 27 lines
On Wed, 07 Nov 2018 12:23:29 +0100, Bo Berglund via lazarus wrote: > On Wed, 07 Nov 2018 11:51:36 +0100, Bo Berglund via lazarus > wrote: > >> Is there an up-to-date page describing the exact procedure to build >> FPC and Lazarus from sources retrieved via SVN on Windows? >> > After posting I found this page: > > http://wiki.lazarus.freepascal.org/Installing_Lazarus#Compiling.2Finstalling_FPC_and_Lazarus_from_Sources_of_SVN_.28Win32.29 > > Maybe this is the definite instruction? > I will have a look and see if it works out like I need... > A question: This page deals with 32 bit fpc/lazarus at least on Windows... If I want to build the 64 bit version, where should I then put the 64 bit binutils? The suggested path c:\freepascal\binutils\i386-win32\ seems incorrect. Could I set it to c:\freepascal\binutils\x86_64-win64\ ? Or does it not matter? I really would like to have both 32 and 64 bit available.

Reply by email

leledumbo
to Bo Berglund: On Wed, 07 Nov 2018 12:23:29 +0100, Bo Berglund via lazarus A question: This page deals…
If I want to build the 64 bit version, where should I then put the 64 bit

binutils?

Wherever -FD in your fpc.cfg points to (remember, fpc.cfg supports conditionals).

The suggested path c:\freepascal\binutils\i386-win32\ seems incorrect.

Why not? The binutils itself could still be 32-bit while generating 64-bit binaries. Native 64-bit shouldn't be there, of course.

Reply by email

Bo Berglund
to leledumbo
leledumbo wrote 10 lines
> If I want to build the 64 bit version, where should I then put the 64 bit binutils? Wherever -FD in your fpc.cfg points to (remember, fpc.cfg supports conditionals). > The suggested path c:\freepascal\binutils\i386-win32\ seems incorrect. Why not? The binutils itself could still be 32-bit while generating 64-bit binaries. Native 64-bit shouldn't be there, of course.

So in fact I don't really need the 64 bit versions of the binutil files?

I looked further down on the page I found and noted this regarding creation of the bat file used to build fpc:

For crosscompiler to x86_64 add the following after the first make:

make all OS_TARGET=win64 CPU_TARGET=x86_64 INSTALL_PREFIX=%myFPC% PP=%mybinutils%\ppc386.exe DATA2INC=%myFPC%\utils\data2inc.exe make crossinstall OS_TARGET=win64 CPU_TARGET=x86_64 INSTALL_PREFIX=%myFPC% PP=%mybinutils%\ppc386.exe
DATA2INC=%myFPC%\utils\data2inc.exe

It rather looks like I don't need two different Lazarus installations in order to build for both 32 and 64 bit windows, right? In that case should I not focus on the 64 bit version and have 32 bit as a crosscompile target?

I.e. Use Lazarus 64 bit to sometimes create a 32 bit program through cross-compile.

Now I am unsure of what kind of Lazaruses I really do have (4 versions at the moment). Is there a simple way to check if lazaus itself is 32 or 64 bit?

For Lazarus the bat file looks like this:

set myroot=c:\freepascal
set myFPC=%myroot%\fpc\3.0.4
set mybinutils=%myroot%\binutils
set PATH=%mybinutils%\i386-win32;%myFPC%\bin\i386-win32;%PATH% cd %myroot%\laz
make clean all OPT="-glw2 -Xg"

Will it build a 64 or 32 bit version of Lazarus?
Looks like it uses 32 bit paths...

Bo Berglund Developer in Sweden

Reply by email

Marcos Douglas B. Santos
to Bo Berglund: On Wed, 07 Nov 2018 11:51:36 +0100, Bo Berglund via lazarus After posting I found this…
AM Bo Berglund wrote 13 lines
On Wed, 07 Nov 2018 11:51:36 +0100, Bo Berglund via lazarus wrote: >Is there an up-to-date page describing the exact procedure to build >FPC and Lazarus from sources retrieved via SVN on Windows? > After posting I found this page: http://wiki.lazarus.freepascal.org/Installing_Lazarus#Compiling.2Finstalling_FPC_and_Lazarus_from_Sources_of_SVN_.28Win32.29 Maybe this is the definite instruction? I will have a look and see if it works out like I need...

I made this page - then others have updated too.
I've been using this script (my own, updated, you can get here[1]) for many years, however using fpcupdeluxe is much simpler.

[1] https://github.com/mdbs99/fp-scripts

regards,
Marcos Douglas

Reply by email

Marcos Douglas B. Santos
to Bo Berglund: On Wed, 7 Nov 2018 18:39:59 -0700 (MST), leledumbo via lazarus So in fact I don't really…
AM Bo Berglund wrote 52 lines
On Wed, 7 Nov 2018 18:39:59 -0700 (MST), leledumbo via lazarus wrote: >> If I want to build the 64 bit version, where should I then put the 64 bit >binutils? > >Wherever -FD in your fpc.cfg points to (remember, fpc.cfg supports >conditionals). > >> The suggested path c:\freepascal\binutils\i386-win32\ seems incorrect. > >Why not? The binutils itself could still be 32-bit while generating 64-bit >binaries. Native 64-bit shouldn't be there, of course. So in fact I don't really need the 64 bit versions of the binutil files? I looked further down on the page I found and noted this regarding creation of the bat file used to build fpc: For crosscompiler to x86_64 add the following after the first make: make all OS_TARGET=win64 CPU_TARGET=x86_64 INSTALL_PREFIX=%myFPC% PP=%mybinutils%\ppc386.exe DATA2INC=%myFPC%\utils\data2inc.exe make crossinstall OS_TARGET=win64 CPU_TARGET=x86_64 INSTALL_PREFIX=%myFPC% PP=%mybinutils%\ppc386.exe DATA2INC=%myFPC%\utils\data2inc.exe It rather looks like I don't need two different Lazarus installations in order to build for both 32 and 64 bit windows, right? In that case should I not focus on the 64 bit version and have 32 bit as a crosscompile target? I.e. Use Lazarus 64 bit to sometimes create a 32 bit program through cross-compile. Now I am unsure of what kind of Lazaruses I really do have (4 versions at the moment). Is there a simple way to check if lazaus itself is 32 or 64 bit? For Lazarus the bat file looks like this: set myroot=c:\freepascal set myFPC=%myroot%\fpc\3.0.4 set mybinutils=%myroot%\binutils set PATH=%mybinutils%\i386-win32;%myFPC%\bin\i386-win32;%PATH% cd %myroot%\laz make clean all OPT="-glw2 -Xg" Will it build a 64 or 32 bit version of Lazarus? Looks like it uses 32 bit paths...

See here - https://github.com/mdbs99/fp-scripts/blob/master/fpc-make.bat#L54-L58 At least for Windows, you might install i386-win32 version then, if you want, compile a x86_64 version as explained on script above.

But, again, try fpcupdeluxe... "there is not life without it" :)

regards,
Marcos Douglas

Reply by email

Bo Berglund
to John Landmesser: have a look at: http://wiki.freepascal.org/fpcupdeluxe that should be sufficient?!!
John Landmesser wrote 6 lines
have a look at: http://wiki.freepascal.org/fpcupdeluxe that should be sufficient?!!

Looks interesting!
But I have a request:
I tried to set it up for installing fpc fixes3.2 x86_64 on windows and also wanted to set the crosscompiler installation. Plus selecting the lazarus version.

But then when I clicked the Install cross-compiler button to select which crosscompiler to choose, it started a pretty long process which clearly was not wanted and I saw no way to stop it! It failed since it could not read some file that was supposed to be there I guess. Later I found a button way down to the right named Halt! Is that what is supposed to be used for such mistakes as I did?

Please add a confirmation box *before* operations are started so mistakes like this can be avoided.

Regarding crosscompilers:
How can I set up those when there is no selector for *which* crosscompiler I want to also install? The CPU selector seems to be just a single selector option box.

Anyway I corrected what I did wrong and set it in motion. Took a while and then it stopped with:

C:\fpc\lazarus\components\lazutils\utf8process.pp(362,69) Error: (3285) Expected another 2 array elements
utf8process.pp(695) Fatal: (10026) There were 1 errors compiling module, stopping
Fatal: (1018) Compilation aborted
Error: C:\fpc\fpc\bin\x86_64-win64\ppcx64.exe returned an error exitcode
C:\fpc\fpcbootstrap\make.exe: *** [lazutils] Error 2 fpcupdeluxe: ERROR: LazarusNativeInstaller (BuildModuleCustom: Lazbuild): make.exe returned error code #2

ERROR: Fpcupdeluxe fatal error !

So what is the deal now?

Bo Berglund Developer in Sweden

Reply by email

Alfred
to Bo Berglund

Fpcupdeluxe tries to install an isolated version of FPC and Lazarus. And can help you in installing cross-compilers for this isolated version.

Sequence:
First, install a suitable FPC (and Lazarus) version with fpcupdeluxe in a directory of choice.
(in you case FPC fixes 3.2 (and Lazarus fixes 2.0 or trunk))

After this process has finished, you can install a cross-compiler. Choose a CPU and OS and click install cross-compiler. In most cases, this process will fail due to missing libs and bins. Allow fpcupdeluxe to download the libs and bins and continue with the process.
The second run should end with a successful build of the cross-compiler.

Keep in mind: many things can go wrong during the process. The output should give you more clues in case of errors. If so, you can report them in the forum.

------ Origineel bericht ------
Van: "Bo Berglund via lazarus"
Aan:
CC: "Bo Berglund"
Verzonden: 8-11-2018 18:07:06
Onderwerp: Re: [Lazarus] How to build FPC/Lazarus from sources on Windows?

Show quoted text 60 lines
On Wed, 7 Nov 2018 21:51:45 +0100, John Landmesser via lazarus wrote: >have a look at: > >http://wiki.freepascal.org/fpcupdeluxe > >that should be sufficient?!! > Looks interesting! But I have a request: I tried to set it up for installing fpc fixes3.2 x86_64 on windows and also wanted to set the crosscompiler installation. Plus selecting the lazarus version. But then when I clicked the Install cross-compiler button to select which crosscompiler to choose, it started a pretty long process which clearly was not wanted and I saw no way to stop it! It failed since it could not read some file that was supposed to be there I guess. Later I found a button way down to the right named Halt! Is that what is supposed to be used for such mistakes as I did? Please add a confirmation box *before* operations are started so mistakes like this can be avoided. Regarding crosscompilers: How can I set up those when there is no selector for *which* crosscompiler I want to also install? The CPU selector seems to be just a single selector option box. Anyway I corrected what I did wrong and set it in motion. Took a while and then it stopped with: C:\fpc\lazarus\components\lazutils\utf8process.pp(362,69) Error: (3285) Expected another 2 array elements utf8process.pp(695) Fatal: (10026) There were 1 errors compiling module, stopping Fatal: (1018) Compilation aborted Error: C:\fpc\fpc\bin\x86_64-win64\ppcx64.exe returned an error exitcode C:\fpc\fpcbootstrap\make.exe: *** [lazutils] Error 2 fpcupdeluxe: ERROR: LazarusNativeInstaller (BuildModuleCustom: Lazbuild): make.exe returned error code #2 ERROR: Fpcupdeluxe fatal error ! So what is the deal now? -- Bo Berglund Developer in Sweden -- _______________________________________________ lazarus mailing list https://lists.lazarus-ide.org/listinfo/lazarus

Reply by email