You are not logged in.
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
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
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
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
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 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
@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
@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
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
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
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
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
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
@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
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
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
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
@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
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
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
@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
Look here ...
http://bugs.freepascal.org/view.php?id=30112
I think my answer for this bug will answer yours too !
Offline
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
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
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
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
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
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
@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
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
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
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
@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!
Offline
@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
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?
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
@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
@ab.
Do you mean with Delphi, or with FPC or with both ?
Offline
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
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
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
@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
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
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
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
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
@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
I agree but is easily to forget about that
best regards,
Maciej Izak
Offline
Bidirectional sockets now working under FPC 64 bit !
Just a single type change ... but consuming so many hours ... ;-)
Offline
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
@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