[Lazarus] Build Lazarus with Clean all - cleaning packages

Mattias Gaertner nc-gaertnma at netcologne.de
Sat Oct 29 22:40:34 CEST 2011


On Sat, 29 Oct 2011 22:25:22 +0200
cobines <cobines at gmail.com> wrote:

> 2011/10/29 Mattias Gaertner <nc-gaertnma at netcologne.de>:
> > On Sat, 29 Oct 2011 21:09:50 +0200
> > cobines <cobines at gmail.com> wrote:
> >
> >> Shouldn't the package files be rebuilt automatically?
> >
> > Yes. They are. The IDE even add the -B option if needed.
> > But there are some corner cases.
> >
> ....
> >
> > It does work in normal cases.
> 
> When package is built even manually, from the IDE or using lazbuild
> not all files are rebuilt.

Yes, and there are cases where rebuilding is not enough. For example
when a file was moved one package up, then you must delete ppu files.
Because fpc never does that, rebuilding is not always sufficient, even
with -B.


> I think it is FPC issue because it doesn't
> always work with 2.4.4 but it does with 2.5.1 and 2.7.1.
> 
> I'll put things into example.
> 
> I have virtualtreeview installed. In the package there is
> VTHeaderPopup that uses VirtualTrees and VirtualTrees that uses
> Controls (from LCL). I introduce a new function:
> 
> function TControl.AutoSizeSomething: Boolean; virtual;
> begin
>   Result := True;
> end;
> 
> I change TControl.AutoSizeDelayedHandle:
> 
> begin
> -  Result := (Parent = nil);
> +  Result := (Parent = nil) and AutoSizeSomething;
> end;
> 
> so that the function is used somewhere.
> 
> I clean virtualtreeview manually, open the .lpk press compile. The
> VTHeaderPopup.o contains ...AUTOSIZESOMETHING symbol.
> 
> I rename AutoSizeSomething -> AutoSizeNothing.
> 
> I open the virtualtreeview.lpk and press Compile. It rebuilds LCLBase,
> LCL and virtualtreeview. The VirtualTrees unit is rebuilt and now
> contains AUTOSIZENOTHING but the VTHeaderPopup unit is not rebuilt, it
> still contains AUTOSIZESOMETHING, so linking IDE would fail because
> cannot find the symbol.

Yes, that is a fpc bug. A few such cases were fixed in fpc, but afaik
there are still a few cases.
Of course the IDE can not detect such a thing neither, unless it
reimplements a whole ppu check like the compiler. Makes no sense.


> If from the package editor I choose
> "More/Recompile all required" then VTHeaderPopup is rebuilt (maybe
> adds -B?).

Yes.

 
> But like I said the problem seems to be gone starting with FPC 2.5.1,
> so as long as files are added to .lpk they should be rebuilt. The
> reason for cleaning might be when source files are not in .lpk or have
> been deleted but the *.ppu and *.o still exist.

Afaik this is only the symptom. The real problem is the algorithm
checking the dependency of the checksums in ppu files.


Mattias




More information about the Lazarus mailing list