Thursday, August 30, 2007

Fixing Lazarus compilation with fpc 2.2.0

Last night FPC 2.2.0 was tagged. This means that the source code for the release is frozen, no more changes can be made. Now the release builders can start their job and create Windows installers, Linux rpms and debs and Mac OS X dmgs with installer packages. When they have finished their jobs, the FPC team will announce their release, probably in two weeks or so.

I am glad we have reached this point; the last critical bugs for Lazarus were fixed almost a month ago, all the Lazarus snapshots using fpc 2.1.5 were compiling fine and there had not been any reports about failures with fpc 2.1.5. So I was very surprised to get an email this morning from the debian builder, that Lazarus trunk could not be compiled with fpc 2.2.0.
Compiling memcheck.pasmemcheck.pas(211,17)
Error: Identifier not found "pptruint"memcheck.pas(211,17)
Error: Error in type definitionmemcheck.pas(222,33)
Error: Illegal qualifier memcheck.pas(1110,22)

The memcheck unit is a copy of the heaptrc unit from the RTL with some extras. Because there were no problems with fpc 2.1.5, I suspected it contained something like {$IFDEF VER2_1} which should be extended to version 2.2 too. But the source was clean of such version dependent ifdefs. I started to doubt if the snapshot were built with fpc 2.1.5 after all, the only difference between fpc 2.1.5 from yesterday and fpc 2.2.0 is the version number.

Then I got a idea, and looked in the build unit for the codetools allcodetoolunits.pp. It contained the following lines:
{$IF defined(VER2_2) or defined(VER2_3)}

We changed this to:

and now Lazarus is fpc 2.2.0 ready.

The memcheak unit depends on the heap manager and besides the use of unsigned integers the fpc 2.3 heap manager has some improvements for multithreaded programs, which make it incompatible with the fpc 2.2 heap manager.

1 comment:

af0815 said...

THX Vincent , so we can live a little more with your prozess of work.