Recent

Author Topic: Checksum Changed  (Read 4684 times)

J-G

  • Hero Member
  • *****
  • Posts: 966
Checksum Changed
« on: June 12, 2017, 11:24:16 pm »
This is the second time I've had this warning / fatal error.

A project I've compiled probably 50 times over the past few days after each small modification has suddenly thrown up
Warning: Recompiling TAGraph, checksum changed for Graphics
Fatal: Cannot find TAGraph used by Scale, incompatible ppu=T:\lazarus\components\tachart\lib\i386-win32\win32\tagraph.ppu, package TAChartLazarusPkg


The only part of the code that I modified was the colour of a TLineSeries (changing back didn't put things right).

There were no changes to any file in the win32 folder.

The previous time I had this error (2 days ago) was with a TDateTimePicker and I haven't had the chance to sort that out - the suggestion was to reinstall FPC/Laz (which I'm reluctant to do).

It seems very odd that the checksum could be changed without me copying different files into the win32 folder so I'm wondering if it is a 'false positive' but more important how to recover and stop it happening again.
 
FPC 3.0.0 - Lazarus 1.6 &
FPC 3.2.2  - Lazarus 2.2.0 
Win 7 Ult 64

wp

  • Hero Member
  • *****
  • Posts: 12793
Re: Checksum Changed
« Reply #1 on: June 12, 2017, 11:43:10 pm »
The message occurs if the compiler has access to several versions of the same ppu.

Look into the ppu directory of your project. Are there any TAChart ppus (all their names begin with "ta")? If this happens you have the TAChart package in your project's search path. Remove it and add the package to the project requirements instead (this happens automatically if you drop one of the package's components onto the form).

If there are no TAChart ppus in the ppu directory, do a clean recompilation of the IDE ("Tools" > "Configure build Lazarus" > "Clean up" = "Clean all" > "Build"). When Lazarus has restarted "build" the project

J-G

  • Hero Member
  • *****
  • Posts: 966
Re: Checksum Changed
« Reply #2 on: June 13, 2017, 01:02:57 am »
WP !!!   Thanks  -  Worthy of your epithet 'Hero Member' :)

Solved both issues in one 'build'.

I couldn't find a TAGraph.ppu in the project \lib directory though there was a 'scale.ppu' (the name of the .pas file) but there are two TAGraph.ppus in the Lazarus\components\tachart\lib folder, one under i386-win32\win32 and another under x86_64-win64\win32  -  which seems perfectly reasonable to me.

At least I've learned a little more about the inner workings of Lazarus (I haven't needed to look at "Tools" > "Configure build Lazarus" > "Clean all" > "Build" before) and I also found a flaw in my backup procedures :(  Whilst waiting for a response I had thought to restore the .ppu from my backup to see if that would effect a recovery but when looked for it, I discovered that my Lazarus directory is not in my backup profile !!!   It is now :)

There is always a silver lining to every cloud :)
FPC 3.0.0 - Lazarus 1.6 &
FPC 3.2.2  - Lazarus 2.2.0 
Win 7 Ult 64

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 11141
  • Debugger - SynEdit - and more
    • wiki
Re: Checksum Changed
« Reply #3 on: June 13, 2017, 01:34:28 am »
Quote
modification has suddenly thrown up
Warning: Recompiling TAGraph, checksum changed for Graphics
Fatal: Cannot find TAGraph used by Scale, incompatible ppu=T:\lazarus\components\tachart\lib\i386-win32\win32\tagraph.ppu, package TAChartLazarusPkg

Actually a bit more detail on this error. (at least as far as my understanding goes / the compiler is mighty complex)

The unit for which the checksum changed was "Graphics", so that is the one that has a duplicate (or otherwise changed).

Each PPU has (several) checksums.
Also each ppu has the checksums of all the ppu for the units that it uses.

Now when something tried to use TAGraph.ppu, fpc detected that tagraph.ppu referred to graphics, but the checksum for graphics in tagraph.ppu differed from the one in graphics.ppu.

......
Now you have to look at how a build is done.

Each package is build on its own.
While a package is build fpc is told where to find the pas sources for that packages. But only for that packages, fpc will not know where sources of other packages are.
Fpc will however be given the path to all ppu from all packages that are required by the currently build package (or project).

.....
So when tagraph was compiled it saw one graphics.ppu

Later another graphics.ppu was build, and 2 graphics.ppu where in the path. And fpc saw the wrong one. So fpc noticed a new checksum.

It is also possible that the same graphics was rebuild, if any package/project has a custom include path, and included units from the LCL via this path (rather than using a reference to the package), in that case one and the same graphics.pas ends up with 2 ppu.

Well there is another possible cause. There was and is only one graphics.pas/ppu.
But something (maybe change of compiler opts) triggered it to be rebuild.
If then for some reason the IDE did not notice and failed to rebuild the package with tachart in it, then that tachart would refer to an older/overwritten version of graphics.

.........
There is a 3rd known way for this error. But it (probably) does not apply here.
The error can happen with 2 files in the same package. If the have circular references, and use inline in a very specific way.
They will both be build, but later one of them will give this error. (At least that was possible with older fpc)

------------------
Just a bit of background into the issue

J-G

  • Hero Member
  • *****
  • Posts: 966
Re: Checksum Changed
« Reply #4 on: June 13, 2017, 02:24:15 am »
Just a bit of background into the issue
.... and helpful, Martin, thanks. Whether it will stop me creating similar issues in the future is debatable but at least I might better understand how to recover from a problem :)
FPC 3.0.0 - Lazarus 1.6 &
FPC 3.2.2  - Lazarus 2.2.0 
Win 7 Ult 64

 

TinyPortal © 2005-2018