* * *

Author Topic: Errors compiling TSynEdit ad TSynHighligher routines in Lazarus 1.6.2?  (Read 3335 times)

vfclists

  • Hero Member
  • *****
  • Posts: 823
    • HowTos Considered Harmful?
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]
  1. syneditmarks.pp(1048,35) Error: Illegal type conversion: "TSynEditMarkChangeReasons" to "LongInt"
  2.  


offending code
Code: Pascal  [Select]
  1. procedure TSynEditMarkChangedHandlerList.Add(AHandler: TSynEditMarkChangeEvent;
  2.   Changes: TSynEditMarkChangeReasons);
  3. begin
  4.   AddBitFilter(TMethod(AHandler), LongInt(Changes));
  5. end;



vclua 0.6.1 -  32bit:success, 64bit:failure

error message
Code: Pascal  [Select]
  1. SynHighlighterLua.pas(1045,13) Error: Illegal type conversion: "Pointer" to "TRangeState"
  2. SynHighlighterLua.pas(1050,13) Error: Illegal type conversion: "TRangeState" to "Pointer"
  3.  

offending code
Code: Pascal  [Select]
  1. procedure TSynLuaSyn.SetRange(Value: Pointer);
  2. begin
  3.   fRange := TRangeState(Value);
  4. end;
  5.  
  6. function TSynLuaSyn.GetRange: Pointer;
  7. begin
  8.   Result := Pointer(fRange);
  9. end;
  10.  


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?
« Last Edit: February 27, 2017, 10:05:22 pm by vfclists »
Windows - Lazarus 1.0.8/FPC 2.6.0
Linux - Lazarus 1.4.4 /FPC 2.6.4

marcov

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 5743
Re: Errors compling TSynEdit ad TSynHighligher routines in Lazarus 1.6.2?
« Reply #1 on: February 27, 2017, 06:56:45 pm »
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

  • Hero Member
  • *****
  • Posts: 823
    • HowTos Considered Harmful?
Re: Errors compiling TSynEdit ad TSynHighligher routines in Lazarus 1.6.2?
« Reply #2 on: February 27, 2017, 07:10:08 pm »
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.

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.
Windows - Lazarus 1.0.8/FPC 2.6.0
Linux - Lazarus 1.4.4 /FPC 2.6.4

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 4354
    • wiki
Re: Errors compiling TSynEdit ad TSynHighligher routines in Lazarus 1.6.2?
« Reply #3 on: February 27, 2017, 07:35:27 pm »
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

  • Hero Member
  • *****
  • Posts: 823
    • HowTos Considered Harmful?
Re: Errors compiling TSynEdit ad TSynHighligher routines in Lazarus 1.6.2?
« Reply #4 on: February 27, 2017, 07:57:04 pm »
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))

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?
Windows - Lazarus 1.0.8/FPC 2.6.0
Linux - Lazarus 1.4.4 /FPC 2.6.4

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 4354
    • wiki
Re: Errors compiling TSynEdit ad TSynHighligher routines in Lazarus 1.6.2?
« Reply #5 on: February 27, 2017, 11:07:51 pm »
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

  • Hero Member
  • *****
  • Posts: 823
    • HowTos Considered Harmful?
Re: Errors compiling TSynEdit ad TSynHighligher routines in Lazarus 1.6.2?
« Reply #6 on: February 28, 2017, 03:41:08 pm »
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]
  1. $Id: SynHighlighterLua.pas,v 1.1.1.1 2009/01/12 02:34:32 jhansen Exp $
  2.  
  3. You may retrieve the latest version of this file at the SynEdit home page,
  4. located at http://SynEdit.SourceForge.net
  5.  
  6. -------------------------------------------------------------------------------}
  7.  
  8. // 2014/06/10 - added nonkeyword , modified keyword handling (vclua.sf.net)
  9.  

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.
Windows - Lazarus 1.0.8/FPC 2.6.0
Linux - Lazarus 1.4.4 /FPC 2.6.4

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 4354
    • wiki
Re: Errors compiling TSynEdit ad TSynHighligher routines in Lazarus 1.6.2?
« Reply #7 on: February 28, 2017, 04:00:12 pm »
what about:
Quote
Code: Pascal  [Select]
  1.     syneditmarks.pp(1048,35) Error: Illegal type conversion: "TSynEditMarkChangeReasons" to "LongInt"
  2.      

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

  • Hero Member
  • *****
  • Posts: 823
    • HowTos Considered Harmful?
Re: Errors compiling TSynEdit ad TSynHighligher routines in Lazarus 1.6.2?
« Reply #8 on: February 28, 2017, 04:04:51 pm »
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?

Quote
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
vclua 0.5 -  32bit:failure, 64bit:failure

error message
Code: Pascal  [Select]
  1. syneditmarks.pp(1048,35) Error: Illegal type conversion: "TSynEditMarkChangeReasons" to "LongInt"
  2.  


offending code
Code: Pascal  [Select]
  1. procedure TSynEditMarkChangedHandlerList.Add(AHandler: TSynEditMarkChangeEvent;
  2.   Changes: TSynEditMarkChangeReasons);
  3. begin
  4.   AddBitFilter(TMethod(AHandler), LongInt(Changes));
  5. end;

Windows - Lazarus 1.0.8/FPC 2.6.0
Linux - Lazarus 1.4.4 /FPC 2.6.4

vfclists

  • Hero Member
  • *****
  • Posts: 823
    • HowTos Considered Harmful?
Re: Errors compiling TSynEdit ad TSynHighligher routines in Lazarus 1.6.2?
« Reply #9 on: February 28, 2017, 04:08:34 pm »
what about:
Quote
Code: Pascal  [Select]
  1.     syneditmarks.pp(1048,35) Error: Illegal type conversion: "TSynEditMarkChangeReasons" to "LongInt"
  2.      

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.
Windows - Lazarus 1.0.8/FPC 2.6.0
Linux - Lazarus 1.4.4 /FPC 2.6.4

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 4354
    • wiki
Re: Errors compiling TSynEdit ad TSynHighligher routines in Lazarus 1.6.2?
« Reply #10 on: March 01, 2017, 03:23:57 am »
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.

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)




« Last Edit: March 01, 2017, 03:26:15 am by Martin_fr »

vfclists

  • Hero Member
  • *****
  • Posts: 823
    • HowTos Considered Harmful?
Re: Errors compiling TSynEdit ad TSynHighligher routines in Lazarus 1.6.2?
« Reply #11 on: March 01, 2017, 08:32:55 am »
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.

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
 
Windows - Lazarus 1.0.8/FPC 2.6.0
Linux - Lazarus 1.4.4 /FPC 2.6.4

vfclists

  • Hero Member
  • *****
  • Posts: 823
    • HowTos Considered Harmful?
Re: Errors compiling TSynEdit and TSynHighligher routines in Lazarus 1.6.2?
« Reply #12 on: March 01, 2017, 08:34:38 am »
Second attachment of vclua source
Windows - Lazarus 1.0.8/FPC 2.6.0
Linux - Lazarus 1.4.4 /FPC 2.6.4

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 4354
    • wiki
Re: Errors compiling TSynEdit ad TSynHighligher routines in Lazarus 1.6.2?
« Reply #13 on: March 01, 2017, 12:45:16 pm »
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=<y>  <y> set allocation: 0, 1 or DEFAULT or NORMAL, 2, 4 and 8 
  -CPPACKENUM=<y>  <y> 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

  • Hero Member
  • *****
  • Posts: 823
    • HowTos Considered Harmful?
Re: Errors compiling TSynEdit ad TSynHighligher routines in Lazarus 1.6.2?
« Reply #14 on: March 01, 2017, 02:26:00 pm »
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=<y>  <y> set allocation: 0, 1 or DEFAULT or NORMAL, 2, 4 and 8 
  -CPPACKENUM=<y>  <y> 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.
Windows - Lazarus 1.0.8/FPC 2.6.0
Linux - Lazarus 1.4.4 /FPC 2.6.4

 

Recent

Get Lazarus at SourceForge.net. Fast, secure and Free Open Source software downloads Open Hub project report for Lazarus