Recent

Author Topic: Package Use – Install raise compiler error: checksum changed, Can't find unit.  (Read 1413 times)

dmitryb

  • Jr. Member
  • **
  • Posts: 76
Hello

I have a package that compiles without errors when you select the More menu – Recompile Clean.
But when I try to install the package in the IDE (Use – Install) Lazarus gives an error

Code: [Select]
Build IDE: Exit code 2, Errors: 1, Warnings: 1
Warning: Recompiling DBGridEhFindDlgs, checksum changed for C:\RADStudio\lazarus\EhLib\Lib\x86_64-win64\DBGridEh.ppu
DBGridEhFindDlgs.pas(85,12) Error: Can't find unit DBGridEhFindDlgs used by DBGridEh

I can't figure out what the problem is.
1. Why does the compiler write "checksum changed". I haven't changed anything.
2. Why doesn't the compiler see the DBGridEhFindDlgs.pas file. The file is in the Vcl folder.

« Last Edit: April 05, 2025, 08:18:45 pm by dmitryb »

dsiders

  • Hero Member
  • *****
  • Posts: 1391
Hello

I have a package that compiles without errors when you select the More menu – Recompile Clean.
But when I try to install the package in the IDE (Use – Install) Lazarus gives an error
Build IDE: Exit code 2, Errors: 1, Warnings: 1
Warning: Recompiling DBGridEhFindDlgs, checksum changed for C:\RADStudio\lazarus\EhLib\Lib\x86_64-win64\DBGridEh.ppu
DBGridEhFindDlgs.pas(85,12) Error: Can't find unit DBGridEhFindDlgs used by DBGridEh
I can't figure out what the problem is.
1. Why does the compiler write "checksum changed". I haven't changed anything.
2. Why doesn't the compiler see the DBGridEhFindDlgs.pas file. The file is in the Vcl folder.

You do realize that this not a Delphi forum, right?
Preview the next Lazarus documentation release at: https://dsiders.gitlab.io/lazdocsnext

dmitryb

  • Jr. Member
  • **
  • Posts: 76
I don't use Delphi.
I use Lazarus 3.4 (rev lazarus_3_4) FPC 3.2.2 x86_64-win64-win32/win64

dmitryb

  • Jr. Member
  • **
  • Posts: 76
I noticed one feature.

If you click `More – Recompile Clean`.
Then wait more than 1 hour.
Then click `Use – Install`, the package is installed in `Lazarus IDE` without errors.

Probably, after an hour, the checksum becomes unchanged and `Lazarus IDE` no longer tries to recompile the package and uses the old binary files of the package.

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 11030
  • Debugger - SynEdit - and more
    • wiki
There is a bug in fpc ... that causes the checksum issue.

Several possible ways around.

1)
When the error happen, open the package, and compile it TWICE from the package window. then rebuild the IDE (WITHOUT clean all).
May or may not help

2)
Build the package with -Ur
But then if you edit/update files, you need to force the compile / delete the ppu yourself.
Should always help.

----------------

btw, rebuild clean => 1 hour? Even my long gone 32bit PC did it in about 2 minutes....
Well, that is for the IDE. I never tried that package in question....

Though, if you have very little memory AND if you enable "smart linking" => then yes, it can take forever. Smart linking needs memory.

wp

  • Hero Member
  • *****
  • Posts: 12761
I remember the DBGridEh package from my delphi times, but I am not aware that there is a Lazarus version of it. Are you sure that the package works with Lazarus? Sometimes providers do not set up packages correctly (they do it in the Delphi way with incorrect usage of unit paths). If it is a commercial package you should get in contact with the vendor (when you have to pay for it you can expect that it is working). If it is not commercial, can you provide a download link?

S_Gur

  • New member
  • *
  • Posts: 9
The author of this post is the developer of EhLib. The Lazarus version has been around for years

dmitryb

  • Jr. Member
  • **
  • Posts: 76
Quote
There is a bug in fpc ... that causes the checksum issue.

Even if there is an error related to checksum in fpc, the compiler should not raise an error.

if I click `Recompile Clean` in the package, the package is compiled without errors. This means the compiler sees the paths to the source files.

If, when pressing `Use – Install`, Lazarus detects an outdated unit and tries to recompile the package, it should do this in a standard way, similar to Recompile Clean.

But probably in `Use – Install` mode, Lazarus tries to recompile the package in some special mode, not taking into account the paths specified in the `Compiler Options – Paths` package settings.

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 11030
  • Debugger - SynEdit - and more
    • wiki
Quote
There is a bug in fpc ... that causes the checksum issue.

Even if there is an error related to checksum in fpc, the compiler should not raise an error.
That is why it is a bug...

Quote
if I click `Recompile Clean` in the package, the package is compiled without errors. This means the compiler sees the paths to the source files.

It sees it when you compile the package. But not when you compile another package or project that depends on that package.


What happens, afaik:

1) The package is compiled.
For that there is the "package unit" that has a uses, using all units in the package. The compiler is called with that file, and loads all the files in the uses, and compiles them all.
It writes the ppu for each such file.

2) Next package is compiled.
If the above package is in the dependency list, then for the above package the compiler will only be given the path to the ppu.
At that time the compiler can not recompile anything of the above package (and it shouldn't need to)


But in step 1, the compiler made a mistake. One of the files ended up with a wrong checksump

Afaik that happens when there are circular references (but not sure if it happens in other cases too). One of the 2 circular file gets a checksum of the other, before the other has finished. So that checksum then will be outdated immediately.


This is why -Ur helps => compile for release. ppu will be flagged, and checksums wont be checked. But that also means: no recompile even if needed.

And compiling the package twice (not clean, just compiling changed files the 2nd time), will sometimes (but not always) fix the file that had the bad checksum.

wp

  • Hero Member
  • *****
  • Posts: 12761
Based on Martin's recommendation of multiple package compilation I today was able to compile the Graphics32 library which probably had suffered from the same issue (https://forum.lazarus.freepascal.org/index.php/topic,70582.msg551487.html#msg551487).

dmitryb

  • Jr. Member
  • **
  • Posts: 76
Based on your description, there are two bugs that need to be fixed in Lazarus (Fps):
1. The bug related to checksum.
2. The problem related to compiling dependent libraries is also a bug. After all, in some cases the dependent library really needs to be recompiled.

dmitryb

  • Jr. Member
  • **
  • Posts: 76
How can I use -Ur parameter when I use lazbuild.exe? lazbuild.exe does not have such a parameter.

I use next line to compile the package:
Code: Text  [Select][+][-]
  1. C:\lazarus\lazbuild.exe --build-all ehlib.lpk || Pause

paweld

  • Hero Member
  • *****
  • Posts: 1356
You need to add in the package options
Lazarus Menu > Package > Open Package File (*.lpk) > "ehlib.lpk" > Open > Options > Compiler Options > Custom Options > add "-Ur" in "Custom options" memo (or click "All options" button and selsct "Ur" option) > Save changes
Best regards / Pozdrawiam
paweld

Thaddy

  • Hero Member
  • *****
  • Posts: 16805
  • Ceterum censeo Trump esse delendam
I can confirm a similar issue, but not for that component. It also happens - depending on mode - with fpc itself:
Code: [Select]
(10011) PPU Source: exeinfo.pp not available
(10028) Recompiling exeinfo, checksum changed for strings.ppu {impl}
Fatal: (10022) Can't find unit exeinfo used by lnfodwrf
Compiling/building on a different location by hand fixed that, fpcupdeluxe is stubborn and its version does not always compile a program.
Happens only on x86_64-win64. All other platforms are OK.

Ergo: seems to me it is not package related but debug related.
Even with the broken build compiling w/o debug settings simply works.
(build from today but that issue is a bit older, of course trunk)
« Last Edit: April 15, 2025, 05:52:58 pm by Thaddy »
Changing servers. thaddy.com may be temporary unreachable but restored when the domain name transfer is done.

dmitryb

  • Jr. Member
  • **
  • Posts: 76
How can I compile a package using the lazbuild.exe command line in the same mode that occurs when I open a package in Lazarus IDE and press the "Compile" buttons?

1.
If I open a package in Lazarus IDE and press "Compile" for the first time, Lazarus compiles all the files in the package.

When I press "Compile" for the second time, Lazarus compiles some of the files that had checksum mismatches.

When I press "Compile" for the third time, Lazarus does not compile any files, since all the checksums for all the files match the source codes.

2. Now via the command line.

If I compile a package using the command
Code: Pascal  [Select][+][-]
  1. C:\lazarus\lazbuild.exe --build-all ehlib.lpk || Pause
Then lazbuild.exe compiles all the files in the package.

Then, to fix the error related to the checksum flag, I run the compilation a second time without the --build-all flag
Code: Pascal  [Select][+][-]
  1. C:\lazarus\lazbuild.exe ehlib.lpk || Pause

But lazbuild.exe does not compile any files, considering that all source codes correspond to binary codes. But this is not the case, checksum mismatches for some files are still present.

I have to open Lazarus IDE and click "Compile" to recompile some of the package files for which there are checksum mismatches.

 

TinyPortal © 2005-2018