#1 2016-05-12 14:52:17

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

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

The latest Linux Mint Xfce 17.3 runs much faster than Ubuntu (forgot the version number, I tried it few months ago) inside a Virtualbox VM, and the UI is quite slick!

I failed to install Lazarus with fpcup due to network problems (mostly likely it's because of the GFW (local gov. censoring).

So I installed the latest Lazarus 1.6 deb files from sourceforget.net. The installation process was quite smooth.

I checked out the latest mORMot sources from github.com, setup the paths, etc. And I got this error:

SynCrypto.pas(2552,40) Error: Generating PIC, but reference is not PIC-safe

After some research, I realized that mORMot does NOT support FPC/Lazarus 64bit yet.

And then I did some more researches, I figured I'd **for now** give up the idea of writing mORMot-based web app for Linux - mORMot has quite some ASM code (for good reasons, I know), and I wonder when, if even, it'll will compile under Linux/Lazarus 64bit. According to some articles I read, it's not always  as easy as running some apt-get commands to setup linux64bit to run 32bit apps.

Hope these info make sense to be posted here, for future explorers.

Last edited by edwinsn (2016-05-20 05:17:57)


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

Offline

#2 2016-05-12 15:03:52

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

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

Well .... you could press Ab a bit ... ;-)

I did send him a huge patch / mod to get mORMot running on Linux 64bit.
Not yet 100% correct. But enough for a bit of mORMot on Aarch64 ! And that is Linux 64bit !
I am waiting for his code-review before I go on with the last 64 bits and pieces.

Offline

#3 2016-05-12 16:47:20

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

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

That sounds good, AOG, thanks for the info!

Further finding, according to (https://help.ubuntu.com/community/MultiArch), it seems that plain 32bit executables without external libraries just works under 64bit Ubuntu and debian!


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

Offline

#4 2016-05-12 18:18:13

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

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

64 bit is not supported yet under Linux.
Still a work in process...

@edwinsn
See http://synopse.info/files/html/Synopse% … l#TITL_142
about how to run 32 bit mORMot executables under 64 bit Linux.

Offline

#5 2016-05-13 11:32:15

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

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

Thanks for the info ab.

May 13, 2016 updates:
Installed Lazarus 32bit 1.6 under Linux Mint Xfce 32bit and successfully compiled and executed:
- The self tests.
- 01 - In Memory ORM
- 04 - HTTP Client-Server

Wow! That feels so good smile Thanks Arnaud and other contributors like AOG!

Other notes:
Running self tests emitted quite a lot of errors (same as when being compiled with XE4).

Now I should look around for a way to update my FPC to the latest trunk since fpcup doesn't work on my netowork, so anybody has any hints would be welcomed!


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

Offline

#6 2016-05-13 11:47:05

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

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

@edwinsn

Inspired by your post, I am now maintaining a fork of the mORMot, that has the necessary changes for running with FPC on win/linux 64 bit, arm and aarch64.

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

Again, not 100% yet, but your reports would be welcome.

The RTTI branch of FPC is worked on.
I have offered to take over.

If you want, I can add a complete trunk FPC/Lazarus RTTI distro into this fork. If I know your dev-system.

Offline

#7 2016-05-13 13:27:59

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

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

@AGO, Wow! Another good news again!

So for Lazarus I should use this fork instead, right?

Regarding the "FPC/Lazarus RTTI distro", what is it?

My Lazarus (downloaded from getlazarus.org) for Windows 7 64bit:

Lazarus version: 1.7
Lazarus svn revision: Unknown
Lazarus build date: 2016/03/06
Lazarus was compiled for i386-win32
Lazarus was compiled with fpc 3.1.1

My Lazarus (downloaded from sf.net) inside my Linux Mint Xfce 32bit inside a Virtualbox:

version: 1.6 
Lazarus svn revision: Unversioned directory
Lazarus build date: 2016/02/15
Lazarus was compiled for i386-linux
Lazarus was compiled with fpc 3.0.0

Last edited by edwinsn (2016-05-13 13:33:09)


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

Offline

#8 2016-05-13 13:51:21

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

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

FPC/Lazarus RTTI distro is just the normal FPC with extra interface RTTI.
It enables the use of interfaces, without the need of generating extra info first with Delphi.
To get the most out of mORMot.

http://svn.freepascal.org/cgi-bin/viewv … rfacertti/

https://github.com/LongDirtyAnimAlf/Rei … rtti.patch

It would be also interesting as to why fpcup does not work for you.
A working fpcup would ease FPC things considerable.

Offline

#9 2016-05-13 14:09:49

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

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

AOG,

Re. fpcup is not working, because almost all internet connections from inside China going outbound are NOT stable, because of this: (https://en.wikipedia.org/wiki/Great_Firewall), the svn checkout will not get to the end. It's a real pain in the ass, if you ask me...

On the other hand, if I use TortoiseSVN, I can check out this FPC source (https://github.com/graemeg/freepascal). But I haven't had the time to check how to use it with my Lazarus 1.6 installation, if you have any hints, I'll be appreciated...

Last edited by edwinsn (2016-05-14 09:37:00)


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

Offline

#10 2016-05-13 14:25:09

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

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

Well, you need FPC and Lazarus trunk sources to build FPC and Lazarus trunk.
If you can get the latest sources, fpc(laz)up can do the (dirty) patch and build work for you !
But you need the sources.

Can you download from Google Drive ?

Last edited by AOG (2016-05-13 14:25:27)

Offline

#11 2016-05-13 17:39:07

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

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

AOG, if it's ok, please publish the FPC/Lazarus RTTI distro.

I will figure out how to build the latest fpc/Lazarus.


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

Offline

#12 2016-05-14 06:17:21

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

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

All right. Here you go.

https://drive.google.com/folderview?id= … sp=sharing

Three files: two archives, one startup script.

The archives contain a complete trunk FPC/Lazarus with RTTI for Linux i386.
No package, just raw files.

They (to be more exact: one of them) MUST be installed (extracted) in /usr/lib/newfpc, due to the fact that they are self-contained.
Lazarus MUST be started with the supplied script, due to the fact that they are self-contained.
(all paths have to be set correct)

Small does not contain the svn archive, big does. So, just start with small.

For mORMot, you only need FPC. But Lazarus is included for convenience.

Good luck ! I hope it will work for you.

Edit: added x64 versions !

Last edited by AOG (2016-05-14 07:25:36)

Offline

#13 2016-05-14 08:52:41

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

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

@AOG, Thanks for sharing!

I'm still not clear about that, What problems I might have if I use the the official Lazarus 1.6?  Since currently it already compiles the latest mORMot (Arnaud's version, not tested your version yet).

My concern is that, is the version you kindly provided shares the same configuration data with the official Lazarus release? You know, since I'm new to Lazarus, but when upgrading Delphi it's really a pain to configure the paths, the 3rd party libs and tools, etc, I'm not sure if it's also that case with Lazarus.


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

Offline

#14 2016-05-14 09:12:37

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

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

Don't worry about sharing (and disturbing) configurations.
The libraries contain FPC/Lazarus versions that are self-contained.
No paths are changed. No config changed. Just copy files.
That is also why you need to use the startup-script.

Besides, Lazarus is of no importance for mORMot.
mORMot only needs FPC.
And FPC trunk has some very important bug-fixes that are important for mORMot.

Offline

#15 2016-05-14 12:09:47

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

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

Thanks AOG! So I installed it and successfully compiled the mORMot self test suites.

Here is the commands I used, maybe of help to other **linux newbies** like me.

# Extract it to the correct place
sudo tar xf newfpcbig.tar.gz -C /

#Run the installed Lazarus 1.7
sudo ./Lazarus_newfpc

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

Offline

#16 2016-05-14 12:14:48

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

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

And the failed tests:

1.2. Low level types: 
  - RTTI: 410 assertions passed  1.16ms
  - Url encoding: 200 assertions passed  978us
! Low level types - Encode decode JSON
! Exception EAccessViolation raised with messsage:
!  Access violation
  - Variants: 48 assertions passed  234us
  - Mustache renderer: 146 assertions passed  6.15ms
  - TDocVariant: no assertion  326us
  - BSON: no assertion  133us
  - TSynTableStatement: 206 assertions passed  350us
  - TSynMonitorUsage: 1,202 assertions passed  500us
  Total failed: 5 / 284,795  - Low level types FAILED  4.63s

 2.4. Memory based: 
  - Database direct access: 20,246 assertions passed  259.74ms
  - Virtual table direct access: 12 assertions passed  9.83ms
  - TSQLTableJSON: 144,070 assertions passed  311.32ms
  - TSQLRestClientDB: 402,407 assertions passed  2.71s
  - TRecordVersion: 20,060 assertions passed  270.42ms
  - RTree: 140,000 assertions passed  1.18s
!  - Shard write: 100 / 10,602 FAILED  1.22s
!  - Shard read: 20,000 / 140,001 FAILED  1.35s
!  - Shard read after purge: 2 / 114,003 FAILED  1.22s
  Total failed: 20,102 / 991,401  - Memory based FAILED  8.56s

I'm using your fork of mORMot, and it's Much less errors than the version compiled by the official Lazarus public release.

Well done AOG!


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

Offline

#17 2016-05-14 12:43:10

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

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

@AOG, wow! Using your fork, the "30 - MVC Server" example works! Great!

Several questions if you don't mind:
Inside my Virtualbox VM, Any Ctrl or Alt key strokes, for example, Ctrl + F9 does not work for Lazarus, any hint?

Would you also share Windows version of the "latest Lazarus with RTTI for **Windows**"? I'd rather develop under Windows, and compile the final result under Linux smile

Have a nice weekend!


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

Offline

#18 2016-05-14 14:45:33

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

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

Ok. Here you go again.

File is named fpclazrtticross.zip.txt
Its a zip file ... so just remove the .txt extension ... its needed for our friendly Windows virus detector.

Again, it is self-contained.
And MUST be installed in c:\fpclazrtticross
And must be started by the startup script inside the fpcup directory (Lazarus_fpclazrtticross).

As a bonus, I have added the possibility to cross-compile.
You can compile for:
win32
win64
linux_x86
linux_x86_64
linux_armhf

Have fun.

ps: the remaining errors you detected are expected: some mORMot debugging work has to be done still !

Offline

#19 2016-05-14 15:59:47

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

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

@AOG,

Thanks again! Downloaded the windows version, Lazarus started OK, great!  When cross-compiling the MVC server sample it failed, not sure what's wrong. Log messages.

Compile Project, OS: linux, CPU: x86_64, Target: MVCServer: Exit code 1, Errors: 1, Warnings: 189, Hints: 1603
MVCServer.dpr(4,2) Note: APPTYPE is not supported by the target OS

.....

MVCViewModel.pas(448,21) Hint: Function result variable of a managed type does not seem to be initialized
MVCViewModel.pas(443,5) Note: Local variable "auto" is assigned but never used
C:\fpclazrtticross\fpc\units\x86_64-linux\rtl\cprt0.o: In function `_start':
(.text+0x3c): undefined reference to `__libc_csu_init'
C:\fpclazrtticross\fpc\units\x86_64-linux\rtl\cprt0.o: In function `_start':
(.text+0x43): undefined reference to `__libc_csu_fini'
MVCServer.dpr(62,1) Error: Error while linking

What am I missing? Thanks AOG.


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

Offline

#20 2016-05-14 16:09:13

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

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

Look here ...

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

I think my answer for this bug will answer yours too !

Offline

#21 2016-05-14 17:36:20

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

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

Hi AOG,
That fixed the compilation error. Thanks.

BTW, is it correct that the downloads you provided were all completely generated by https://github.com/LongDirtyAnimAlf/Reiniero-fpcup ?

Last edited by edwinsn (2016-05-14 18:40:50)


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

Offline

#22 2016-05-15 04:56:27

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

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

Yep ! All done with fpclazup !!

Concerning cross-compiling.
All my dpr/lpr files start with this:

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

Offline

#23 2016-05-15 07:47:21

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

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

Great AOG!
A - The Windows version with cross-compiling was also done by fpcup?
B - I assume I can just run cross_linux_armhf_rtti.bat to update my copy of fpc/lazarus to the latest svn snapshot? (On windows I think I can configure cmd.exe to use the ShadowSocks proxy which is more stable and fast (with the help of Final Speed))


C - And here is a good news - result of my further experiments:
On a Ubuntu server 14.04  64bit, after added the i386 architecture following this instruction (http://askubuntu.com/questions/454253/h … ntu-64-bit), the MVCServer example successfully started and was running without error!

Anyways, I also have tried the x86_64 target when cross-compiling, and on the same Ubuntu server it failed to start and output the following error, I'm just posting it here as a feedback:


edwin@mysvr:~/download$ ./MVCServerx64
An unhandled exception occurred at $0000000000610037:
EAccessViolation: Access violation
  $0000000000610037  SHA256EXPANDMESSAGEBLOCKS
  $0000000000613D6B  FINAL,  line 4827 of ../../../SynCrypto.pas
  $0000000000613DD1  FULL,  line 4848 of ../../../SynCrypto.pas
  $0000000000611957  SHA256,  line 1621 of ../../../SynCrypto.pas
  $00000000005AEC26  SETPLAINPASSWORD,  line 194 of MVCModel.pas
  $00000000005AED1B  INITIALIZETABLE,  line 209 of MVCModel.pas
  $000000000059B6BF  CREATEMISSINGTABLES,  line 1063 of ../../mORMotSQLite3.pas
  $0000000000401619  main,  line 43 of MVCServer.dpr

Last edited by edwinsn (2016-05-15 08:03:25)


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

Offline

#24 2016-05-15 08:21:06

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

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

It seems that this is an assembler problem.

You could try to disable the assembler by:

{$define AES_PASCAL}

somewhere around line 1750 in SynCrypto.pas

Offline

#25 2016-05-15 09:38:55

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

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

Hi Alfred,

Added the {$define AES_PASCAL} define in SynCrypto.pas, or {$define PUREPASCAL} define in Synopse.inc, it still emits error, and the error messages were changed to:

An unhandled exception occurred at $000000000060FA20:
EAccessViolation: Access violation
  $000000000060FA20
  $0000000000613E61  FULL,  line 4849 of ../../../SynCrypto.pas
  $0000000000611877  SHA256,  line 1621 of ../../../SynCrypto.pas
  $00000000005AEC26  SETPLAINPASSWORD,  line 194 of MVCModel.pas
  $00000000005AED1B  INITIALIZETABLE,  line 209 of MVCModel.pas
  $000000000059B6BF  CREATEMISSINGTABLES,  line 1063 of ../../mORMotSQLite3.pas
  $0000000000401619  main,  line 43 of MVCServer.dpr

Last edited by edwinsn (2016-05-15 09:54:37)


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

Offline

#26 2016-05-15 10:02:21

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

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

Ok.
I got it running with these two changes.

Line 1750

{$ifndef DELPHI5OROLDER}

This forces the use of pascal code instead of assembler.
But not all assembly is disabled.

Line 1416

{$ifndef CPUINTEL}

This will disable the swap assembly.

Remember, these are ugly hacks !!!
Just to get your server running on Linux 64.

Offline

#27 2016-05-15 10:36:54

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

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

@AOG,

I'm not that hurry, so I'll leave it for now, I guess these fix will be included in future release of mORMot, right?


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

Offline

#28 2016-05-15 11:00:44

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

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

No. These are not fixes, but hacks.

But I will adapt (fix) the special branch of mORMot in one way or another to get things running by:
change the assembler into working assembler for FPC 64 bit
or
fallback to pure-pascal

I will do the latter first. And, when more time is available, the former.

Offline

#29 2016-05-15 12:03:48

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

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

Thanks for your effort, AOG.

BTW, Several general questions about running mORMot under linux -

1 - Do you use the MVC part of the mORMot framework under linux?
2 - Does your mORMot web server server the Internet users standalone or behind something like nginx?
3 - How do you monitor the mORMot web server problems, such as when it's hang, when there were an error, when the traffic is to heavy, etc?

Thanks again.


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

Offline

#30 2016-05-16 05:58:34

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

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

I have changed SynCrypto.pas to work on Linux 64 bit. Please test (with the MVC server) !
https://github.com/LongDirtyAnimAlf/mORMot

1: No, no MVC in use here.
2: My server(s) are running in a Amazon T2 instance under Linux 64 bit. I must say I am very happy with that !!! Runs smooth, with enormous bandwidth and on demand CPU power.
3: No monitoring at the moment. Still no need for it !

Offline

#31 2016-05-16 07:19:25

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

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

@AOG
I've applied a first patch set for Linux 64 support, under both x64 and ARM64 platforms.
Still some more modifications pending, especially at mORMot.pas level.
Thanks for the input!

See http://synopse.info/fossil/info/530f68b5c5

Offline

#32 2016-05-16 08:48:34

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

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

@AOG,

New result
===

Thanks! So I've just tested - with the latest version, the 30-MVCServer server was successfully compiled for Linux X86_64 target, and runs properly under Ubuntu 14.04.

However, under an old Ubuntu 10.04.4 LTS 64bit (that failed to upgrade to 14.04 for unknown reasons), it is not running, not sure why and I'm not planning to check it wink

Questions
===

1 - Would you tell me the reason(s) why you are not using the MVC module?

2 - One question you might have over looked - does your server serving behind nginx/apache or directly to the Internet? smile

3 - There are 5 types of T2 instance, which type do you use?

Thanks again.


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

Offline

#33 2016-05-16 09:17:37

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

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

@ab
Thanks ! I will await your code-approval on further changes !

@edwinsn
For my main project(s), I am using a javascript framework for user interaction: OpenUI5 by SAP. Many mobile clients. So, I only need a REST server.
Server connects directly to Internet.
I am using a T2 micro. Free of charge for 1 year. Cheap after that. With a custom (very lean) Arch Linux x64.
Due to the CPU scaling and bandwidth and price (three year contract) , very hard to beat.
But I am also studying (and using) the Odroid-C2 for server purposes. Aarch64. Very quick. On my private fiber onto the Internet.

Offline

#34 2016-05-16 09:31:37

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

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

@AOG
Does your fork still work with Win64 as target?
I wonder if nothing was broken in mORMot.pas when adding Linux 64 support...

Offline

#35 2016-05-16 09:38:14

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

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

@ab.
Do you mean with Delphi, or with FPC or with both ?

Offline

#36 2016-05-16 09:46:51

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

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

Both, of course...
We try to maintain the compatibility! wink
I would be able to test with Delphi/Win64, but not so easily with FPC/Win64.

Offline

#37 2016-05-16 14:10:29

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

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

I investigated the ARM support in mORMot.
In fact, TInterfaceFactory.GetMethodsVirtualTable would never work as it is, since it generates x86 opcodes, not ARM opcodes.
The whole class emulation won't work, under ARM.
So server-side won't execute, neither interface stubs and mocks.
And on client-side, interface based asynchronous callbacks won't execute either.

But I guess the CallMethod() procedure works on client side, for ARM, right?

I made  a first integration for mORMot.pas, without those interface-based implementation.
See http://synopse.info/fossil/info/fcd5456a31

Offline

#38 2016-05-16 16:51:14

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

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

Hi Ab,

ARM (and aarch64) invoke support is not yet finished !
It was just copy/past of old code. To get placeholders for the new ARM/aarch64 opcodes. CallMethod is started but still a lot of work-in-progress.

Thanks for your integration effort.

Main review should be about the introduction of separate floating point registers.
My tests show no regressions with Delphi.
And less errors with FPC.
In fact, the CallMethod assembler for FPC with FPR registers and stack-loop also works 100% with Delphi.

But still much work to be done.

There are some hard to solve (minor) bugs in the 64bit compiler of FPC that have to be circumvented.
As you can see from my fork, there are patches that are non-logical, but still needed for 64 bit FPC.

(My) Timeline:
Full integration of separate floating point registers, without regression for (Delphi) 64 bit, and with your code-review-ok.
Port to FPC Win64.
Port to FPC Linux64.
Port to FPC ARM.
Port to FPC aarch64.

Offline

#39 2016-05-17 05:58:59

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

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

AOG, thanks, with your roadmap, with the efforts by you and ab and other contributors, I have the confidence to use mORMot for web servers for Linux.


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

Offline

#40 2016-05-18 17:09:29

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

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

@ab@edwinsn

New version for FPC mORMot fork.
Interfaces under FPC 64 bit Windows work. Without regression for Delphi.
CallMethod works under Linux64 bit. FakeCall also, but not yet 100%.
A code review / test would be welcome !

Offline

#41 2016-05-18 17:25:20

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

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

Nice!

Are you sure all those aVariableName := '' lines are mandatory?

Sounds like  a huge bug of FPC if the local string variables are not initialized by default...

Offline

#42 2016-05-18 17:37:19

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

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

Not mandatory. Just safety.

This FPC/mORMot bug-hunting makes me (slightly) crazy. Code that should work, does not work.
Work-arounds that are non-logical make things work. So, I am getting a bit paranoid, and add more safety than perhaps needed. Does not do a lot of harm however.

Thats it.

Last edited by AOG (2016-05-18 17:38:02)

Offline

#43 2016-05-19 05:12:53

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

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

Well done AOG!

@ab, even under Delphi, isn't it only the global variables will be initialized, but not the local variables?

Last edited by edwinsn (2016-05-19 05:13:08)


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

Offline

#44 2016-05-19 05:54:36

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

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

Under Delphi or FPC, nor global nor local string variables are to be initialized.
The compiler always fill any local or global string (or variant, or dynamic array) to zero bytes, so set strings to ''.
Even as part of a class, TObject.Create would fill all fields with 0, so all strings are set to '' by default.

Offline

#45 2016-05-19 06:24:20

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

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

@ab not at all, especially for the result:

For a string, dynamic array, method pointer, or variant result, the effects are the same as if the function result were declared as an additional var parameter following the declared parameters. In other words, the caller passes an additional 32-bit pointer that points to a variable in which to return the function result.

http://docwiki.embarcadero.com/RADStudi … am_Control

Last edited by hnb (2016-05-19 06:24:46)


best regards,
Maciej Izak

Offline

#46 2016-05-19 06:39:26

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

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

A result is NOT a local variable.
It is a by-reference transmitted parameter, for managed types.

What I wrote is true about local variables.

Offline

#47 2016-05-19 06:51:02

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

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

I agree but is easily to forget about that wink


best regards,
Maciej Izak

Offline

#48 2016-05-19 08:53:04

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

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

Bidirectional sockets now working under FPC 64 bit !
Just a single type change ... but consuming so many hours ... ;-)

Offline

#49 2016-05-21 07:37:53

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

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

Interfaces now working 100% on Linux 64 bit (and FPC Win64 and Delphi .... no regressions detected yet) !!!
Major goal reached with mORMot on Linux 64 bit !!!
This means that code change for FP-registers is ok and working.

Path towards ARM and Aarch64 now open.

Please test.
https://github.com/LongDirtyAnimAlf/mORMot

Offline

#50 2016-05-22 11:15:27

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

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

@AOG,

Is Mac OS X is o your plan?


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