Lazarus

Free Pascal => FPC development => Topic started by: Ondrej Pokorny on March 09, 2015, 11:36:53 am

Title: Recompile changed FPC RTL unit
Post by: Ondrej Pokorny on March 09, 2015, 11:36:53 am
I am using FPC + Lazarus trunk. I made some patches to the RTL units (I sent them as a bug report as well).

How do I recompile RTL sources quickly?

For example, I modify the classes.pp file and I want to recompile it. How to do it quickly? For now I used to recompile the whole FPC compiler with make (which worked) but this needs a lot of time.
Title: Re: Recompile changed FPC RTL unit
Post by: Jonas Maebe on March 09, 2015, 12:07:01 pm
The problem is that if you modify the classes unit, you also have to recompile all units under packages that depend on the classes unit. So doing this kind of thing selectively very easily leads to unusable unit trees.

Note that you can significantly speed up the FPC source tree compilation by adding FPMAKEOPT="-T x" (with x = the number of cpu cores you have) to the make command line. You can also add NOWPOCYCLE=1 to reduce the number of times the compiler itself gets recompiled.
Title: Re: Recompile changed FPC RTL unit
Post by: Leledumbo on March 09, 2015, 05:36:29 pm
Do make inside RTL folder
Title: Re: Recompile changed FPC RTL unit
Post by: Ondrej Pokorny on March 10, 2015, 12:21:15 am
Do make inside RTL folder

This looks very promising. Although I am not really successful.
My source trunk directory: p:\software\FPC_trunk
The target directory: p:\software\FPC_trunk_exp

For the full FPC build, I use this batch script (started from p:\software) that works just fine:
Code: [Select]
@echo on
set mypath=p:\software\FPC_trunk_exp
set mybinutils=p:\software\Lazarus\fpc\2.6.4\bin\i386-win32
cd FPC_trunk
p:\software\Lazarus\fpc\2.6.4\bin\i386-win32\make clean all OPT="-gl -O-"
p:\software\Lazarus\fpc\2.6.4\bin\i386-win32\make install INSTALL_PREFIX=%mypath% PP=%mybinutils%\ppc386.exe
cd ..

For the RTL build, I came up with such script (also started from p:\software):
Code: [Select]
@echo on
set mypath=p:\software\FPC_trunk_exp
set mybinutils=p:\software\FPC_trunk_exp\bin\i386-win32
cd FPC_trunk\rtl
p:\software\Lazarus\fpc\2.6.4\bin\i386-win32\make clean all OPT="-gl -O-"
p:\software\Lazarus\fpc\2.6.4\bin\i386-win32\make install INSTALL_PREFIX=%mypath% PP=%mybinutils%\ppc386.exe
cd ..\..

It does produce .o and .ppu files but the Lazarus compiler doesn't seem to notice that (breakpoints at the old places, running old code) - what I am doing wrong? (The full build works fine.)
Title: Re: Recompile changed FPC RTL unit
Post by: Jonas Maebe on March 10, 2015, 12:24:36 am
Do make inside RTL folder

This looks very promising. Although I am not really successful.

Please don't do that. And if you start doing that anyway, never report any bugs before performing a complete make and install (like you have been doing until now) and reproducing the problem that way.
Title: Re: Recompile changed FPC RTL unit
Post by: Ondrej Pokorny on March 10, 2015, 12:31:48 am
Do make inside RTL folder

This looks very promising. Although I am not really successful.

Please don't do that. And if you start doing that anyway, never report any bugs before performing a complete make and install (like you have been doing until now) and reproducing the problem that way.

I see your point. Sometimes it's hard to know what advice to follow. Thanks!
Title: Re: Recompile changed FPC RTL unit
Post by: Leledumbo on March 10, 2015, 12:49:57 am
It does produce .o and .ppu files but the Lazarus compiler doesn't seem to notice that (breakpoints at the old places, running old code) - what I am doing wrong? (The full build works fine.)
Rebuild your project, clean up build files first if needed. The IDE might think no change required because executable is up to date.
Please don't do that. And if you start doing that anyway, never report any bugs before performing a complete make and install (like you have been doing until now) and reproducing the problem that way.
Meaning it's fine to do if you're not planning to report bugs with self-modified RTL. I did this when I need to debug RTL/FCL/Packages with old fashioned Write(Ln) due to certain things and it's fine so far. Full build takes too much time.
Title: Re: Recompile changed FPC RTL unit
Post by: Ondrej Pokorny on March 11, 2015, 11:31:41 am
It does produce .o and .ppu files but the Lazarus compiler doesn't seem to notice that (breakpoints at the old places, running old code) - what I am doing wrong? (The full build works fine.)
Rebuild your project, clean up build files first if needed. The IDE might think no change required because executable is up to date.

Of course I do that. But it still doesn't accept the new recompiled files. Nevertheless, I'll stay on the safe side I will do a full build every time. I don't fiddle with FPC sources that much.
TinyPortal © 2005-2018