You are not logged in.
Latest mORMot.pas does not compile using latest FPC for both i386-win32 and x86_64-linux. The line and msg shown are below.
Line 56264: ParamName := @VMP^.Name;
mORMot.pas(56264,30) Error: Variable identifier expected
The reason is in FPC 3.3.1-r39711 (installed using fpcupdeluxe), Name becomes a property. NamePtr should be used.
ParamName := VMP^.NamePtr;
PS: It seems that anonymous cannot create ticket now ? There is no create ticket on the tickets link.
Last edited by ComingNine (2018-09-12 08:09:31)
Offline
Just curious: do you plan not to fix it ?
Offline
Just curious: do you plan not to fix it ?
I am waiting for this too. AB gives the best support to an opensource project I have ever seen. Usually fixes come very fast. If not there is reason. Maybe his main job requires more of his time now ... I think we better trust him on task scheduling.
Also this could be an issue which needs to be fixed by the FPC team.
Last edited by Leslie7 (2018-09-18 06:47:04)
Offline
The problem is that FPC trunk - at least in this case. maybe more generally - does not handle the address operator for a record property with a getter.
This solves the problem and makes sense performance-wise, but directly accessing the underlying pointer may violate a design principle:
ParamName := VMP^.NamePtr;
Last edited by Leslie7 (2018-09-18 11:46:34)
Offline
I had the same problem. I keep two versions of Lazarus: NewPascal (with FPC 3.1.1) and Lazarus 1.8.4/FPC 3.0.4 stable on my system. This was OK for me until the Lazarus 1.8.4/FPC 3.0.4 could no longer handle the new TypeInfo changes in the latest version of mORMot (SynFPCTypInfo.pas).
Luckily, I saw on the Lazarus forum a new package Lazarus 1.9/FPC 3.2.0 Beta.
http://forum.lazarus-ide.org/index.php/ … ajilg0#new
https://sourceforge.net/projects/lazaru … ndow%2032/
https://sourceforge.net/projects/lazaru … ndow%2064/
I installed this and it compiled the latest mORMot releases flawlessly; I guess because the FPC compiler is more recent and so has the RTTI changes that NewPascal was created to handle. It also compiled the old code I was keeping Lazarus 1.8.4/FPC 3.0.4 around for.
So it looks like I may move ALL my projects to Lazarus 1.9/FPC 3.2.0 Beta and get rid of my existing NewPascal & Lazarus 1.8.4/FPC 3.0.4 combo.
I encourage you to try it. It may be the solution to your problem.
I can confirm that the line
Line 56267: ParamName := @VMP^.Name;
is compiled properly
Cheers,
JD
Last edited by JD (2018-09-18 11:56:26)
Offline
Do you guys use fpcupdeluxe? I have never been able to install anything with that, I always do it manually.
Offline
Do you guys use fpcupdeluxe? I have never been able to install anything with that, I always do it manually.
I use fpcupdeluxe to test trunk builds and sometimes to install NewPascal. I did not use it in my most recent install because FPC trunk is now 3.3.1 and some have said in this thread that it does not compile the latest mORMot.
That is why I chose to install Lazarus 1.9/FPC 3.2.0 Beta instead which is more recent than NewPascal and does not seem to have the problem associated with FPC trunk.
JD
Last edited by JD (2018-09-20 09:04:18)
Offline
Update: With Lazarus/FPC trunk installed by fpcupdeluxe just now (Lazarus 2.1.0 r59094, FPC 3.3.1), the latest mORMot can be compiled successfully, even cross-compile for linux64!
Delphi XE4 Pro on Windows 7 64bit.
Lazarus trunk built with fpcupdelux on Windows with cross-compile for Linux 64bit.
Offline
Not in my case, unfortunately. Using fpcupdeluxe with latest Lazarus/FPC trunk (2.1.0/3.3.1 SVN 59094) on Linux Lite 3.8 (based on Ubuntu), the compilation stops in line 56267 of mormot.pas:
ParamName := @VMP^.Name;
with error message:
mORMot.pas(56267,31) Error: Variable identifier expected
I presume that the solution proposed by Leslie7 in post #5 above, as well as in this topic also:
https://synopse.info/forum/viewtopic.php?id=4694
is recommended, isn't it?
Thanks.
Last edited by damiand (2018-09-21 15:12:00)
Offline
Every new commit to the FPC trunk can broke our code (this is developer trunk). Unfortunately there is no stable FPC version what support all features required by mORMot (or I don't know it).
So, in my project a freeze FPC & Lazarus revision - currently to FPC 39623 & Lazarus 58733. I can confirm this combination work for both Win64 & Lin64 with cross-compiling back and forward.
Online
In fpc 3.3.1 does not work:
ParamName := @VMP^.Name;
neither this:
ParamName := VMP^.Name;
Michal
Last edited by miab3 (2018-09-22 14:57:26)
Offline
miab3,
Until FPC is fixed or there is an official mORMot workaround this solves the problem:
ParamName := VMP^.NamePtr;
Offline
Do you guys use fpcupdeluxe? I have never been able to install anything with that, I always do it manually.
You can check out the source and run it from the IDE to see where it goes wrong for you:
Offline
Offline
I confirm the compilation issue's fixed.
Delphi XE4 Pro on Windows 7 64bit.
Lazarus trunk built with fpcupdelux on Windows with cross-compile for Linux 64bit.
Offline
AB,
I am curious: since NamePtr is public anyway it would seem obvious to use it directly. What is the point for going through the string property and it's getter to get to a pointer at the end which is already available? FPC ShortString is not reference counted so the getter returns a new string with a different pointer. Where will the new string be freed? It seems like a potential memory leak. Or if this is intentional and the new string is freed somewhere properly then when VER3_1 is not defined it will free VMP^.NamePtr^ which is likely to cause problems.
Last edited by Leslie7 (2018-10-01 11:52:22)
Offline
AB,
I think this is worth attention.
Offline
"memory leak" / "free NamePtr^"?
That is the gist of it. Either way the the fix is inconsistent, returns different pointers depending on the compiler directive.
Last edited by Leslie7 (2018-10-11 16:33:20)
Offline
When VER3_1 is defined the getter for the Name property creates a NEW string and the pointer to this string is used from there, not the original pointer. The question is what happens to this new string, will it ever be freed?
Offline
When VER3_1 is defined, the Name property is not a getter but a field:
TVmtMethodParam =
...
Name: ShortString;
For newest versions (3.2 branch), including new trunk, it uses NamePtr safely.
https://github.com/graemeg/freepascal/b … fo.pp#L337
This was the whole point of Michalis patch.
Or perhaps the VER3_1 is not what we expect?
Offline
See the description of my pull request on https://github.com/synopse/mORMot/pull/133 .
FPC revision 39684 (during FPC 3.3.1 development) changed the way you have to access this information. In FPC revision < 39684, you must use "@VMP^.Name". In FPC revision >= 39684 you must use "VMP^.NamePtr".
The FPC revision 39684 happened during the FPC 3.3.1 development.
The patch from https://github.com/synopse/mORMot/pull/133 assumes that:
- You either use FPC 3.1.1.
- Or you use FPC 3.3.1 with revision >= 39684.
The original poster uses FPC 3.3.1, revision 39711. This should be supported. The VER3_1 should not be defined, and the correct approach ("VMP^.NamePtr") should be used.
(Note: I removed my earlier answer, I made a mistake there This answer is correct.)
Offline
Great!
Compiling and running:
begin
{$ifdef VER3_1} Writeln('This is FPC 3.1.x'); {$endif}
{$ifdef VER3_3} Writeln('This is FPC 3.3.x'); {$endif}
end.
with FPC 3.3.1:
$ fpc a.pas
Free Pascal Compiler version 3.3.1-r39838 [2018/09/28] for x86_64
Copyright (c) 1993-2018 by Florian Klaempfl and others
Target OS: Linux for x86-64
Compiling a.pas
Linking a
4 lines compiled, 0.7 sec
$ ./a
This is FPC 3.3.x
So the patch sounds just fine, and I don't understand what Leslie7 complained about.
Offline