Sign in Join

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

Mailing lists / fpc-devel / 2021-08

Building a debug version of FPC-main on Windows

10 messages · 4 people · –

Reply by email Subscribe to this list Your subscription

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

Werner Pamler

I am using the following script to build a debug version of FPC-main on Windows:

set BINUTILS_DIR=C:\Lazarus\fpc_bootstrap_compiler\3.2.2\i386-win32 set BOOTSTRAP_COMPILER=%BINUTILS_DIR%\ppc386.exe
set FPC_DEST_DIR=c:\Lazarus\fpc-main
set BIN_DIR=bin\i386-win32
set FPC_BIN_DIR=%FPC_DEST_DIR%\%BIN_DIR%
set OPTIONS="-dDEBUG -gl -gw2"

::------------------------------------------------------------------------------ :: Set Path
::------------------------------------------------------------------------------ path %BINUTILS_DIR%;%PATH%

::------------------------------------------------------------------------------ :: Build FPC
::------------------------------------------------------------------------------ cd %FPC_DEST_DIR%
md %FPC_BIN_DIR%
copy %BINUTILS_DIR%\*.* %FPC_BIN_DIR%

make distclean
make install all OPT=%OPTIONS% INSTALL_PREFIX=%FPC_DEST_DIR% PP=%BOOTSTRAP_COMPILER%

::------------------------------------------------------------------------------ :: Make fpc.cfg,
::------------------------------------------------------------------------------ cd %FPC_DEST_DIR%
fpcmkcfg -d basepath=%FPC_DEST_DIR% -o %FPC_BIN_DIR%\fpc.cfg

This works fine for the first time when I apply it in a freshly cloned folder. But after having pulled a new version later, I does not work any more, it fails when the percentage counter of the installer is at 99% and when the command "make -C utils all" is to be executed, and when ptop.pp is compiled. The error message is "Can't find unit CustApp used by PtoP"

[...]
make[2]: Entering directory `c:/Lazarus/fpc-main/utils' c:/Lazarus/fpc-main/compiler/ppc386.exe fpmake.pp
-Fuc:/Lazarus/fpc-main/rtl/units/i386-win32
-Fuc:/Lazarus/fpc-main/packages/paszlib/units/i386-win32 -Fuc:/Lazarus/fpc-main/packages/fcl-process/units/i386-win32 -Fuc:/Lazarus/fpc-main/packages/hash/units/i386-win32 -Fuc:/Lazarus/fpc-main/packages/libtar/units/i386-win32 -Fuc:/Lazarus/fpc-main/packages/fpmkunit/units/i386-win32 -Fuc:/Lazarus/fpc-main/packages/fcl-json/units/i386-win32 -dDEBUG -gl -gw2 -dDEBUG -gl -gw2
./fpmake.exe compile --localunitdir=.. --globalunitdir=../packages --os=win32 --cpu=i386 -o -Ur -o -Xs -o -O2 -o -n -o -dDEBUG -o -gl -o -gw2 -o -di386 -o -dRELEASE
--compiler=c:/Lazarus/fpc-main/compiler/ppc386.exe -bu Start compiling package utils for target i386-win32.        Compiling BuildUnit_utils.pp
       Compiling usubst.pp
       Compiling ptopu.pp
       Compiling ptop.pp
The installer encountered the following error:
External command "c:/Lazarus/fpc-main/compiler/ppc386.exe -Twin32 -FEbin\i386-win32 -FUunits\i386-win32\
-FuC:\Lazarus\fpc-main\rtl\units\i386-win32\
-FuC:\Lazarus\fpc-main\units\i386-win32\fcl-base\
-FuC:\Lazarus\fpc-main\units\i386-win32\rtl-objpas\ -FuC:\Lazarus\fpc-main\units\i386-win32\paszlib\
-FuC:\Lazarus\fpc-main\units\i386-win32\hash\
-FuC:\Lazarus\fpc-main\units\i386-win32\fcl-json\
-FuC:\Lazarus\fpc-main\units\i386-win32\rtl-extra\ -Ur -Xs -O2 -n -dDEBUG -gl -gw2 -di386 -dRELEASE -viq ptop.pp" failed with exit code 1. Console output:
Target OS: Win32 for i386
Compiling ptop.pp
PPU Loading C:\Lazarus\fpc-main\units\i386-win32\fcl-base\custapp.ppu PPU Source: custapp.pp not available
Recompiling CustApp, checksum changed for
C:\Lazarus\fpc-main\rtl\units\i386-win32\sysutils.ppu ptop.pp(21,29) Fatal: Can't find unit CustApp used by PtoP Fatal: Compilation aborted

The error does not occur when I remove the OPT=%OPTIONS% from the make command line.

Does somebody have an idea what I am doing wrong?

Thanks.

Reply by email

Marco van de Voort
to Werner Pamler

Op 8/23/2021 om 1:36 PM schreef Werner Pamler via fpc-devel:

make install all OPT=%OPTIONS% INSTALL_PREFIX=%FPC_DEST_DIR% PP=%BOOTSTRAP_COMPILER%

Shouldn't this (install all) be the other way around? Classically one builds it before one installs it.

Reply by email

Werner Pamler
to Marco van de Voort
Marco van de Voort wrote 5 lines
Op 8/23/2021 om 1:36 PM schreef Werner Pamler via fpc-devel: > make install all OPT=%OPTIONS% INSTALL_PREFIX=%FPC_DEST_DIR% > PP=%BOOTSTRAP_COMPILER% Shouldn't this (install all) be the other way around? Classically one builds it before one installs it.

It does not make a difference. Now I found out that when I delete the units directory manually before calling the batch, everything works correctly, even with the OPT parameter. I thought that the "clean" does this?

Reply by email

Marco van de Voort
to Werner Pamler

Op 8/23/2021 om 4:20 PM schreef Werner Pamler via fpc-devel:

Show quoted text 12 lines
Am 23.08.2021 um 14:06 schrieb Marco van de Voort via fpc-devel: > Op 8/23/2021 om 1:36 PM schreef Werner Pamler via fpc-devel: >> make install all OPT=%OPTIONS% INSTALL_PREFIX=%FPC_DEST_DIR% >> PP=%BOOTSTRAP_COMPILER% > Shouldn't this (install all) be the other way around? Classically one > builds it before one installs it. It does not make a difference. Now I found out that when I delete the units directory manually before calling the batch, everything works correctly, even with the OPT parameter. I thought that the "clean" does this?

I looked again, and the only thing atypical that I notice is that you point lazarus to the ppu's in the FPC source tree, while maybe via fpc.cfg also the installed tree is included. Though  I don't understand why that would cause problems.

Reply by email

Werner Pamler
to Marco van de Voort
Marco van de Voort wrote
[...] I notice is that you point lazarus to the ppu's in the FPC source tree [...]

Sorry, I don't understand: There is no Lazarus involved in my build script. If there is, show me the line and how you would modify it.

Reply by email

Marco van de Voort
to Werner Pamler

Op 8/24/2021 om 4:22 PM schreef Werner Pamler via fpc-devel:

Show quoted text 6 lines
Am 23.08.2021 um 18:14 schrieb Marco van de Voort via fpc-devel: > [...] I notice is that you point lazarus to the ppu's in the FPC > source tree [...] Sorry, I don't understand: There is no Lazarus involved in my build script. If there is, show me the line and how you would modify it.

Sorry. I'm on holiday, and I only check in
changing PP= to FPC=

Reply by email

Werner Pamler
to Marco van de Voort
Marco van de Voort wrote
Sorry. I'm on holiday, and I only check in changing PP= to FPC=

Thank you, Marco. Now I did already the second successful build of a older clone after an update. This really was the solution. But what is the difference between PP= and FPC= ?

Reply by email

Michael Van Canneyt
to Werner Pamler
Werner Pamler wrote 6 lines
Am 25.08.2021 um 20:53 schrieb Marco van de Voort via fpc-devel: > Sorry. I'm on holiday, and I only check in > changing PP= to FPC= Thank you, Marco. Now I did already the second successful build of a older clone after an update. This really was the solution. But what is the difference between PP= and FPC= ?

The latter is a small wrapper around the former, which allows to select target CPU and version (if I recall correctly) and can also be used to print the name of the correct binary to use.

araminta: ~/fpc >fpc -PB
/usr/local/bin/ppcx64
araminta: ~/fpc >fpc -Pi386 -PB
/usr/local/bin/ppc386

Michael.

Reply by email

Marco van de Voort
to Werner Pamler: Thank you, Marco. Now I did already the second successful build of a older clone after an…

Op 8/28/2021 om 10:52 PM schreef Werner Pamler via fpc-devel:

Show quoted text 6 lines
Am 25.08.2021 um 20:53 schrieb Marco van de Voort via fpc-devel: > Sorry. I'm on holiday, and I only check in > changing PP= to FPC= Thank you, Marco. Now I did already the second successful build of a older clone after an update. This really was the solution. But what is the difference between PP= and FPC= ?

As michael says, the make file use both FPC and PP which point internally to the corresponding binaries (fpc(.exe) and ppc<arch>(.exe)).

What I think is that the FPC binary found in the path  was queried (and found a ppc<x> binary in the same dir) and overrode your PP= setting.

Reply by email

Tomas Hajny
to Marco van de Voort
Marco van de Voort wrote 15 lines
Op 8/28/2021 om 10:52 PM schreef Werner Pamler via fpc-devel: > Am 25.08.2021 um 20:53 schrieb Marco van de Voort via fpc-devel: >> Sorry. I'm on holiday, and I only check in >> changing PP= to FPC= > Thank you, Marco. Now I did already the second successful build of a > older clone after an update. This really was the solution. But what is > the difference between PP= and FPC= ? As michael says, the make file use both FPC and PP which point internally to the corresponding binaries (fpc(.exe) and ppc<arch>(.exe)). What I think is that the FPC binary found in the path  was queried (and found a ppc<x> binary in the same dir) and overrode your PP= setting.

BTW, that raises a question whether we shouldn't consider the PP environment variable within the fpc binary... Obviously, that wouldn't help immediately to people having an older version of the fpc helper not supporting this functionality on PATH, but that would change over time. Just an idea.

Tomas

Reply by email