#1 2015-05-18 12:43:58

Thomas-Acia
Member
From: Metz (France)
Registered: 2015-04-16
Posts: 79

RTTI under FPC

Hi,

I am writing a mORMot Server under FPC (Lazarus). This one must be executed in console mode only. But I have the RTTI error.
1431952873-rtti.png

I also read that : http://synopse.info/forum/viewtopic.php?id=2279 but I don't know if I can use RTTI for my server.

I need some councils.

Thank you in advance smile


Delphi 2010 - Delphi XE5 (x64 Apps) - CodeTyphon - Typhon IDE v 5.7 - FPC 3.1.1 - mORMot 1.18
Windows 7 - VirtualBox : Linux Debian 8.5 Jessie 32 bits

Offline

#2 2015-05-18 12:49:00

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,182
Website

Re: RTTI under FPC

You should enjoy RTFM and generate a .pas source code file containing the needed RTTI for IIDAPSignaling.

See http://synopse.info/files/html/Synopse% … #TITLE_593

I hope the "interface RTTI" branch would reach soon the main FPC trunk.
In this branch, there is already the needed RTTI for x86/x64 and ARM32...

Offline

#3 2015-05-18 13:10:11

Thomas-Acia
Member
From: Metz (France)
Registered: 2015-04-16
Posts: 79

Re: RTTI under FPC

ab wrote:

You should enjoy RTFM and generate a .pas source code file containing the needed RTTI for IIDAPSignaling.

See http://synopse.info/files/html/Synopse% … #TITLE_593

I hope the "interface RTTI" branch would reach soon the main FPC trunk.
In this branch, there is already the needed RTTI for x86/x64 and ARM32...

I read this part of the doc too.
But I only need to write this :

  SQLite3ConsoleTests;
  {$ifdef COMPUTEFPCINTERFACES}
  ChDir(ExtractFilePath(ParamStr(0)));
  ComputeFPCInterfacesUnit(
    ['..\CrossPlatform\templates','..\..\CrossPlatform\templates'],
     '\..\..\SQlite3\"my_unit".pas');
  {$endif}

and add "mORMotWrappers.pas" in the uses section ?


Delphi 2010 - Delphi XE5 (x64 Apps) - CodeTyphon - Typhon IDE v 5.7 - FPC 3.1.1 - mORMot 1.18
Windows 7 - VirtualBox : Linux Debian 8.5 Jessie 32 bits

Offline

#4 2015-05-18 13:17:48

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,182
Website

Re: RTTI under FPC

Without the SQLite3ConsoleTests, of course: put here some code using your IIDAPSignaling interface with mORMot (or simply register it).
And adapting the mustache wrapper folder (possibly using an absolute path depending on your local hard drive configuration).

You have to run it under Delphi!
But Delphi 6 is enough - or any later revision.

Offline

#5 2015-05-18 13:19:48

Thomas-Acia
Member
From: Metz (France)
Registered: 2015-04-16
Posts: 79

Re: RTTI under FPC

ab wrote:

Without the SQLite3ConsoleTests, of course: put here some code using your IIDAPSignaling interface with mORMot (or simply register it).

Yes of course big_smile

You have to run it under Delphi!
But Delphi 6 is enough - or any later revision.

With Delphi ok ! Thank you for the speed of your response


Delphi 2010 - Delphi XE5 (x64 Apps) - CodeTyphon - Typhon IDE v 5.7 - FPC 3.1.1 - mORMot 1.18
Windows 7 - VirtualBox : Linux Debian 8.5 Jessie 32 bits

Offline

#6 2015-05-18 15:00:08

AOG
Member
Registered: 2014-02-24
Posts: 490

Re: RTTI under FPC

If you like to experiment .... you could try this:

1)
Use fpcup to install the special branch of fpc, that includes an RTTI extension.
fpcup --fpcURL="rtti" --installdir="myspecialfpcdir"
https://github.com/LongDirtyAnimAlf/Reiniero-fpcup

2)
enable fpc RTTI inside of synopse.inc
{.$define HASINTERFACERTTI} ... remove dot

Note: this additional RTTI is (at the moment) only available for i386, X86_64 and ARM.

Offline

#7 2015-05-19 07:07:09

Thomas-Acia
Member
From: Metz (France)
Registered: 2015-04-16
Posts: 79

Re: RTTI under FPC

AOG wrote:

If you like to experiment .... you could try this:

1)
Use fpcup to install the special branch of fpc, that includes an RTTI extension.
fpcup --fpcURL="rtti" --installdir="myspecialfpcdir"
https://github.com/LongDirtyAnimAlf/Reiniero-fpcup

2)
enable fpc RTTI inside of synopse.inc
{.$define HASINTERFACERTTI} ... remove dot

Note: this additional RTTI is (at the moment) only available for i386, X86_64 and ARM.

I already tried fpcup and I prefer CodeTyphon. But this is an other way to use RTTI, it's interesting.


Delphi 2010 - Delphi XE5 (x64 Apps) - CodeTyphon - Typhon IDE v 5.7 - FPC 3.1.1 - mORMot 1.18
Windows 7 - VirtualBox : Linux Debian 8.5 Jessie 32 bits

Offline

#8 2015-05-19 07:08:32

Thomas-Acia
Member
From: Metz (France)
Registered: 2015-04-16
Posts: 79

Re: RTTI under FPC

What does

['..\CrossPlatform\templates','..\..\CrossPlatform\templates']

exactly mean ?


Delphi 2010 - Delphi XE5 (x64 Apps) - CodeTyphon - Typhon IDE v 5.7 - FPC 3.1.1 - mORMot 1.18
Windows 7 - VirtualBox : Linux Debian 8.5 Jessie 32 bits

Offline

#9 2015-05-19 07:54:17

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,182
Website

Re: RTTI under FPC

This should be the folder where the cross-platform templates files are available on your local computer.
It depends where you did unzip the framework source code.

Offline

#10 2015-05-19 07:58:51

Thomas-Acia
Member
From: Metz (France)
Registered: 2015-04-16
Posts: 79

Re: RTTI under FPC

ab wrote:

This should be the folder where the cross-platform templates files are available on your local computer.
It depends where you did unzip the framework source code.

Ok I corrected my links but what are they for ?


Delphi 2010 - Delphi XE5 (x64 Apps) - CodeTyphon - Typhon IDE v 5.7 - FPC 3.1.1 - mORMot 1.18
Windows 7 - VirtualBox : Linux Debian 8.5 Jessie 32 bits

Offline

#11 2015-05-19 08:00:28

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,182
Website

Re: RTTI under FPC

The wrapper generator need to access the FPC-mORMotInterfaces.pas.mustache template.

Offline

#12 2015-05-19 08:01:11

Thomas-Acia
Member
From: Metz (France)
Registered: 2015-04-16
Posts: 79

Re: RTTI under FPC

ab wrote:

The wrapper generator need to access the FPC-mORMotInterfaces.pas.mustache template.

Ok all is now clear. Thank's a lot !


Delphi 2010 - Delphi XE5 (x64 Apps) - CodeTyphon - Typhon IDE v 5.7 - FPC 3.1.1 - mORMot 1.18
Windows 7 - VirtualBox : Linux Debian 8.5 Jessie 32 bits

Offline

#13 2015-05-19 12:01:34

Thomas-Acia
Member
From: Metz (France)
Registered: 2015-04-16
Posts: 79

Re: RTTI under FPC

I have a new error, only with FPC :

1432036815-sans-titre.png


Delphi 2010 - Delphi XE5 (x64 Apps) - CodeTyphon - Typhon IDE v 5.7 - FPC 3.1.1 - mORMot 1.18
Windows 7 - VirtualBox : Linux Debian 8.5 Jessie 32 bits

Offline

#14 2015-05-19 12:44:19

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,182
Website

Re: RTTI under FPC

Put a breakpoint and find out why RegisterInterface() is called twice.

Offline

#15 2015-05-19 13:10:29

Thomas-Acia
Member
From: Metz (France)
Registered: 2015-04-16
Posts: 79

Re: RTTI under FPC

I found the problem.  TestSQL3FPCInterfaces was used in another unit !

Now a last error. Even if I include "My RTTI unit".pas, I have the "No RTTI available for ..."

Last edited by Thomas-Acia (2015-05-19 13:31:09)


Delphi 2010 - Delphi XE5 (x64 Apps) - CodeTyphon - Typhon IDE v 5.7 - FPC 3.1.1 - mORMot 1.18
Windows 7 - VirtualBox : Linux Debian 8.5 Jessie 32 bits

Offline

#16 2015-05-19 13:54:15

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,182
Website

Re: RTTI under FPC

You should include the unit BEFORE all other units using them.

The safest is to put this in the uses clause of the main .dpr of your project.

Offline

#17 2015-05-19 19:48:44

Thomas-Acia
Member
From: Metz (France)
Registered: 2015-04-16
Posts: 79

Re: RTTI under FPC

RTTI is now working well. Next step is to connect my server to my Postgresql database with ZEOS.


Delphi 2010 - Delphi XE5 (x64 Apps) - CodeTyphon - Typhon IDE v 5.7 - FPC 3.1.1 - mORMot 1.18
Windows 7 - VirtualBox : Linux Debian 8.5 Jessie 32 bits

Offline

#18 2015-06-30 14:10:15

ComingNine
Member
Registered: 2010-07-29
Posts: 294

Re: RTTI under FPC

AOG wrote:

If you like to experiment .... you could try this:

1)
Use fpcup to install the special branch of fpc, that includes an RTTI extension.
fpcup --fpcURL="rtti" --installdir="myspecialfpcdir"
https://github.com/LongDirtyAnimAlf/Reiniero-fpcup

2)
enable fpc RTTI inside of synopse.inc
{.$define HASINTERFACERTTI} ... remove dot

Note: this additional RTTI is (at the moment) only available for i386, X86_64 and ARM.

I could not run your fpcup_linux_x86 on my CentOS 5.11 x64. The i686 version of glibc has already installed. Could you help to comment how to work around ? ... big_smile

[test@localhost i386-linux]$ pwd
/home/test/DEV/Reiniero-fpcup-master/bin/i386-linux
[test@localhost i386-linux]$ 
[test@localhost i386-linux]$ cat /etc/redhat-release 
CentOS release 5.11 (Final)
[test@localhost i386-linux]$ 
[test@localhost i386-linux]$ uname -a
Linux localhost.localdomain 2.6.18-398.el5 #1 SMP Tue Sep 16 20:50:52 EDT 2014 x86_64 x86_64 x86_64 GNU/Linux
[test@localhost i386-linux]$ 
[test@localhost i386-linux]$ ./fpcup_linux_x86  --fpcURL="rtti" --installdir="/home/test/fpclazarus_x86/"
bash: ./fpcup_linux_x86: /usr/lib/ld-linux.so.2: bad ELF interpreter: No such file or directory
[test@localhost i386-linux]$ 
[test@localhost i386-linux]$ sudo yum -y install glibc.i686
Loaded plugins: fastestmirror, security
Loading mirror speeds from cached hostfile
 * c5-media: 
Setting up Install Process
Package glibc-2.5-123.i686 already installed and latest version
Nothing to do
[test@localhost i386-linux]$ 

Offline

#19 2015-06-30 14:25:18

ComingNine
Member
Registered: 2010-07-29
Posts: 294

Re: RTTI under FPC

Sorry for the trouble. Problem solved by adding a symbolic link....

[test@localhost i386-linux]$ ldd fpcup_linux_x86 
        linux-gate.so.1 =>  (0xffffe000)
        libpthread.so.0 => /lib/libpthread.so.0 (0x00a10000)
        libdl.so.2 => /lib/libdl.so.2 (0x00a09000)
        libc.so.6 => /lib/libc.so.6 (0x00880000)
        /usr/lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x00861000)
[test@localhost i386-linux]$ 
[test@localhost i386-linux]$ ls /usr/lib/ld-linux.so.2
ls: /usr/lib/ld-linux.so.2: No such file or directory
[test@localhost i386-linux]$ 
[test@localhost i386-linux]$ ls -l /lib/ld-linux.so.2
lrwxrwxrwx 1 root root 9 Nov 20  2014 /lib/ld-linux.so.2 -> ld-2.5.so
[test@localhost i386-linux]$ 
[test@localhost i386-linux]$ sudo ln -s  /lib/ld-2.5.so /usr/lib/ld-linux.so.2  
[test@localhost i386-linux]$ 
[test@localhost i386-linux]$ ls -l /usr/lib/ld-linux.so.2
lrwxrwxrwx 1 root root 14 Jul  1 00:11 /usr/lib/ld-linux.so.2 -> /lib/ld-2.5.so
[test@localhost i386-linux]$ 

Could you help to comment another question ?

AOG wrote:

If you like to experiment .... you could try this:

1)
Use fpcup to install the special branch of fpc, that includes an RTTI extension.
fpcup --fpcURL="rtti" --installdir="myspecialfpcdir"
https://github.com/LongDirtyAnimAlf/Reiniero-fpcup
......

Is this "rtti" a specific revision, or always the latest revision that contains the "rtti" feature ?

Last edited by ComingNine (2015-06-30 14:25:35)

Offline

#20 2015-06-30 14:31:50

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,182
Website

Re: RTTI under FPC

AFAIK this is a dedicated branch.

Offline

#21 2015-06-30 14:51:39

ComingNine
Member
Registered: 2010-07-29
Posts: 294

Re: RTTI under FPC

ab wrote:

AFAIK this is a dedicated branch.

Do you mean that --fpcURL="rtti" will always fetch the latest revision of this dedicated branch ?

Offline

#22 2015-06-30 14:54:37

ComingNine
Member
Registered: 2010-07-29
Posts: 294

Re: RTTI under FPC

AOG wrote:

If you like to experiment .... you could try this:

1)
Use fpcup to install the special branch of fpc, that includes an RTTI extension.
fpcup --fpcURL="rtti" --installdir="myspecialfpcdir"
https://github.com/LongDirtyAnimAlf/Reiniero-fpcup

......

I could not run your fpcup_linux_x86 or fpcup_linux_x64 on my CentOS 5.11 x64.

[test@localhost i386-linux]$ ./fpcup_linux_x86  --fpcURL="rtti" --installdir="/home/test/fpclazarus_x86/" --verbose
......
/home/test/fpclazarus_x86/lazarus/components/lazutils/lazfglhash.pas(83,6) Error: (5000) Identifier not found "FHashTableSize"
/home/test/fpclazarus_x86/lazarus/components/lazutils/lazfglhash.pas(84,17) Error: (5000) Identifier not found "FHashTableSize"
......
[test@localhost i386-linux]$ cat /home/test/fpclazarus_x86/lazarus/components/lazutils/lazfglhash.pas
......
{$if not(defined(ver2) or defined(ver3_0))}
function TLazFPGHashTable.ForEachCall(aMethod: TGIteratorMethod): THTGNode;
var
  i, j: Longword;
  continue: boolean;
begin
  Result:=nil;
  continue:=True;
  if FHashTableSize>0 then
    for i:=0 to FHashTableSize-1 do
      if Assigned(Chain(i)) then
        if chain(i).Count>0 then
          for j:=0 to Chain(i).Count-1 do
            begin
            aMethod(THTGNode(Chain(i)[j]).Data, THTGNode(Chain(i)[j]).Key, continue);
            if not continue then
              begin
              Result:=THTGNode(Chain(i)[j]);
              Exit;
              end;
            end;
end;
......
[test@localhost i386-linux]$ 

It seems to be related to the ver2 or ver3_0. Could you help to comment what is the correct way to work around this ? ... big_smile

Last edited by ComingNine (2015-06-30 14:56:51)

Offline

#23 2015-07-01 09:58:30

AOG
Member
Registered: 2014-02-24
Posts: 490

Re: RTTI under FPC

@ComingNine
It would be better to post your fpcup remarks on the fpc mailing list : http://forum.lazarus.freepascal.org/ind … 211.0.html

However, the above problem is not related to fpcup, but seemingly the fpc/lazarus combi not working together.

(the rtti branch of fpc does not receive much love lately, other than the initial commit)

Offline

#24 2016-11-16 16:20:59

ASAmauri
Member
Registered: 2016-10-02
Posts: 1

Re: RTTI under FPC

This post is verry usefull! I allready have followed it and I have got my Server(based on Project16ServerHttp sample) running compiled by LazarusIDE.
Thanks a lot!

Offline

#25 2016-11-17 07:07:42

AOG
Member
Registered: 2014-02-24
Posts: 490

Re: RTTI under FPC

Good !

Some updated info about FPC/Lazarus and RTTI.
The whole rtti branch of FPC is abandoned. But it is also not needed anymore.

Just use NewPascal: it has all the RTTI (and more) you need for the mORMot. See http://synopse.info/forum/viewforum.php?id=21
Or use fpcupdeluxe to install NewPascal anywhere you want ! See https://github.com/LongDirtyAnimAlf/Rei … /tag/0.99c

Offline

#26 2016-11-17 17:43:52

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,182
Website

Re: RTTI under FPC

FpcUpDeluxe is great!!!!

Offline

Board footer

Powered by FluxBB