Errors compiling TSynEdit ad TSynHighligher routines in Lazarus 1.6.2? lazarus / 31-LCL ---------------------------------------------------------------------- vfclists · 2017-02-27 17:21 I am compiling the vclua project which uses some of the TSynEdit/Highlighter files, using Lazarus 1.6.5 and FPC 3.0.3. These are the error messages from versions 0.5 and 0.6.1 vclua 0.5 -  32bit:failure, 64bit:failure error message Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i syneditmarks.pp(1048,35) Error: Illegal type conversion: "TSynEditMarkChangeReasons" to "LongInt"  offending code Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i procedure TSynEditMarkChangedHandlerList.Add(AHandler: TSynEditMarkChangeEvent;  Changes: TSynEditMarkChangeReasons);begin  AddBitFilter(TMethod(AHandler), LongInt(Changes));end; vclua 0.6.1 -  32bit:success, 64bit:failure error message Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i SynHighlighterLua.pas(1045,13) Error: Illegal type conversion: "Pointer" to "TRangeState"SynHighlighterLua.pas(1050,13) Error: Illegal type conversion: "TRangeState" to "Pointer"  offending code Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i procedure TSynLuaSyn.SetRange(Value: Pointer);begin  fRange := TRangeState(Value);end; function TSynLuaSyn.GetRange: Pointer;begin  Result := Pointer(fRange);end;  I have noticed that the TSyn projects often produce errors and I wonder why, not just with 1.6.2/3.0.2 but even earlier versions. Could it be down to changes to the code, or could it be due to some the project using some compiler options which are not compatible with the TSynXXX projects? ---------------------------------------------------------------------- marcov · 2017-02-27 17:56 No, I think it is simply the versioning from synedit itself. Lazarus uses synedit as the main editor so editor improvements over time cause synedit mutations. ---------------------------------------------------------------------- vfclists · 2017-02-27 18:10 Quote from: marcov on February 27, 2017, 06:56:45 pmNo, I think it is simply the versioning from synedit itself. Lazarus uses synedit as the main editor so editor improvements over time cause synedit mutations. How can I fix this? Does it mean that the version of SynEdit used by Lazarus has moved on from the one in the component directory? Are the some kind of casts I can use to fix the issues, something I really want to avoid as changing the built in components is a no-no for me? I built my version of Lazarus using fpcupdeluxe. ---------------------------------------------------------------------- Martin_fr · 2017-02-27 18:35 Are the failing sources in vclua, or in SynEdit? ----------- Some of those errors remind me of things that are 64 or 32 bit only errors. Quote "TRangeState" to "Pointer"I dont know what source causes that, but search through SynEdits own sources. You may need to typecast via PtrInt or PtrUInt Pointer(PtrInt(rangestate)) ---------------------------------------------------------------------- vfclists · 2017-02-27 18:57 Quote from: Martin_fr on February 27, 2017, 07:35:27 pmAre the failing sources in vclua, or in SynEdit? ----------- Some of those errors remind me of things that are 64 or 32 bit only errors. Quote "TRangeState" to "Pointer"I dont know what source causes that, but search through SynEdits own sources. You may need to typecast via PtrInt or PtrUInt Pointer(PtrInt(rangestate)) I am compiling with a 64bit build and the errors are in the lazarus components not the project. Do errors like these which are fixed in the source have to be sent to the bugtracker or are they required only in my local project? ---------------------------------------------------------------------- Martin_fr · 2017-02-27 22:07 It would be good to get them on the bugtracker. I just did a build of Lazarus 1.6.4 (entire IDE, incl SynEdit) on 64 bit with fpc 3.0.2. And the build succeeded. So I need the exact settings (compile options), to compile SynEdit package, that will trigger this error. 1.6.5 at the moment is near identical to 1.6.4. I guess 3.0.3 and 3.0.2 have little diff either. Otherwise it would be desirable to know if it happens with 3.0.2 too (since it could be an fpc issue) If I cannot reproduce on 1.6.4 / 3.0.2 then I will need to know, if you can. -------------------- Those errors happen from time to time, because when committing new code it is usually tested with one set of compiler options and for one of 32/64 bit only. ---------------------------------------------------------------------- vfclists · 2017-02-28 14:41 The error also appears in Lazarus 1.6.4 /FPC 3.0.2 64 bit version. A closer look at the SynHighlighterLua.pas file show that it belongs to the vclua project itself and is not included in Lazarus Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i $Id: SynHighlighterLua.pas,v 1.1.1.1 2009/01/12 02:34:32 jhansen Exp $ You may retrieve the latest version of this file at the SynEdit home page,located at http://SynEdit.SourceForge.net ----------------------- --------------------------------------------------------} // 2014/06/10 - added nonkeyword , modified keyword handling (vclua.sf.net)  Quote from: Martin_fr on February 27, 2017, 11:07:51 pmIt would be good to get them on the bugtracker. I just did a build of Lazarus 1.6.4 (entire IDE, incl SynEdit) on 64 bit with fpc 3.0.2. And the build succeeded. So I need the exact settings (compile options), to compile SynEdit package, that will trigger this error. 1.6.5 at the moment is near identical to 1.6.4. I guess 3.0.3 and 3.0.2 have little diff either. Otherwise it would be desirable to know if it happens with 3.0.2 too (since it could be an fpc issue) If I cannot reproduce on 1.6.4 / 3.0.2 then I will need to know, if you can. -------------------- Those errors happen from time to time, because when committing new code it is usually tested with one set of compiler options and for one of 32/64 bit only. ---------------------------------------------------------------------- Martin_fr · 2017-02-28 15:00 what about: QuoteCode: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i     syneditmarks.pp(1048,35) Error: Illegal type conversion: "TSynEditMarkChangeReasons" to "LongInt"    That is part of Lazarus. But as I said, it did compile for me (on both 32 and 64 bit). That is unless the unit is not compiled when building the IDE. ---------------------------------------------------------------------- vfclists · 2017-02-28 15:04 The error from the 0.5.0 version is in Lazarus its self - \lazarus\components\synedits\syneditmarks.pp Does this mean that the build process does not actually compile it, or skips it on an error because it not used by any installed components or libraries? QuoteI am compiling the vclua project which uses some of the TSynEdit/Highlighter files, using Lazarus 1.6.5 and FPC 3.0.3. These are the error messages from versions 0.5 vclua 0.5 -  32bit:failure, 64bit:failure error message Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i syneditmarks.pp(1048,35) Error: Illegal type conversion: "TSynEditMarkChangeReasons" to "LongInt"  offending code Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i procedure TSynEditMarkChangedHandlerList.Add(AHandler: TSynEditMarkChangeEvent;  Changes: TSynEditMarkChangeReasons);begin  AddBitFilter(TMethod(AHandler), LongInt(Changes));end; ---------------------------------------------------------------------- vfclists · 2017-02-28 15:08 Quote from: Martin_fr on February 28, 2017, 04:00:12 pmwhat about: QuoteCode: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i     syneditmarks.pp(1048,35) Error: Illegal type conversion: "TSynEditMarkChangeReasons" to "LongInt"    That is part of Lazarus. But as I said, it did compile for me (on both 32 and 64 bit). That is unless the unit is not compiled when building the IDE. Are you compiling with the current table builds i.e 1.6.2/300/302 or 1.6.4/300/302? Did you compile it with another projects or the vclua project itself? Perhaps it could be down to some projects settings in vclua which is a dll/so. ---------------------------------------------------------------------- Martin_fr · 2017-03-01 02:23 Quote from: vfclists on February 28, 2017, 04:08:34 pmAre you compiling with the current table builds i.e 1.6.2/300/302 or 1.6.4/300/302? Did you compile it with another projects or the vclua project itself? Perhaps it could be down to some projects settings in vclua which is a dll/so. I did a full IDE build. Afaik that builds the entire package. Build with tagged versions 3.0.2, and 1.6.4  (Actually, build with the official 1.6.4 win 64 bit release binaries / the fpc included is build from svn, not taken from the fpc release bin, but that is the case for all past lazarus releases.) I just compiled a new empty project, to which I added the unit. no problems (on 64 bit). And the unit definitely got compiled, if I put an error in there, then it fails, if I remove it again, then it compiles. I only tested windows. and intel. Not sure about other targets. It looks as if for some reason your fpc does not think of LongInt as 32 bit signed integer. Or some setting affects, the sizeof(set) ---------------------------------------------------------------------- vfclists · 2017-03-01 07:32 Quote from: Martin_fr on March 01, 2017, 03:23:57 amQuote from: vfclists on February 28, 2017, 04:08:34 pmAre you compiling with the current table builds i.e 1.6.2/300/302 or 1.6.4/300/302? Did you compile it with another projects or the vclua project itself? Perhaps it could be down to some projects settings in vclua which is a dll/so. I did a full IDE build. Afaik that builds the entire package. Build with tagged versions 3.0.2, and 1.6.4  (Actually, build with the official 1.6.4 win 64 bit release binaries / the fpc included is build from svn, not taken from the fpc release bin, but that is the case for all past lazarus releases.) I just compiled a new empty project, to which I added the unit. no problems (on 64 bit). And the unit definitely got compiled, if I put an error in there, then it fails, if I remove it again, then it compiles. I only tested windows. and intel. Not sure about other targets. It looks as if for some reason your fpc does not think of LongInt as 32 bit signed integer. Or some setting affects, the sizeof(set) I have attached the source code for the projects. Can you try to see if they will compile successfully on your system? They are also available at https://sourceforge.net/projects/vclua/files/?source=navbar I have to add another reply to add the second attachment ---------------------------------------------------------------------- vfclists · 2017-03-01 07:34 Second attachment of vclua source ---------------------------------------------------------------------- Martin_fr · 2017-03-01 11:45 Until I get to look at the project, check your fpc config for http://www.freepascal.org/docs-html/3.0.0/user/userap1.html   -CPPACKSET=  set allocation: 0, 1 or DEFAULT or NORMAL, 2, 4 and 8    -CPPACKENUM=  enum packing: 0, 1, 2 and 4 or DEFAULT or NORMAL  Also check in the project options "Additions and Overrides", the "Configure Build Lazarus" Dialog (option menu), and of course the SynEdit Package options (or ensure the latter are not changed from svn). Not tested, but I guess SynEdit will fail with those. ---------------------------------------------------------------------- vfclists · 2017-03-01 13:26 Quote from: Martin_fr on March 01, 2017, 12:45:16 pmUntil I get to look at the project, check your fpc config for http://www.freepascal.org/docs-html/3.0.0/user/userap1.html   -CPPACKSET=  set allocation: 0, 1 or DEFAULT or NORMAL, 2, 4 and 8    -CPPACKENUM=  enum packing: 0, 1, 2 and 4 or DEFAULT or NORMAL  Also check in the project options "Additions and Overrides", the "Configure Build Lazarus" Dialog (option menu), and of course the SynEdit Package options (or ensure the latter are not changed from svn). Not tested, but I guess SynEdit will fail with those. The -CPPACKSET and -CPPACKENUM are not in the fpc.cfg and all the Lazarus code comes unchanged from SVN. Both 0.5.0 and 0.6.1 compile in Lazarus 1.4.4/2.6.4 32bit. I haven't tried them both on 64 bit Lazarus 1.4.4. I will try that later to see if they will both compile. ---------------------------------------------------------------------- Martin_fr · 2017-03-01 14:51 I did just build the 6.1 on win 64bit (1.6.4 / 3.0.2) (I did not apply the patch, but that should not have an effect on SynEdit) There is a warning about the search path. Apparently the project add the path of SynEdit. It should use the package instead. But that does not seem to be the issue. (Well actually it could be, it can lead to stale ppu files, make sure you check in your apps output folder for any synedit related ppu, and delete them) I had to comment the 2 lines in HL-Lua. (it seems the ptruint trick will work here) I did not get any error in syneditmarks. ------------- try in an empty project (without the lua code) to use the syneditmarks, and writeln the sizeof TSynEditMarkChangeReasons It should be 4. label1.Caption := IntToStr(sizeof(TSynEditMarkChangeReasons)); ---------------------------------------------------------------------- vfclists · 2017-03-04 22:58 Quote from: Martin_fr on March 01, 2017, 03:51:20 pmI did just build the 6.1 on win 64bit (1.6.4 / 3.0.2) (I did not apply the patch, but that should not have an effect on SynEdit) There is a warning about the search path. Apparently the project add the path of SynEdit. It should use the package instead. But that does not seem to be the issue. (Well actually it could be, it can lead to stale ppu files, make sure you check in your apps output folder for any synedit related ppu, and delete them) I had to comment the 2 lines in HL-Lua. (it seems the ptruint trick will work here) I did not get any error in syneditmarks. ------------- try in an empty project (without the lua code) to use the syneditmarks, and writeln the sizeof TSynEditMarkChangeReasons It should be 4. label1.Caption := IntToStr(sizeof(TSynEditMarkChangeReasons)); I have managed to get them both working. The problem in the 0.5.0 version was fixed by removing SynEdit and RTTI controls from the project path and adding their packages. Quoteb]error message[/b] Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i syneditmarks.pp(1048,35) Error: Illegal type conversion: "TSynEditMarkChangeReasons" to "LongInt"  offending code Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i procedure TSynEditMarkChangedHandlerList.Add(AHandler: TSynEditMarkChangeEvent;  Changes: TSynEditMarkChangeReasons);begin  AddBitFilter(TMethod(AHandler), LongInt(Changes));end; I don't understand why removing the package directories from the path and adding the packages themselves to the project should fix those issues. The .lpr file as this code ad the top. Could the {mode Deplhi} be a factor. Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i library vcl; {$mode Delphi}{$H+}{$i vcldef.inc} {$R *.res}  How could one analyze the code for the reason? What are the circumstances in which compiling the code rather than linking to the precompiled units should cause an error? The problem in the 0.6.1 version was fixed by using PtrUint. Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i procedure TSynLuaSyn.SetRange(Value: Pointer);begin  fRange := TRangeState(PtrUint((Value)));end; function TSynLuaSyn.GetRange: Pointer;begin  Result := Pointer(PtrUint(fRange));end;