#101 2016-06-24 09:52:33

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

Re: Some findings after spent an afternoon fiddling Linux/Lazarus/mORMot

It may make sense, but without any installation instructions, it may not be very useful...

Offline

#102 2016-06-28 08:39:39

d.ioannidis
Member
From: Greece
Registered: 2016-06-03
Posts: 20

Re: Some findings after spent an afternoon fiddling Linux/Lazarus/mORMot

Hi,

  don't know if you're aware. I'm quoting a response from fpc-devel 10/6/2016  ( thread "FPC 3.0.2 release target" )...

>   Plz, think again regarding the proposition at http://bugs.freepascal.org/view.php?id=26774#c91291 . Make it a switch or a directive during fpc build or what ever, just don't let time passes by.

Since I've now merged the critical RTTI related changes from my packages branch I'll take a look at it, play with it a bit and maybe also implement a new target (m68k or Power for example to test big endian support). If there are no apparent problems I'll merge it if no other core dev objects.

@Steve: would you please change your usages of PTypeInfo to PPTypeInfo in typinfo (after you've catched up with trunk again)?

Regards,
Sven

regards,

Last edited by d.ioannidis (2016-06-28 13:22:48)


Dimitrios Chr. Ioannidis

Offline

#103 2016-06-28 10:51:17

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

Re: Some findings after spent an afternoon fiddling Linux/Lazarus/mORMot

@d.ioannidis
Yes, Sven pushed a big breaking change of PPTypeInfo storage instead of PTypeInfo for all RTTI.
This broke the trunk, and needs a specific directive.
See http://synopse.info/forum/viewtopic.php … 783#p20783

But the interface RTTI (available since Delphi 6), is not yet merged to the FPC trunk, even if it is available since a lot of time, and proven/used by mORMot if available, for its SOA feature, on Win32/Win64/Linux32/Linux64/Arm32/Arm64 platforms....
This is to face such inconsistencies that the project of a dedicated FPC fork including some non-merged features would be available as "newpascal".

Offline

#104 2016-06-28 11:22:49

d.ioannidis
Member
From: Greece
Registered: 2016-06-03
Posts: 20

Re: Some findings after spent an afternoon fiddling Linux/Lazarus/mORMot

@ab

  I'm sorry that I understand the difference between using a branch in freepascal svn repository such as interfacertti and a new location under a new "brand" etc ... something to worry about.

  The last month I'm evaluating the use of mormot for my employer, for a project which will start in about 4 - 6 months from now. The only prerequisite is the use of the free pascal compiler. Not "newpascal" or Alfred's git branch. Straight, plain, vanilla free pascal compiler.

  My consern is, what about mormot end up using a feature from "newpascal", and for whatever reason fpc decline to include ?

  It's another thing to use an fpc branch in their repository for development, proof of concept, testbed, etc ( with the interaction and visibility from the free pascal developers ) and another thing to implement a feature in "newpascal" that mormot will depend and me / us end up having a "crippled" version for fpc.

  That's a showstopper for me. I thought that in the end the goal was to incorporated the features, changes to freepascal not to create another pascal variant compiler.

  Anyway, maybe I'm wrong ...

regards


Dimitrios Chr. Ioannidis

Offline

#105 2016-06-28 11:59:27

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

Re: Some findings after spent an afternoon fiddling Linux/Lazarus/mORMot

No need to worry: we want to stay 100% compatible with the main FPC branch.
Only "safe" and "upcoming" features would be included to the "newpascal" FPC compiler.
Perhaps Lazarus may be customized (e.g. with a better IDE), some packages may be pre-built.
But our fork is meant to be compatible with FPC trunk - just merged sooner.

The "interface RTTI" branch will eventually merge with the FPC trunk.
"Eventually" means "for sure" here.
Merge has only be delayed due to internal discussions in the FPC team, mainly due to Sven personal approach.

In the meanwhile, you may either:
- use the patched FPC compiler directly from "newpascal";
- compile the FPC compiler yourself and include the "interface RTTI" patch;
- compile the FPC compiler from the "interface RTTI" branch yourself;
- use the official FPC compiler, but generate the RTTI by hand (e.g. from a Delphi compiler).

You have indeed a way to generate the needed RTTI as source code for a straight, plain, vanilla free FPC compiler, without the "interface RTTI" branch.
Please RTFM at http://synopse.info/files/html/Synopse% … #TITLE_639
This is what I'm currently using.

So IMHO this should not be a showstopper at all.

Offline

#106 2016-06-28 12:14:34

d.ioannidis
Member
From: Greece
Registered: 2016-06-03
Posts: 20

Re: Some findings after spent an afternoon fiddling Linux/Lazarus/mORMot

Ab,

this 

ab wrote:

Only "safe" and "upcoming" features would be included to the "newpascal" FPC compiler.

and this

ab wrote:

But our fork is meant to be compatible with FPC trunk - just merged sooner.


are contradicting views.

  If it is a fork, then it is a fork named "newpascal". If it is a branch for "safe" and "upcoming" features then its a freepascal branch which implies that at some moment in the future the development will continue to free pascal trunk.


ab wrote:

You have indeed a way to generate the needed RTTI as source code for a straight, plain, vanilla free FPC compiler, without the "interface RTTI" branch.
Please RTFM at http://synopse.info/files/html/Synopse% … #TITLE_639


Hey, I already informed alfred for a think or two ( http://forum.lazarus.freepascal.org/ind … #msg212841 ) and guess what, this is indeed how I've done it.


FPC and mormot starting to look a very, very, very promising duo ...

EDIT: I generated the TestSQL3FPCInterfaces unit with Delphi 7, and fixed the double occurrences of the mORMotDDD unit and to add SynLog unit in the uses clause.

regards,

« Last Edit: 13-06-2016, 16:53:07 by Dimitrios Chr. Ioannidis »

So, I RTFM already ....



ab wrote:

So IMHO this should not be a showstopper at all.

Only time will tell, regarding this ....

regards,

Last edited by d.ioannidis (2016-06-28 12:20:14)


Dimitrios Chr. Ioannidis

Offline

#107 2016-06-28 12:38:45

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

Re: Some findings after spent an afternoon fiddling Linux/Lazarus/mORMot

In fact, there is no contradiction.
A fork is not a branch, as in terms of SVN.
We use the distributed SCM approach of git, here.
The official FPC trunk modifications are merged into the NewPascal repository several times a day, via an automated process.
Check https://github.com/dathox/newpascal/commits/master which is in fact merged from https://github.com/dathox/newpascal/tree/freepascal

NewPascal and trunk are not evolving separately. NewPascal FPC compiler is the official FPC compiler with some well defined patches included.
There are plenty of such synchronized forks already, even on github.
This is how Open Source works.

Offline

#108 2016-07-07 06:55:03

edwinsn
Member
Registered: 2010-07-02
Posts: 1,215

Re: Some findings after spent an afternoon fiddling Linux/Lazarus/mORMot

2016-07-07 test:
Compiler:
https://github.com/dathox/newpascalpack … alpack.zip

mORMot distribution:
https://github.com/LongDirtyAnimAlf/mORMot

Target: i386-win32:

Result:
All tests passed! Well done you guys smile

Detailed results:

Using mORMot 1.18.2753 FTS3
Running on Windows 7 64bit SP1 (6.1.7601) with code page 936
TSQLite3LibraryDynamic 3.8.10.2 with internal MM
Generated with: Free Pascal 3.1.1 compiler

Time elapsed for all tests: 65.12s
Tests performed at 2016/7/7 14:51:50

Total assertions failed for all test suits:  0 / 21,319,038
! All tests passed successfully.

Delphi XE4 Pro on Windows 7 64bit.
Lazarus trunk built with fpcupdelux on Windows with cross-compile for Linux 64bit.

Offline

#109 2016-07-07 07:00:44

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

Re: Some findings after spent an afternoon fiddling Linux/Lazarus/mORMot

Good !

Would you mind trying the normal latest official mORMot too ?
My "longdirtyanimalf" version will be removed sooner or later, because all changes are added to the official mORMot !

Last edited by AOG (2016-07-07 07:01:10)

Offline

#110 2016-07-07 07:19:24

edwinsn
Member
Registered: 2010-07-02
Posts: 1,215

Re: Some findings after spent an afternoon fiddling Linux/Lazarus/mORMot

@AOG,

Tried, but I absolutely have no idea why it needs the .o file (see logs below) - my compilation target is default (also tried the win32 target).

TestMormotOfficial.lpr(9,1) Error: Can't open object file: fpc-win32\sqlite3.o
TestMormotOfficial.lpr(9,1) Error: Can't open object file: fpc-win32\libkernel32.a
TestMormotOfficial.lpr(9,1) Error: Can't open object file: fpc-win32\libgcc.a

I tried both the TestSQL3.lpi shipped in the official mORMot repository, and also the project file created when started this forum post, like the following:

program TestMormotOfficial;
{$I Synopse.inc}
{$APPTYPE CONSOLE}
uses
  {$I SynDprUses.inc}
  mORMotSelfTests;
begin
  SQLite3ConsoleTests;
end.          

Delphi XE4 Pro on Windows 7 64bit.
Lazarus trunk built with fpcupdelux on Windows with cross-compile for Linux 64bit.

Offline

#111 2016-07-07 07:23:35

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

Re: Some findings after spent an afternoon fiddling Linux/Lazarus/mORMot

As stated by the documentation, those .o files are needed for SQlite3 static linking.
See http://synopse.info/files/html/Synopse% … #TITLE_629
and http://synopse.info/files/html/Synopse% … l#TITL_113 :

for FPC only: static SQLite3 .o files for Windows or Linux
http://synopse.info/files/sqlite3fpc.7z
two folders into D:\Dev\Lib\

Offline

#112 2016-07-07 07:37:29

edwinsn
Member
Registered: 2010-07-02
Posts: 1,215

Re: Some findings after spent an afternoon fiddling Linux/Lazarus/mORMot

Oops! I suddenly deleted those 3 sub-folders included by the slite3fpc.7z - I thought it was produced during the FPC compilation, my bad...

And the good news, all tests went successful!

Using mORMot 1.18.2771 FTS3
Running on Windows 7 64bit SP1 (6.1.7601) with code page 936
TSQLite3LibraryStatic 3.13.0 with internal MM
Generated with: Free Pascal 3.1.1 compiler

Time elapsed for all tests: 67.46s
Tests performed at 2016/7/7 15:35:00

Total assertions failed for all test suits:  0 / 21,401,191
! All tests passed successfully.

Delphi XE4 Pro on Windows 7 64bit.
Lazarus trunk built with fpcupdelux on Windows with cross-compile for Linux 64bit.

Offline

#113 2016-07-07 07:39:52

edwinsn
Member
Registered: 2010-07-02
Posts: 1,215

Re: Some findings after spent an afternoon fiddling Linux/Lazarus/mORMot

Now I want to try AOG's latset Lazarus distribution for cross-compiling for Linux - the Lazarus distribution downloaded from newpascal.org does NOT support cross-compiling for Linux...


Delphi XE4 Pro on Windows 7 64bit.
Lazarus trunk built with fpcupdelux on Windows with cross-compile for Linux 64bit.

Offline

#114 2016-09-11 15:43:19

vonH
Member
Registered: 2015-03-06
Posts: 17

Re: Some findings after spent an afternoon fiddling Linux/Lazarus/mORMot

Few questions on the above topic.

What is the connection between https://github.com/LongDirtyAnimAlf/mORMot, https://github.com/dathox/newpascal and the FPC interfacertti branch?

Is NewPascal a bundle which combines the 3 of them?

I want to run mORMot on Linux and want to know how NewPascal can be compiled for Linux 64bit, or if the cross compilation from Windows to Linux works well enough.

I also want to develop something along these lines - https://sourceforge.net/projects/vclua/ and want to know if it is the kind of thing the interfaceRTTI branch of FPC makes easier.

So in a nutshell will being able to compile and install newpascal on Linux get both interfaceRTTI and mORMot working on Linux?

Offline

#115 2016-09-12 07:42:47

edwinsn
Member
Registered: 2010-07-02
Posts: 1,215

Re: Some findings after spent an afternoon fiddling Linux/Lazarus/mORMot

vonH wrote:

Few questions on the above topic.

Very good questions, yes, this confuses people.

I'm not able to answer all your questions, but here is my experience FYI:

I'm currently using https://github.com/LongDirtyAnimAlf/mORMot on **Windows**, and it can cross-comiple for Linux smile I'm not sure about the latest versions, the last version I tried was one or two months ago. @AOG has done a great job here!

Re. NewPascal, as far as I know, currently it only offer download for Windows, and it does NOT cross-compile.

That being said, I also we can have one single download with these features:
- with the interface-patch integrated;
- runs on Windows but can cross-compile for Linux.

Actually, just FYI, I do NOT really want mORMot to be integrated into the compiler download, because mORMot updates so frequently and newPascal.org doesn't show it's interest/intention to keep up with the repository....

Last edited by edwinsn (2016-09-12 07:43:46)


Delphi XE4 Pro on Windows 7 64bit.
Lazarus trunk built with fpcupdelux on Windows with cross-compile for Linux 64bit.

Offline

#116 2016-09-12 08:30:25

hnb
Member
Registered: 2015-06-15
Posts: 291

Re: Some findings after spent an afternoon fiddling Linux/Lazarus/mORMot

NewPascal is developed to put all together. AOG has done new pre-release under NewPascal project, to omit confusion. But we need to finish few details:

https://github.com/dathox/newpascalpack … ss-v1.0.22

NewPascal is Windows only (for now but it might change in future) with cross compilation for many platforms (on the way - see newpascalcross-v1.0.22).

I need to finish series of patches for FPC compiler to keep NewPascal as close as possible with "official" FPC trunk and for documentation purposes. Cooperation with FPC core team is hard, and they are only happy with simple minor patches like:

http://bugs.freepascal.org/view.php?id=30494

FPC core team is not happy with major patches:

http://bugs.freepascal.org/view.php?id=30534

Whatever FPC core team decide (maybe they wish to not including few of patches), we need to put all reports from bugtracker together for documentation purposes. Project like NewPascal needs to have clear and transparent way to document every of change.

Approach of FPC core team is depressing for me...

I am working on new tool for auto-downloading latest mORMot for NewPascal (and for downloading latest NewPascal). When tool will be ready, then I will separate mORMot from NewPascal release.


best regards,
Maciej Izak

Offline

#117 2016-09-12 08:37:59

edwinsn
Member
Registered: 2010-07-02
Posts: 1,215

Re: Some findings after spent an afternoon fiddling Linux/Lazarus/mORMot

@Maciej,

Thanks for the clarification, the info you just provided is helpful to me (and to others I believe!).
It's really good to see the effort from you guys are consolidated into one.

Great work!


Delphi XE4 Pro on Windows 7 64bit.
Lazarus trunk built with fpcupdelux on Windows with cross-compile for Linux 64bit.

Offline

#118 2016-09-13 14:44:19

vonH
Member
Registered: 2015-03-06
Posts: 17

Re: Some findings after spent an afternoon fiddling Linux/Lazarus/mORMot

Thanks to edwinsh and hnb on their replies at http://synopse.info/forum/viewtopic.php … 689#p21689 and http://synopse.info/forum/viewtopic.php … 690#p21690.

I remember being able to get some parts of mORMot working on Linux using some precreated object files for sqlite, http://synopse.info/files/sqlite3fpc.7z. That was with FPC 2.7.1 so I assume that I should able to do that now with the current release version 3.0.2_rc or 3.0 fixes branch.

So I just want to confirm my conclusions so far as from ab's response - http://synopse.info/forum/viewtopic.php … 917#p20917

ab wrote:

No need to worry: we want to stay 100% compatible with the main FPC branch.
In the meanwhile, you may either:
- use the patched FPC compiler directly from "newpascal";
- compile the FPC compiler yourself and include the "interface RTTI" patch;
- compile the FPC compiler from the "interface RTTI" branch yourself;
- use the official FPC compiler, but generate the RTTI by hand (e.g. from a Delphi compiler).

You have indeed a way to generate the needed RTTI as source code for a straight, plain, vanilla free FPC compiler, without the "interface RTTI" branch.
Please RTFM at http://synopse.info/files/html/Synopse% … #TITLE_639
This is what I'm currently using.


To get the whole of Synopose mORMot framework working on Linux you must either:

1. Use a compiler with interfaceRTTI capability built in
      or
2. Use the standard FPC trunk compiler but additional files to your project for additional RTTI support.

For option 1 - Use an FPC compiler with interfaceRTTI capability built in - either:

  a. Use the interfaceRTTI branch of the compiler from SVN

  b. Use the FPC trunk but add the interfaceRTTI source code patches manually (I take it that if you need new trunk features that haven't been added to interfaceRTTI branch this may be the way to go)

For option 2 - To use the FPC trunk version - either:

   a. generate the RTTI by hand (e.g. from a Delphi compiler)

   b. generate the RTTI as source code using the method documented by ab at http://synopse.info/files/html/Synopse% … #TITLE_639



https://github.com/LongDirtyAnimAlf/mORMot is made for the current FPC 3.0 fixes branch but not all mORMot features work. Can RTTI work with https://github.com/LongDirtyAnimAlf/mORMot via the Option 2 approach? I prefer to use trunk, but FPC 3.0.2 may be a safer bet as some trunk tends to break some existing packages.

Last edited by vonH (2016-09-13 14:47:43)

Offline

#119 2016-09-13 18:05:29

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

Re: Some findings after spent an afternoon fiddling Linux/Lazarus/mORMot

The interfaceRTTI branch of the compiler from SVN does not work (does not compile). So don 't use it.
All "FPC features" of the mORMot from https://github.com/LongDirtyAnimAlf/mORMot are already included in the oficial mORMot. So don 't use it.

Unfortunately, there is no official FPC with interface RTTI.

Best Windows sources for FPC with RTTI:
http://newpascal.org/
https://github.com/dathox/newpascalpack … ss-v1.0.22 (also for easy cross-compiling towards Linux and Android)

Best Linux sources for FPC with RTTI:
Use fpc(laz)up and build the right FPC/Laz yourself.
FPC fixes: fpclazup --fpcURL="fixes" --lazURL="fixes" --fpcPATCH="fpc300rtti.patch" --verbose
FPC trunk: fpclazup --fpcURL="trunk" --lazURL="trunk" --fpcPATCH="fpctrunkrtti.patch" --verbose
Fpclazup: https://github.com/LongDirtyAnimAlf/Reiniero-fpcup

Last edited by AOG (2016-09-13 18:05:58)

Offline

#120 2016-09-13 18:43:40

warleyalex
Member
From: Sete Lagoas-MG, Brasil
Registered: 2013-01-20
Posts: 250

Re: Some findings after spent an afternoon fiddling Linux/Lazarus/mORMot

My tests with mORMot 1.18.2934 FTS3 and

FPC3.1.1 + i386-linux         smile smile yikes

FPC3.1.1+ K3+i386-linux32  smile smile smile smile yikes

FPC3.1.1 + D7-win32          smile smile smile smile smile

FPC3.1.1 + i386-win32        smile smile smile smile hmm

Last edited by warleyalex (2016-09-13 18:45:50)

Offline

#121 2016-09-13 19:17:09

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

Re: Some findings after spent an afternoon fiddling Linux/Lazarus/mORMot

Thanks !
FPC 3.1.1 from where ?
Linux: also try dynamic linking (more or less the normal practice for Linux).

Offline

#122 2016-09-13 19:56:46

warleyalex
Member
From: Sete Lagoas-MG, Brasil
Registered: 2013-01-20
Posts: 250

Re: Some findings after spent an afternoon fiddling Linux/Lazarus/mORMot

AOG wrote:

FPC 3.1.1 from where?

This is from the NewPascal (a month ago) pack with Lazarus. It look likes there's a new pre-release which I didn't test;

AOG wrote:

Linux: also try dynamic linking (more or less the normal practice for Linux).

In order to use cross compile from Win32 to Linux I had to unpack the CrossLinuxi386.rar archive in c:\NewPascal

then in project Options
(x) Build Modes (default)
-->Compiler Options
--> Paths --> Libraries (-Fi): C:\NewPascal\cross\lib\i386-linux\; C:\NewPascal\cross\bin\i386-linux\
--> config and Target --> Target OS: Linux
                                    Target CPU: i386
                                    Target Processor: default ;
--> Compilation and linking: ( 1 ) quick, debugger friendly -O1

How do you perform cross compile from win32 to linux succeed using dynamic linking?

Last edited by warleyalex (2016-09-13 19:59:16)

Offline

#123 2016-09-13 20:06:56

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

Re: Some findings after spent an afternoon fiddling Linux/Lazarus/mORMot

This:
Paths --> Libraries (-Fi): C:\NewPascal\cross\lib\i386-linux\; C:\NewPascal\cross\bin\i386-linux\
should not be necessary (I hope).

Dynamic linking:
synopse.inc:

{$ifdef LINUX}
    {$ifdef CPUX86}
      {.$define FPCSQLITE3STATIC} // disable with dot !! <----------------------------
    {$endif} 
  {$endif}

Offline

#124 2016-09-13 21:17:32

warleyalex
Member
From: Sete Lagoas-MG, Brasil
Registered: 2013-01-20
Posts: 250

Re: Some findings after spent an afternoon fiddling Linux/Lazarus/mORMot

Hum, dynamic linking. I just applied this trick, and sprint faster than Usain Bolt, mormot or squirrel... to see the tests on the very old computer with Ubuntu 14.04.1 LTS and almost everything is green. This is awesome!

FPC3.1.1+ CrossCompile+i386-linux32  smile smile smile smile smile


Nowadays, it's very difficult to find Kylix on the internet, but I it's especially powerful with mORMot.
Most developers would not notice or be concerned, after 16 years, the little mORMot still like this compiler. You can create small executables, the resulting executable just seemed to perform so much better if you compare with FPC.

Last edited by warleyalex (2016-09-13 21:41:30)

Offline

#125 2016-09-14 02:59:35

cybexr
Member
Registered: 2016-09-14
Posts: 78

Re: Some findings after spent an afternoon fiddling Linux/Lazarus/mORMot

Tried to crosscompile linux from win32 , but failed with following repo:
NewPascal https://github.com/dathox/newpascalpack … ss-v1.0.22
Mormot 1.18.2953 https://github.com/synopse/mORMot

Lazarus give me such messages:
...
SynSelfTests.pas(1279,3) Hint: (5023) Unit "TestSQL3FPCInterfaces" not used in SynSelfTests
mORMotSelfTests.pas(165,3) Warning: (6018) unreachable code
C:\NewPascal\fpc\units\i386-linux\rtl\si_c21.o: In function `SI_C21_$$__FPC_LIBC21_START':
si_c21.pp:(.text.n_si_c21_$$__fpc_libc21_start+0x27): undefined reference to `__libc_csu_fini'
si_c21.pp:(.text.n_si_c21_$$__fpc_libc21_start+0x2c): undefined reference to `__libc_csu_init'
TestSQL3.dpr(195,1) Error: (9013) Error while linking

FPC command-lines:
C:\NewPascal\fpc\bin\i386-win32\fpc.exe -B -Tlinux -Pi386 -MObjFPC -Scaghi -Cirot -O1 -gw2 -godwarfsets -gl -gh -Xg -l -vewnhibq -Fid:\DEV\lib -Fid:\DEV\lib\SQLite3\fpc\debug\i386-linux -FlC:\NewPascal\cross\bin\i386-linux -FlC:\NewPascal\cross\lib\i386-linux -Fud:\DEV\lib -Fud:\DEV\lib\SQLite3\ -FUd:\DEV\lib\SQLite3\fpc\debug\i386-linux\ -FEd:\DEV\lib\SQLite3\fpc\debug\i386-linux\ TestSQL3.dpr

Offline

#126 2016-09-14 04:58:57

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

Re: Some findings after spent an afternoon fiddling Linux/Lazarus/mORMot

Look here: http://synopse.info/forum/viewtopic.php … 363#p20363

You need

{$ifdef Linux}
  {$ifdef FPC_CROSSCOMPILING}
    {$ifdef CPUARM}
      //if GUI, then uncomment
      //{$linklib GLESv2}
    {$endif}
    {$linklib libc_nonshared.a}
  {$endif}
{$endif}

Put the above at the start of your lpr/dpr !

Offline

#127 2016-09-14 05:27:00

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

Re: Some findings after spent an afternoon fiddling Linux/Lazarus/mORMot

@warleyalex

My Linux mORMots run on Arch Linux 64 bit, in the cloud thanks to Amazon Web Services.
Never had a single problem. I have never tried Kylix.

The final problems you encounter with Linux are known.
The record error is a simple (FPC) string problem that is not relevant nor solvable by the mORMot.
Some time ago, I have solved the DDD error (time consuming), but it got lost.
Will try to find it again.

Offline

#128 2016-09-14 06:42:30

cybexr
Member
Registered: 2016-09-14
Posts: 78

Re: Some findings after spent an afternoon fiddling Linux/Lazarus/mORMot

AOG wrote:

Look here: http://synopse.info/forum/viewtopic.php … 363#p20363

You need

{$ifdef Linux}
  {$ifdef FPC_CROSSCOMPILING}
    {$ifdef CPUARM}
      //if GUI, then uncomment
      //{$linklib GLESv2}
    {$endif}
    {$linklib libc_nonshared.a}
  {$endif}
{$endif}

Put the above at the start of your lpr/dpr !

fixed thank you

Offline

#129 2016-09-14 08:10:10

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

Re: Some findings after spent an afternoon fiddling Linux/Lazarus/mORMot

@warleyalex

Just checked : mORMot contains all necessary patches to run for 100% on Linux i386 !
My system result:
https://drive.google.com/open?id=0B96fg … UU0SlhPOWc

So, unfortunately, I cannot reproduce.

Offline

#130 2016-09-14 14:47:53

warleyalex
Member
From: Sete Lagoas-MG, Brasil
Registered: 2013-01-20
Posts: 250

Re: Some findings after spent an afternoon fiddling Linux/Lazarus/mORMot

Getting started with mORMot and FPC 3.1.1./Lazarus - target: i386-Linux

Step 1: Get the mORMot
a) If you don't know, there's a daily snapshot of the repository directly, just download this file:

b) Just unpack mORMotNightlyBuild.zip into C:\mORMot

Step 2: Unpack SQLite 3 static .obj files for i386-win32/win64
We'll also need the SQLite 3 static .obj files. This will allow our mORMot based application to embed the SQLite engine in our application.
a) If you plan to develop for 32-bit target environment just grab this file and extract it to your mORMot\sqlite3\ directory
b) If you plan to develop for 64-bit target environment just grab this file and place sqlite3-64.dll in your project’s build directory or in your Windows directory.

Step 3: Configure the mORMot environment

Add the following to your Delphi Library Path:
    C:\mORMot;
    C:\mORMot\SQLite3;
    C:\mORMot\SQLite3;
    C:\mORMot\CrossPlatform;
    C:\mORMot\SynDBDataset;
    C:\mORMot\SQLite3\DDD;
    C:\mORMot\SQLite3\DDD\dom;
    C:\mORMot\SQLite3\DDD\infra;

Step 4: Test the environment: target: i386-win32

Open C:\mORMot\SQLite3\TestSQL3.dpr with Delphi and run it. Make sure all the tests pass.

mORMot with FPC/Lazarus
The interface RTTI (available since Delphi 6), is not yet merged to the official FPC trunk, for its SOA feature, we need this to patch FPC RTL, but FPC core team are f* guys and does like to merge new features. To face such inconsistencies, some crazy-robo-enthusiastic guys (AB + longdirtyanimalf + MaciejIzak) just developed and merged some missing features and put all together in a project called NewPascal. This NewPascal contain a complete trunk FPC and Lazarus with dirty RTTI suitable for cross-compiling.

All right. Here you go.
Step 5: Install NewPascal
a) How to install NewPascal? Just go to this repository.


and grab this big package.

b) Unpack NPLazBaseWin32.rar in c:\NewPascal 
please note: it HAS to be installed in c:\NewPascal, otherwise things will not work !!

After unpack, you should have:

    c:\NewPascal\config_lazarus
    c:\NewPascal\fpc
    c:\NewPascal\fpcbootstrap
    c:\NewPascal\fpclazup
    c:\NewPascal\lazarus

Note: There's a link to start this Lazarus/NewPascal distro. (please note: you have to use this link to start, otherwise things will not work !!)

c) If you want to cross-compile, please unpack the desired archive in c:\NewPascal
for instance, if you want cross-compiling i386-linux from win32, just grab this cross-compiling-linux package.

then unpack into c:\NewPascal

Step 5: Sqlite3-FPC-only
As stated by the documentation, for FPC-only, we need static SQLite3 object .o files are needed for SQlite3 static linking for windows or Linux. Just grab this file.

and unpack two folders into C:\mORMot\

Step 6: Test the environment: target: i386-Linux

Open C:\mORMot\SQLite3\TestSQL3.dpr with Lazarus.
Note: put these conditionals at the start of the DPR/LPR

{$ifdef Linux}
  {$ifdef FPC_CROSSCOMPILING}
    {$ifdef CPUARM}
      //if GUI, then uncomment
      //{$linklib GLESv2}
    {$endif}
    {$linklib libc_nonshared.a}
  {$endif}
{$endif}


Dynamic Linking: target: i386-Linux
In my tests, we have to use the dynamic linking approach, so basically we have to comment a conditional in the synopse.inc

{$ifdef LINUX}
    {$ifdef CPUX86}
      {.$define FPCSQLITE3STATIC} // disable with dot !! <----------------------------
    {$endif}
  {$endif}

Project Options config
We're almost there. In the project options, set

(x) Build Modes (Linux)
-->Compiler Options
--> Paths --> Libraries (-Fi): C:\NewPascal\cross\lib\i386-linux\; C:\NewPascal\cross\bin\i386-linux\
--> config and Target --> Target OS: Linux
                                    Target CPU: i386
                                    Target Processor: default ;
--> Compilation and linking: ( 1 ) quick, debugger friendly -O1

Note:
--> Compilation and Linking
Optimization Levels:
( x ) 1 quick, debugger friendly -O1

/* It's wierd,  have to uncheck this feature to remove some errors in DDD test. */

Unit Style:
(   ) Smart Linkable -CX  ---> uncheck this feature
Linking:
(   ) Linking Smart -XX   ---> uncheck this feature

My system result with my very very old computer with Ubuntu 14.04.1 LTS was basically everything green.

FPC3.1.1+ CrossCompile+i386-linux32  smile smile smile smile smile

Offline

#131 2016-09-14 16:24:28

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

Re: Some findings after spent an afternoon fiddling Linux/Lazarus/mORMot

IMHO you should better get the fpc static .o files for Windows or Linux in first steps, instead of .obj (which are not used by FPC), not after the NewPascal installation.

Perhaps I may update the documentation from http://synopse.info/files/html/Synopse% … l#TITL_113 for FPC to use newpascal...

Offline

#132 2016-09-14 18:49:26

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

Re: Some findings after spent an afternoon fiddling Linux/Lazarus/mORMot

Found the error for static on Linux !
No solution however.

Description:

In constructor TSQLite3LibraryStatic.Create all functions are assigned correctly.
I can see their correct (pointer) values.
I have removed anything else from this constructor. So only the function assignments are there.
If the debugger jumps over the sqlite3 := TSQLite3LibraryStatic.Create; all function pointers are set to the value of initialize (@sqlite3_initialize) !!
????????

Offline

#133 2016-09-15 11:11:41

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

Re: Some findings after spent an afternoon fiddling Linux/Lazarus/mORMot

Did you try in Create without the initial @ , or by using pointer(initialize)?
FPC does not work in same way as Delphi for references to functions, AFAIR...
sad

Offline

#134 2016-09-16 12:39:40

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

Re: Some findings after spent an afternoon fiddling Linux/Lazarus/mORMot

Just checked with FPC fixes (3.0.1 = future 3.0.2) : same error.

Pointers are initialized correct: the version string is received (3.14.1).

Again, after sqlite3 := TSQLite3LibraryStatic.Create, all function pointers are set to the value of initialize (@sqlite3_initialize) !!

Screenshot: https://drive.google.com/open?id=0B96fg … UdXMXk5MEU

As you can see, the version is received correct. After that .... ??????

Last edited by AOG (2016-09-19 06:13:55)

Offline

#135 2016-09-17 12:03:21

vonH
Member
Registered: 2015-03-06
Posts: 17

Re: Some findings after spent an afternoon fiddling Linux/Lazarus/mORMot

AOG wrote:

Just checked with FPC fixes (3.0.1 = future 3.0.2) : same error.

Pointers are initialized correct: the version string is received (3.14.1).

Again, after sqlite3 := TSQLite3LibraryStatic.Create, all function pointers are set to the value of initialize (@sqlite3_initialize) !!

??????

Perhaps it is a code generation error?

Offline

#136 2017-12-01 08:00:05

edwinsn
Member
Registered: 2010-07-02
Posts: 1,215

Re: Some findings after spent an afternoon fiddling Linux/Lazarus/mORMot

update: xubuntu is so much faster and smoother than Linux Mint, which is already faster and smoother than the official Ubuntu desktop.


Delphi XE4 Pro on Windows 7 64bit.
Lazarus trunk built with fpcupdelux on Windows with cross-compile for Linux 64bit.

Offline

Board footer

Powered by FluxBB