#1 2019-01-30 10:17:11

iru
Member
Registered: 2019-01-30
Posts: 2

Linux Lazarus mORMot linking error

Gentlefolk,

Environment: Linux mint 19.1, Laz/FPC 1.8.4/3.0.4. And a lot of libraries......
             Mormot 1.18 (from the readme.txt file).

I have been trying to compile the 'Notes' example from 'Taming the Mormot'

The code compiles but fails when linking. Using 'LazBuild' I find the following error/s:

(3104) Compiling NoteORM.pas
(9015) Linking project1
/home/iru/Downloads/mORMot-master/static/x86_64-linux/sqlite3.o: In function `pthreadMutexTry':
sqlite3.c:(.text+0x9d55): undefined reference to `pthread_mutex_trylock'
  ..
  ..
/home/iru/LazProjects/Morm2/project1.lpr(45,1) Error: (9013) Error while linking
/home/iru/LazProjects/Morm2/project1.lpr(45,1) Fatal: (10026) There were 1 errors compiling module, stopping
Fatal: (1018) Compilation aborted

So whats the problem? More missing modules/libraries???? Missmatch between fpc and Mormot???

Any ideas, direction, fixes appreciated, Ian

Offline

#2 2019-01-30 11:04:52

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

Re: Linux Lazarus mORMot linking error

Perhaps the below will help.
Add this into your lpr file:

uses
  {$IFDEF UNIX}
  cthreads,
  {$ENDIF}
  .....

Offline

#3 2019-01-30 22:36:28

iru
Member
Registered: 2019-01-30
Posts: 2

Re: Linux Lazarus mORMot linking error

Thank you for your response.

Your suggestion is correct I had missed that ' UseCThreads' was false and therefore 'cthreads' was not included.

   {$IFDEF UNIX}{$IFDEF UseCThreads}
     cthreads,
  {$ENDIF}{$ENDIF}

The program now compiles/links successfully but currently crashes around line 58205 in mORMot.pas

  result := aImplementationClass.GetInterfaceEntry(aInterface^.InterfaceGUID^);
  if result=nil then
    raise EInterfaceResolverException.CreateUTF8('%.RegisterGlobal(): % does not implement %', <<<<<< Fails here!
      [self,aImplementationClass,aInterface^.Name]);

I will battle on.....

Slightly horrified to find over 62000 lines of code and comments in mORMot.pas.

Ian

Offline

#4 2019-01-31 07:49:39

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

Re: Linux Lazarus mORMot linking error

You should rather add in the beginning of your .lpr file:

program MyProg;

{$I Synopse.inc} // define HASINLINE USETYPEINFO CPU32 CPU64 OWNNORMTOUPPER

uses
  {$I SynDprUses.inc} // includes FastMM4 (Delphi 7) or cthreads (FPC-Linux)
  SynLZ,
  SynCommons,
  ...

Note that {$I Synopse.inc} in the beginning of every of your unit is a good idea.

About your problem, the message is pretty clear: your class doesn't implement the interface it tries to publish...
I guess you need to correct your code.

Offline

#5 2019-01-31 12:38:45

mpv
Member
From: Ukraine
Registered: 2012-03-24
Posts: 1,571
Website

Re: Linux Lazarus mORMot linking error

Seams the problem in FPC version (3.0.4 as I see in first post).
Mormot use RTTI features available in FPC@3.1+. I use a FPC@3.2 fixes brunch

Offline

Board footer

Powered by FluxBB