#151 Re: mORMot 1 » Using FPC under linux x64, console application fails to receive SIGINT » 2014-11-24 06:59:03

Excellent excellent news ! Thank you very much for your great work ! smile

#152 Re: mORMot 1 » Using FPC under linux x64, bug in UrlDecodeValue. » 2014-11-23 11:37:01

On CentOS v5.11 x64, I built multiArch CodeTyphon v5.10. That is to say, both Typhon 64 and Typhon 32 IDE are available.

I use Typhon 32 IDE, which will use FPC 32.

Many thanks for your efforts !.... big_smile

#153 Re: mORMot 1 » Using FPC under linux x64, bug in UrlDecodeValue. » 2014-11-23 11:02:39

There is another Bug in UrlDecodeXXX (UrlDecodeExtended)...

For HTTP access to method-based services, when there are multiple concurrent clients by running the following cmd,

for i in `seq 1 8`; do ./JobAnalyzerTcpIpClientLinux uclient.pas > $i.log & done

the server gives the following exception...

20141123 19462751  # srvr  	GET root/sum?A=210.5&B=1.5 ERROR=500 (Exception EOverflow: Floating point overflow)

Again, InputDouble works correctly...

Sample code:
http://www40.zippyshare.com/v/20221523/file.html

#154 mORMot 1 » Using FPC under linux x64, bug in UrlDecodeValue. » 2014-11-23 10:38:03

ComingNine
Replies: 23

OS: CentOS v5.11 x64
CodeTyphon: v5.10 multiArch
Typhon: x86

Bug: For HTTP access to method-based services, when there is a single string parameter, the server cannot use urldecodevalue to get the value. InputUTF8 works correctly.

Console application code to reproduce:
http://www.rapidfileshare.net/b5oysncw5 … ar.gz.html
http://www40.zippyshare.com/v/9181464/file.html

Furthermore, could you help to change the line feed from #13 to #10 on Linux OS when echoing to the terminal ? When running the programs attached, the terminal displays twice the empty lines.

#155 Re: mORMot 1 » Using FPC under linux x64, console application fails to receive SIGINT » 2014-11-22 16:13:44

Wow ! Thank you very much for your help in identifying the problem !... big_smile

#156 Re: mORMot 1 » Using FPC under linux x64, console application fails to receive SIGINT » 2014-11-22 08:17:59

Thank you for your time and comments !

With Synopse.inc and without SynCommons, the console app can respond to SIGINT.

#157 Re: mORMot 1 » Using FPC under linux x64, console application fails to receive SIGINT » 2014-11-22 00:50:19

Thank you for your kind help. The same problem applies for the following code:

program project1;

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

uses
  {$IFDEF UNIX}{$IFDEF UseCThreads} cthreads, {$ENDIF}{$ENDIF}
  Classes, SysUtils, CustApp,
  BaseUnix, SynCommons;
  // BaseUnix;

type

  TMyApplication = class(TCustomApplication)
  protected
    procedure DoRun; override;
  end;

procedure TMyApplication.DoRun;
begin
  Sleep(3000);
  WriteLn('DoRun');

  // stop program loop
  // Terminate;
end;

Procedure DoSig(sig : cint);cdecl;
begin
   writeln('Receiving signal: ',sig);
end;

var
  // http://www.freepascal.org/docs-html/rtl/oldlinux/sigaction.html
  oa,na: PSigActionRec;
  Application: TMyApplication;
begin
  new(na);
  new(oa);
  na^.sa_Handler:=SigActionHandler(@DoSig);
  fillchar(na^.Sa_Mask,sizeof(na^.sa_mask),#0);
  na^.Sa_Flags:=0;
  {$ifdef Linux}               // Linux specific
    na^.Sa_Restorer:=Nil;
  {$endif}
  if fpSigAction(SIGINT,na,oa)<>0 then
  // if fpSigAction(SIGTERM,na,oa)<>0 then
  begin
     writeln('Error: ',fpgeterrno,'.');
     halt(1);
  end;

  Application:=TMyApplication.Create(nil);
  Application.StopOnException:=True;
  Application.Title:='My Application';
  Application.Run;
  Application.Free;

  Writeln ('Exit now...');
end.

#158 mORMot 1 » Using FPC under linux x64, console application fails to receive SIGINT » 2014-11-21 15:31:55

ComingNine
Replies: 13

OS: CentOS v5.11 x64
CodeTyphon: v5.10 multiArch
Typhon: x86

Console application code:

program project1;

{$mode delphi}

uses
  {$IFDEF UNIX}{$IFDEF UseCThreads} cthreads, {$ENDIF}{$ENDIF}
  Classes, SysUtils, CustApp,
  // BaseUnix, SynCommons;
  BaseUnix;

type

  TMyApplication = class(TCustomApplication)
  protected
    procedure DoRun; override;
  end;

procedure TMyApplication.DoRun;
begin
  Sleep(3000);
  WriteLn('DoRun');

  // stop program loop
  // Terminate;
end;

Procedure DoSig(sig : cint);cdecl;
begin
   writeln('Receiving signal: ',sig);
end;

var
  // http://www.freepascal.org/docs-html/rtl/oldlinux/sigaction.html
  oa,na: PSigActionRec;
  Application: TMyApplication;
begin
  new(na);
  new(oa);
  na^.sa_Handler:=SigActionHandler(@DoSig);
  fillchar(na^.Sa_Mask,sizeof(na^.sa_mask),#0);
  na^.Sa_Flags:=0;
  {$ifdef Linux}               // Linux specific
    na^.Sa_Restorer:=Nil;
  {$endif}
  if fpSigAction(SIGINT,na,oa)<>0 then
  // if fpSigAction(SIGTERM,na,oa)<>0 then
  begin
     writeln('Error: ',fpgeterrno,'.');
     halt(1);
  end;

  Application:=TMyApplication.Create(nil);
  Application.StopOnException:=True;
  Application.Title:='My Application';
  Application.Run;
  Application.Free;

  Writeln ('Exit now...');
end.

When SynCommons is not used, the application can react to SIGINT (Ctrl+C), as shown below:

[xli@localhost _Delphi_Proj_]$ ./project1 
DoRun
Receiving signal: 2
Receiving signal: 2
Receiving signal: 2
DoRun
DoRun

However, when SynCommons is used, the application can NOT react to SIGINT (Ctrl+C), as shown below:

[xli@localhost _Delphi_Proj_]$ ./project1 
DoRun
DoRun
DoRun

Could you help to comment on the reason and the possible workaround ? Many thanks !

#159 Re: mORMot 1 » mORMot.pas » 2014-11-01 15:13:59

Congratulation for the ASM crc32c achievement !

Thank you for your comments regarding debugging ! That does sound a lot of work ... big_smile

I have another question: This error occurs on only one of my linux box. How do you manage to reproduce this error on your linux ... big_smile

#160 Re: mORMot 1 » mORMot.pas » 2014-11-01 13:54:31

@AOG and @ab
Congratulations for your great work ! Thank you for your efforts very much !

@AOG
Can you help to comment how you identified the line number (line 2989) of the exception ? It will help me to debug mORMot-based applications using FPC on Linux. Maybe your way will even help @ab to implement the stack trace feature ...

Thank you for your suggestions ! Removing -dPUREPASCAL does not introduce errors. But it does not improve speed either, as shown below (left is with -dPUREPASCAL, right is without -dPUREPASCAL)...
718WqMF.png

#161 Re: mORMot 1 » mORMot.pas » 2014-11-01 13:27:32

ab wrote:

@AOG
Perhaps it is time for us to officially release and document the FPC/Windows/Linux feature.
smile

Users would need easy step-by-step instructions to be able to compile for FPC/Lazarus.
We may consider CodeTyphon as our official IDE, since we both use it AFAIR, and since it is more regularly releases (5.1 is just out! - with CrossBuild Support for Rapberry Pi and other ARM platforms you like so much).
In fact, why not propose to help including mORMot within the official CodeTyphon release? smile

Great idea ! Once the FPC team/community knows mORMot, they may help to fix that crucial RTTI bug...

Furthermore, stack trace should be a very useful feature for mORMot using FPC/Windows/Linux. big_smile

#162 Re: mORMot 1 » mORMot.pas » 2014-11-01 13:19:03

I have tried to ran the "LinuxSynTestFPCLinuxi386" executable on several of my linux machines. On one of them, there is one error:

The output from the "LinuxSynTestFPCLinuxi386"

   Synopse mORMot Framework Automated tests
  ------------------------------------------


1. Synopse libraries

 1.1. Low level common: 
  - System copy record: 20 assertions passed  22.00s
  - TRawUTF8List: 70,005 assertions passed  38713.00s
  - TDynArray: 1,027,706 assertions passed  278982.00s
  - TDynArrayHashed: 1,200,629 assertions passed  126158.00s
  - TObjectListHashed: 999,780 assertions passed  335741.00s
  - TObjectDynArrayWrapper: 167,501 assertions passed  34004.00s
  - Fast string compare: 7 assertions passed  5.00s
  - IdemPropName: 30 assertions passed  8.00s
  - Url encoding: 132 assertions passed  1246.00s
  - GUID: 9,005 assertions passed  6018.00s
  - IsMatch: 599 assertions passed  180.00s
  - Soundex: 35 assertions passed  11.00s
  - Numerical conversions: 1,119,286 assertions passed  430866.00s
  - crc32c: 20,020 assertions passed  79207.00s
      pas 23080.00s 271 B/s fast 10425.00s 600 B/s
  - Curr 64: 20,053 assertions passed  3109.00s
  - CamelCase: 11 assertions passed  18.00s
  - Bits: 4,774 assertions passed  109.00s
  - Ini files: 7,004 assertions passed  65814.00s
  - UTF8: 82,106 assertions passed  1076475.00s
  - Iso 8601 date and time: 36,015 assertions passed  5079.00s
  - Url decoding: 1,100 assertions passed  268.00s
  - Mime types: 23 assertions passed  28.00s
!  - TSynTable: 1 / 50 FAILED  5379.00s
  - TSynCache: 404 assertions passed  119.00s
  - TSynFilter: 804 assertions passed  2610.00s
  - TSynValidate: 677 assertions passed  709.00s
  - TSynLogFile: 36 assertions passed  899.00s
  Total failed: 1 / 4,767,812  - Low level common FAILED  2491962.00s

 1.2. Low level types: 
  - Url encoding: 200 assertions passed  992.00s
  - Encode decode JSON: 250,616 assertions passed  160159.00s
  - Variants: 5 assertions passed  6.00s
  Total failed: 0 / 250,821  - Low level types PASSED  161175.00s

 1.3. Cryptographic routines: 
  - Adler32: 1 assertion passed  21.00s
  - MD5: 1 assertion passed  10.00s
  - SHA1: 5 assertions passed  15.00s
  - SHA256: 5 assertions passed  25.00s
  - AES256: 12,177 assertions passed  963996.00s
  - RC4: 1 assertion passed  19.00s
  - Base64: 11,994 assertions passed  282174.00s
  - CompressShaAes: 1,683 assertions passed  4448.00s
  Total failed: 0 / 25,867  - Cryptographic routines PASSED  1250751.00s

 1.4. Compression: 
  - In memory compression: 12 assertions passed  695995.00s
  - GZIP format: 19 assertions passed  1254797.00s
  - SynLZO: 3,006 assertions passed  137542.00s
  - SynLZ: 21,010 assertions passed  723858.00s
  Total failed: 0 / 24,047  - Compression PASSED  2812237.00s


2. mORMot

 2.1. File based: 
  - Database direct access: 10,138 assertions passed  378921.00s
  - Virtual table direct access: 12 assertions passed  1811.00s
  - TSQLTableJSON: 106,068 assertions passed  130316.00s
  - TSQLRestClientDB: 310,072 assertions passed  1029241.00s
  Total failed: 0 / 426,290  - File based PASSED  1540337.00s

 2.2. File based memory map: 
  - Database direct access: 10,136 assertions passed  220219.00s
  - Virtual table direct access: 12 assertions passed  1264.00s
  - TSQLTableJSON: 106,068 assertions passed  99050.00s
  - TSQLRestClientDB: 310,071 assertions passed  1237888.00s
  Total failed: 0 / 426,287  - File based memory map PASSED  1558456.00s

 2.3. File based WAL: 
  - Database direct access: 10,138 assertions passed  260996.00s
  - Virtual table direct access: 12 assertions passed  1248.00s
  - TSQLTableJSON: 106,068 assertions passed  105735.00s
  - TSQLRestClientDB: 310,072 assertions passed  1061406.00s
  Total failed: 0 / 426,290  - File based WAL PASSED  1429446.00s

 2.4. Memory based: 
  - Database direct access: 10,136 assertions passed  200254.00s
  - Virtual table direct access: 12 assertions passed  1129.00s
  - TSQLTableJSON: 106,068 assertions passed  98096.00s
  - TSQLRestClientDB: 402,396 assertions passed  1747835.00s
  - RTree: 140,000 assertions passed  1048069.00s
  Total failed: 0 / 658,612  - Memory based PASSED  3095432.00s

 2.5. Basic classes: 
  - TSQLRecord: 77 assertions passed  629.00s
  - TSQLRecordSigned: 200 assertions passed  10346.00s
  - TSQLModel: 3 assertions passed  85.00s
  - TSQLRestServerFullMemory: 562,308 assertions passed  1504564.00s
  Total failed: 0 / 562,588  - Basic classes PASSED  1515670.00s

 2.6. Client server access: 
  - TSQLHttpServer: 2 assertions passed  44355.00s
     using Synsock - Synapse Platform Independent Socket Layer.514
  - TSQLHttpClient: 3 assertions passed  72193.00s
  - HTTP client keep alive: 387 assertions passed  5346723.00s
  - HTTP client multi connect: 387 assertions passed  86186.00s
  - HTTP client encrypted: 387 assertions passed  5361698.00s
  - Direct in process access: 356 assertions passed  21841.00s
  - HTTP several DB servers: 1,504 assertions passed  34536038.00s
  Total failed: 0 / 3,026  - Client server access PASSED  2519456.04s

 2.7. External database: 
  - TQuery: 2,003 assertions passed  97492.00s
  - External records: 2 assertions passed  395.00s
  - Auto adapt SQL: 624 assertions passed  42994.00s
  - Crypted database: 253,275 assertions passed  231756.00s
  - External via REST: 168,339 assertions passed  1417085.00s
  - External via virtual table: 168,339 assertions passed  1623631.00s
  - External via REST with change tracking: 178,439 assertions passed  2253432.00s
  Total failed: 0 / 771,021  - External database PASSED  5666860.00s

 2.8. Multi thread process: 
  - Create thread pool: 1 assertion passed  9366.00s
  - TSQLRestServerDB: 4,822 assertions passed  259597.00s
     1=0/s  2=0/s  5=0/s  10=0/s  30=0/s  50=0/s  
  - TSQLRestClientDB: 4,822 assertions passed  217509.00s
     1=0/s  2=0/s  5=0/s  10=0/s  30=0/s  50=0/s  
  - Locked: 4,822 assertions passed  213061.00s
     1=0/s  2=0/s  5=0/s  10=0/s  30=0/s  50=0/s  
  - Unlocked: 4,822 assertions passed  199824.00s
     1=0/s  2=0/s  5=0/s  10=0/s  30=0/s  50=0/s  
  - Background thread: 4,822 assertions passed  324339.00s
     1=0/s  2=0/s  5=0/s  10=0/s  30=0/s  50=0/s  
  - Main thread: 4,822 assertions passed  548101.00s
     1=0/s  2=0/s  5=0/s  10=0/s  30=0/s  50=0/s  
  Total failed: 0 / 28,933  - Multi thread process PASSED  1771903.00s


Synopse framework used: 1.18.451
SQlite3 engine used: 3.8.7
Generated with: Free Pascal 2.7.1 compiler
Tests performed at 11/01/2014 09:49:54 PM

Total assertions failed for all test suits:  1 / 8,371,594
! Some tests FAILED: please correct the code.
                                             Done - Press ENTER to Exit

The "LinuxSynTestFPCLinuxi386 20141101 214843.log"

Host=linux User=user CPU=1*0-15-1027 OS=2.3=5.1.2600 Wow64=0 Freq=1234
TSQLLog 1.18.451 2014-11-01T21:48:43

20141101 21484323 warn  Test failed Out of memory
20141101 21484323 fail  TTestLowLevelCommon(555562F0) Low level common: TSynTable "Out of memory"

The output from "top" command

top - 22:16:39 up 3 days, 20:59,  4 users,  load average: 0.20, 0.20, 0.18
Tasks: 269 total,   1 running, 268 sleeping,   0 stopped,   0 zombie
Cpu(s):  0.0%us,  0.0%sy,  0.0%ni, 99.8%id,  0.0%wa,  0.0%hi,  0.1%si,  0.0%st
Mem:  24676464k total, 13231312k used, 11445152k free,   249460k buffers
Swap: 49150856k total,        0k used, 49150856k free, 12487296k cached

  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND                                                                                                                                                       
29319 xxe       16   0 17108 1336  900 R  0.3  0.0   0:00.04 top   

Could you help to comment ?

#163 Re: mORMot 1 » mORMot.pas » 2014-11-01 13:13:40

program LinuxSynTestFPCLinuxi386;
{$I Synopse.inc} // define HASINLINE USETYPEINFO CPU32 CPU64 OWNNORMTOUPPER
{$APPTYPE CONSOLE}
uses {$ifdef Linux} cthreads, cwstring, {$endif} mORMotSelfTests;
begin SQLite3ConsoleTests; end.  

Thank you for your help very much !
I have succeeded in cross-compiling mORMot from win32 to linux32 with  static (linux32) library of SQLite !

OS: Windows 7 SP1 X64
CodeTyphon: 5.1
Typhon: x86
FPC cross-build element: i386-linux
mORMot: 014f4dd542e609ba2e27b81eccc6890f66ff1a68
modification to mORMot: nothing

File system:
Note: (1) The files under the "linuxlibrary" are from the VMWare CentOS 5.11 x86. That is to say, they are not from what CodeTyphon provides, which are from Debian 7.2. (2) The reason is that I would think that the files under "linuxlibrary" may need to be compatible with the sqlite*.o which are compiled using "mORMot\SQLite3\c-fpcgcclin.sh" under the VMWare CentOS 5.11 x86. (3) I am not sure whether the OS library from CodeTyphon works fine with the SQLite library compiled under the VMWare CentOS 5.11 x86. (4) The files under the "linuxlibrary" are only sufficient for LinuxSynTestFPCLinuxi386.lpr shown above. That is to say, if more functionality is needed, more library would be needed.
PCIctCl.png

IDE settings:
XHa2uYJ.png
qdswmFz.png
V8PXTBQ.png
yBE2kzf.png

#164 Re: mORMot 1 » mORMot.pas » 2014-11-01 09:11:13

Can you confirm that you have succeeded in cross-compiling mORMot from win32 to linux32 with  static (linux32)library of SQLite ?

I still get complaints

c:\codetyphon\fpc\fpc32\bin\i386-win32\i386-linux-ld.exe: warning: link.res contains output sections; did you forget -T?
c:\codetyphon\fpc\fpc32\bin\i386-win32\i386-linux-ld.exe: cannot find /lib/libpthread.so.0
c:\codetyphon\fpc\fpc32\bin\i386-win32\i386-linux-ld.exe: cannot find /usr/lib/libpthread_nonshared.a
LinuxSynTestFPCLinuxi386.lpr(22,1) Error: Error while linking
 

The reason seems to be that the static linux32 library of SQLite, which is compiled under a VMWare CentOS 5.11 x86, has internal linkage to "/lib/libpthread.so.0" and "/usr/lib/libpthread_nonshared.a" ?

#165 Re: mORMot 1 » mORMot.pas » 2014-10-31 17:03:55

LinuxSynTestFPCLinuxi386.lpr:

program LinuxSynTestFPCLinuxi386;
{$I Synopse.inc} // define HASINLINE USETYPEINFO CPU32 CPU64 OWNNORMTOUPPER
{$APPTYPE CONSOLE}
uses {$ifdef Linux} cthreads, cwstring, {$endif} mORMotSelfTests;
begin SQLite3ConsoleTests; end.   

Link error during cross-compilation from win32 to linux32 with static SQLite library

 
LinuxSynTestFPCLinuxi386.lpr(22,1) Warning: "crtbegin.o" not found, this will probably cause a linking failure
LinuxSynTestFPCLinuxi386.lpr(22,1) Warning: "crtend.o" not found, this will probably cause a linking failure
C:\DEV\_Delphi_Lib_\LinuxSynTestFPCLinuxi386\LinuxSynTestFPCLinuxi386.lpr(22,1) Warning: (9034) "crtbegin.o" not found, this will probably cause a linking failure
C:\DEV\_Delphi_Lib_\LinuxSynTestFPCLinuxi386\LinuxSynTestFPCLinuxi386.lpr(22,1) Warning: (9034) "crtend.o" not found, this will probably cause a linking failure
c:\codetyphon\fpc\fpc32\bin\i386-win32\i386-linux-ld.exe: warning: link.res contains output sections; did you forget -T?
c:\codetyphon\fpc\fpc32\bin\i386-win32\i386-linux-ld.exe: cannot find /lib/libpthread.so.0
c:\codetyphon\fpc\fpc32\bin\i386-win32\i386-linux-ld.exe: cannot find /usr/lib/libpthread_nonshared.a
LinuxSynTestFPCLinuxi386.lpr(22,1) Error: Error while linking

OS: Windows 7 SP1 X64
CodeTyphon: 5.1
Typhon: x86
FPC cross-build element: i386-linux
mORMot: 014f4dd542e609ba2e27b81eccc6890f66ff1a68
modification to mORMot: nothing

File system:
A VMWare CentOS 5.11 x86 mounted using Sftp Net Drive
VdgK3bY.png

linuxlibrary & mORMot
GfPlaVv.png

linuxlibrary & test project
fGmq3lg.png

IDE settings:
1QbIOX5.png
9J9T6Hs.png
eleKIoB.png
RkhDxau.png

#166 Re: mORMot 1 » mORMot.pas » 2014-10-31 09:42:32

@ab

Thank you for your efforts very much ! The ticket was created smile

#167 Re: mORMot 1 » mORMot.pas » 2014-10-31 08:58:07

@ab:

Thank you for your efforts and comments !

Can you help to make TSynLog capable of capturing the stacktrace with FPC on Linux ? smile

#168 Re: mORMot 1 » mORMot.pas » 2014-10-31 08:34:27

Now compilation under linux32 works great using static SQLite library !  Congratulations to your great work !

OS: CentOS 5.11 x86
CodeTyphon: 5.1 x86
mORMot: 4e64baa9eac75911acf9fb8b86e1677be05e8cb9
modification to mORMot:
(1) "synopseCommit.inc" to "SynopseCommit.inc"
(2) "fBuf := Fpmmap(nil,fBufSize,PROT_READ,MAP_SHARED,fFile,0,aCustomOffset);" to "fBuf := Fpmmap(nil,fBufSize,PROT_READ,MAP_SHARED,fFile,aCustomOffset);"
(3) replacing all 888 with 8888 inside SynSelfTests

I will test cross-compilation from win32 to linux32 using static SQLite library, and report back.

#169 Re: mORMot 1 » mORMot.pas » 2014-10-31 08:28:32

The forum seems to become NOT responsive and return 500 when I tried to post the content shown in this git:
https://gist.github.com/anonymous/8204f29244f7e7be0e0e

Can you help to solve this ? It happened several times when I tried to report the results of testing the kind suggestions given by "AOG" or "ab". Frustrating...

#170 Re: mORMot 1 » mORMot.pas » 2014-10-31 01:07:11

AOG wrote:

Glad to hear that dynamic works as expected !

Would you mind trying:

0): Running at least version 1.18.438 (see : http://synopse.info/fossil/info/8fd8f6f … 828c0288c6)
1): No succes: Disabling ---> Demo.MemoryMappedMB = 256; inside SynSelfTests (2-3 x)
2): No succes: Running as root.

Running on 8888 : replacing all 888 with 8888 inside SynSelfTests.

As I reported, the latest mORMot gives compilation error :

SynCommons.pas(38215,11) Error: Wrong number of parameters specified for call to "Fpmmap"
Error: Found declaration: Fpmmap(Pointer;LongWord;LongInt;LongInt;LongInt;Int64):^untyped;

OS: CentOS 5.11 x86
CodeTyphon: 5.0 x86
mORMot: 4e64baa9eac75911acf9fb8b86e1677be05e8cb9
modification to mORMot: "synopseCommit.inc" to "SynopseCommit.inc"

#171 Re: mORMot 1 » mORMot.pas » 2014-10-30 16:03:34

AOG wrote:

2) Did you use dynamic or static linking ?
{$define NOSQLITE3STATIC}

I tested static linking. When I test dynamic linking, everything works.

AOG wrote:

On Linux, access to port 888 is limited to root processes.
(and I did perform the tests as root ... so I forgot about it)

I have made another executable, that uses port 8888, that is also available for non-root users.

Could you help to comment how you changed the port ?

ab wrote:

I suspect http://synopse.info/fossil/info/b086548a8 would work as expected.

I got compilation error as follows:

SynCommons.pas(38215,11) Error: Wrong number of parameters specified for call to "Fpmmap"
Error: Found declaration: Fpmmap(Pointer;LongWord;LongInt;LongInt;LongInt;Int64):^untyped;

ps: Can you change the file name case of "synopseCommit.inc" to be consistent with "SynopseCommit.inc" which is referred to in Synopose.inc ?

ps: The forum seems to become NOT responsive and return 500 when I tried to post the content shown in this git:
https://gist.github.com/anonymous/8204f29244f7e7be0e0e

#172 Re: mORMot 1 » mORMot.pas » 2014-10-29 09:11:50

FPC lpr:

program LinuxSynTestFPCLinuxi386;

//{$IFDEF FPC}
  //{$MODE Delphi} // Already defined in Synopse.inc line 175, mORMot commit 228976b436782ae914dc098ab6cec5588aef0cec
//{$ENDIF}

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

{$APPTYPE CONSOLE}

uses
  {$ifdef Linux}
  cthreads,
  // widestring manager for Linux !!
  // could also be put in another unit ... but doc states: as early as possible
  cwstring,
  {$endif}
  mORMotSelfTests;

begin
  SQLite3ConsoleTests;
end.       

Test output:

   Synopse mORMot Framework Automated tests
  ------------------------------------------


1. Synopse libraries

 1.1. Low level common: 
  - System copy record: 20 assertions passed  20.00s
  - TRawUTF8List: 70,005 assertions passed  39869.00s
  - TDynArray: 1,027,706 assertions passed  280943.00s
  - TDynArrayHashed: 1,200,629 assertions passed  123358.00s
  - TObjectListHashed: 999,746 assertions passed  359072.00s
  - TObjectDynArrayWrapper: 167,501 assertions passed  34513.00s
  - Fast string compare: 7 assertions passed  7.00s
  - IdemPropName: 30 assertions passed  11.00s
  - Url encoding: 132 assertions passed  1301.00s
  - GUID: 9,005 assertions passed  6086.00s
  - IsMatch: 599 assertions passed  165.00s
  - Soundex: 35 assertions passed  10.00s
  - Numerical conversions: 1,113,690 assertions passed  431471.00s
  - crc32c: 20,020 assertions passed  79054.00s
      pas 22984.00s 272 B/s fast 10404.00s 601 B/s
  - Curr 64: 20,053 assertions passed  3187.00s
  - CamelCase: 11 assertions passed  7.00s
  - Bits: 4,774 assertions passed  84.00s
  - Ini files: 7,004 assertions passed  69322.00s
  - UTF8: 82,106 assertions passed  1083725.00s
  - Iso 8601 date and time: 36,015 assertions passed  4961.00s
  - Url decoding: 1,100 assertions passed  260.00s
  - Mime types: 23 assertions passed  25.00s
!  - TSynTable: 1 / 50 FAILED  2918.00s
  - TSynCache: 404 assertions passed  112.00s
  - TSynFilter: 804 assertions passed  2988.00s
  - TSynValidate: 677 assertions passed  1109.00s
  - TSynLogFile: 36 assertions passed  1419.00s
  Total failed: 1 / 4,762,182  - Low level common FAILED  2526159.00s

 1.2. Low level types: 
  - Url encoding: 200 assertions passed  1521.00s
  - Encode decode JSON: 250,616 assertions passed  167348.00s
  - Variants: 5 assertions passed  9.00s
  Total failed: 0 / 250,821  - Low level types PASSED  168909.00s

 1.3. Cryptographic routines: 
  - Adler32: 1 assertion passed  41.00s
  - MD5: 1 assertion passed  24.00s
  - SHA1: 5 assertions passed  28.00s
  - SHA256: 5 assertions passed  48.00s
  - AES256: 12,177 assertions passed  971956.00s
  - RC4: 1 assertion passed  15.00s
  - Base64: 11,994 assertions passed  279630.00s
  - CompressShaAes: 1,683 assertions passed  4454.00s
  Total failed: 0 / 25,867  - Cryptographic routines PASSED  1256308.00s

 1.4. Compression: 
  - In memory compression: 12 assertions passed  684980.00s
  - GZIP format: 19 assertions passed  1241166.00s
  - SynLZO: 3,006 assertions passed  135743.00s
  - SynLZ: 21,010 assertions passed  718603.00s
  Total failed: 0 / 24,047  - Compression PASSED  2780521.00s


2. mORMot

 2.1. File based: 
  - Database direct access: 10,138 assertions passed  434300.00s
  - Virtual table direct access: 12 assertions passed  1999.00s
  - TSQLTableJSON: 106,068 assertions passed  134448.00s
  - TSQLRestClientDB: 310,072 assertions passed  1019676.00s
  Total failed: 0 / 426,290  - File based PASSED  1590468.00s

 2.2. File based memory map: 

! Exception EAccessViolation raised with messsage:
!  Access violation


Synopse framework used: 1.18.433
SQlite3 engine used: 3.8.7
Generated with: Free Pascal 2.7.1 compiler
Tests performed at 10/29/2014 05:55:48 PM

Total assertions failed for all test suits:  1 / 5,489,207
! Some tests FAILED: please correct the code.

Done - Press ENTER to Exit

OS: CentOS 5.11 x86
CodeTyphon: 5.0 x86
mORMot: 228976b436782ae914dc098ab6cec5588aef0cec
modification to mORMot: "synopseCommit.inc" to "SynopseCommit.inc"

#173 Re: mORMot 1 » mORMot.pas » 2014-10-27 09:45:43

AOG wrote:

Good result !! Glad to hear !!
However, I do not have detailed knowledge about compiling on Centos 64 bit.
But, looking at your self-test-results, you are ready to go ahaead with mORMot.

Thank you for your comments very much !

Could you help to comment further about the recommended way to build Linux exetuables ? For example:

(1) CodeTyphon on Win to cross-compile, or CodeTyphon on Linux ?

(1.1) If CodeTyphon on Win to cross-compile, how to generate the SQLite static library that is compatible with the cross-compile OS library that CodeTyphon ships ? I mean, CodeTyphon seems to have its own set of cross-compile OS library.

(1.2) If CodeTyphon on Linux, which Linux distro ? 32bit or 64bit OS?

(2) Some screen shots or kickstart video ?

#174 Re: mORMot 1 » Wow! Full FPC support now??!! » 2014-10-26 14:02:39

ab wrote:

What do you think of using http://gwan.com/ as our HTTP server under Linux?
Sounds like a great and proven system, to be used instead of http.sys (which sounds the best under Windows) and any FastCGI processes (e.g. Apache/NGinx/Lighttpd) under Linux.
Take a look at http://www.wikivs.com/wiki/G-WAN_vs_Nginx

Sorry to interrupt this thread but could you help to comment on the recommended way to build Linux exetuables ?

For example,:
(1) CodeTyphon on Win to cross-compile ? Or CodeTyphon on Linux ?
(2) Which Linux distro ? 32bit or 64bit OS?
(3) Some screen shots or kickstart video ?

#175 Re: mORMot 1 » mORMot.pas » 2014-10-25 12:27:49

ab wrote:

I guess this is because 3.7.17 is too old.
We use some feature of the latest revision.

You should use your own .so - from http://www.sqlite.org/howtocompile.html

Thank you for your comments ! Compiling 32bit SQLite from source on 64bit CentOS 7.0 helps. smile

[root@localhost Downloads]# export LD_LIBRARY_PATH=/usr/local/lib ; ./test

   Synopse mORMot Framework Automated tests
  ------------------------------------------


1. Synopse libraries

 1.1. Low level common: 
  - System copy record: 20 assertions passed  118us
  - TRawUTF8List: 70,005 assertions passed  31.38ms
  - TDynArray: 1,027,706 assertions passed  309.93ms
  - TDynArrayHashed: 1,200,629 assertions passed  183.51ms
  - TObjectListHashed: 999,788 assertions passed  572.01ms
  - TObjectDynArrayWrapper: 167,501 assertions passed  35.51ms
  - Fast string compare: 7 assertions passed  25us
  - IdemPropName: 30 assertions passed  46us
  - Url encoding: 132 assertions passed  1.68ms
  - GUID: 9,005 assertions passed  6.47ms
  - IsMatch: 599 assertions passed  159us
  - Soundex: 35 assertions passed  32us
  - Numerical conversions: 1,117,835 assertions passed  511.30ms
  - crc32c: 20,020 assertions passed  110.29ms
      pas 32.62ms 182.8 MB/s fast 13.51ms 441.3 MB/s
  - Curr 64: 20,053 assertions passed  3.26ms
  - CamelCase: 11 assertions passed  27us
  - Bits: 4,774 assertions passed  85us
  - Ini files: 7,004 assertions passed  57.71ms
  - UTF8: 82,106 assertions passed  1.11s
  - Iso 8601 date and time: 36,015 assertions passed  5.71ms
  - Url decoding: 1,100 assertions passed  487us
  - Mime types: 23 assertions passed  201us
  - TSynTable: 457 assertions passed  1.03ms
  - TSynCache: 404 assertions passed  120us
  - TSynFilter: 804 assertions passed  3.21ms
  - TSynValidate: 677 assertions passed  621us
  - TSynLogFile: 36 assertions passed  1.76ms
  Total failed: 0 / 4,766,776  - Low level common PASSED  2.95s

 1.2. Low level types: 
  - Url encoding: 200 assertions passed  1.29ms
  - Encode decode JSON: 250,616 assertions passed  173.40ms
  - Variants: 5 assertions passed  26us
  Total failed: 0 / 250,821  - Low level types PASSED  174.83ms

 1.3. Cryptographic routines: 
  - Adler32: 1 assertion passed  42us
  - MD5: 1 assertion passed  42us
  - SHA1: 5 assertions passed  52us
  - SHA256: 5 assertions passed  36us
  - AES256: 12,177 assertions passed  993.36ms
  - RC4: 1 assertion passed  33us
  - Base64: 11,994 assertions passed  299.17ms
  - CompressShaAes: 1,683 assertions passed  5.17ms
  Total failed: 0 / 25,867  - Cryptographic routines PASSED  1.29s

 1.4. Compression: 
  - In memory compression: 12 assertions passed  600.99ms
  - GZIP format: 19 assertions passed  1.17s
  - SynLZO: 3,006 assertions passed  170.56ms
  - SynLZ: 21,010 assertions passed  832.11ms
  Total failed: 0 / 24,047  - Compression PASSED  2.78s


2. mORMot

 2.1. File based: 
  - Database direct access: 10,136 assertions passed  262.91ms
  - Virtual table direct access: 12 assertions passed  553us
  - TSQLTableJSON: 106,068 assertions passed  117.83ms
  - TSQLRestClientDB: 310,071 assertions passed  1.38s
  Total failed: 0 / 426,287  - File based PASSED  1.76s

 2.2. File based memory map: 
  - Database direct access: 10,136 assertions passed  229.55ms
  - Virtual table direct access: 12 assertions passed  582us
  - TSQLTableJSON: 106,068 assertions passed  105.71ms
  - TSQLRestClientDB: 310,071 assertions passed  1.38s
  Total failed: 0 / 426,287  - File based memory map PASSED  1.71s

 2.3. File based WAL: 
  - Database direct access: 10,136 assertions passed  236.65ms
  - Virtual table direct access: 12 assertions passed  597us
  - TSQLTableJSON: 106,068 assertions passed  104.38ms
  - TSQLRestClientDB: 310,071 assertions passed  1.46s
  Total failed: 0 / 426,287  - File based WAL PASSED  1.80s

 2.4. Memory based: 
  - Database direct access: 10,136 assertions passed  262.49ms
  - Virtual table direct access: 12 assertions passed  837us
  - TSQLTableJSON: 106,068 assertions passed  110.89ms
  - TSQLRestClientDB: 402,396 assertions passed  2.55s
  - RTree: 140,000 assertions passed  1.28s
  Total failed: 0 / 658,612  - Memory based PASSED  4.21s

 2.5. Basic classes: 
  - TSQLRecord: 77 assertions passed  1.05ms
  - TSQLRecordSigned: 200 assertions passed  8.59ms
  - TSQLModel: 3 assertions passed  64us
  - TSQLRestServerFullMemory: 562,309 assertions passed  1.54s
  Total failed: 0 / 562,589  - Basic classes PASSED  1.55s

 2.6. Client server access: 
  - TSQLHttpServer: 2 assertions passed  143.38ms
     using Synsock - Synapse Platform Independent Socket Layer.514
  - TSQLHttpClient: 3 assertions passed  34.41ms
  - HTTP client keep alive: 387 assertions passed  5.24s
  - HTTP client multi connect: 387 assertions passed  165.86ms
  - HTTP client encrypted: 387 assertions passed  5.24s
  - Direct in process access: 356 assertions passed  15.15ms
  - HTTP several DB servers: 1,504 assertions passed  34.32s
  Total failed: 0 / 3,026  - Client server access PASSED  45.17s

 2.7. External database: 
  - TQuery: 2,003 assertions passed  9.52ms
  - External records: 2 assertions passed  629us
  - Auto adapt SQL: 624 assertions passed  48.53ms
  - Crypted database: 176,192 assertions passed  219.16ms
  - External via REST: 168,339 assertions passed  2.02s
  - External via virtual table: 168,339 assertions passed  2.69s
  - External via REST with change tracking: 178,439 assertions passed  3.85s
  Total failed: 0 / 693,938  - External database PASSED  8.85s

 2.8. Multi thread process: 
  - Create thread pool: 1 assertion passed  15.04ms
  - TSQLRestServerDB: 4,822 assertions passed  493.50ms
     1=12141/s  2=13583/s  5=8495/s  10=4044/s  30=3112/s  50=2726/s  
  - TSQLRestClientDB: 4,822 assertions passed  230.97ms
     1=9839/s  2=15237/s  5=13795/s  10=12790/s  30=9323/s  50=7953/s  
  - Locked: 4,822 assertions passed  248.20ms
     1=15276/s  2=12477/s  5=12133/s  10=10952/s  30=7308/s  50=7220/s  
  - Unlocked: 4,822 assertions passed  215.93ms
     1=13576/s  2=13519/s  5=16025/s  10=14628/s  30=8716/s  50=8203/s  
  - Background thread: 4,822 assertions passed  419.83ms
     1=7062/s  2=6319/s  5=6387/s  10=5858/s  30=5238/s  50=4877/s  
  - Main thread: 4,822 assertions passed  272.44ms
     1=6747/s  2=9213/s  5=11397/s  10=11656/s  30=9132/s  50=8683/s  
  Total failed: 0 / 28,933  - Multi thread process PASSED  1.89s


Synopse framework used: 1.18.354
SQlite3 engine used: 3.8.7
Generated with: Free Pascal 2.7.1 compiler
Tests performed at 10/25/2014 12:36:07 PM

Total assertions failed for all test suits:  0 / 8,293,470
! All tests passed successfully.
                                Done - Press ENTER to Exit
[root@localhost Downloads]#

PS: There is little trouble in compiling 32bit SQLite from source on 64bit CentOS 7.0.
Could you help to comment how to properly compile 32bit SQLite from source on 64bit CentOS 7.0 ?

" make clean; export CFLAGS=-m32 ; ./configure ; make ; make install "

and

" make clean; CFLAGS=-m32 ./configure ; make ; make install "

both give 64bit library.

I have to append -m32 manually:

yum install install glibc-devel
/bin/sh ./libtool --tag=CC   --mode=compile gcc -DPACKAGE_NAME=\"sqlite\" -DPACKAGE_TARNAME=\"sqlite\" -DPACKAGE_VERSION=\"3.8.7\" -DPACKAGE_STRING=\"sqlite\ 3.8.7\" -DPACKAGE_BUGREPORT=\"http://www.sqlite.org\" -DPACKAGE_URL=\"\" -DPACKAGE=\"sqlite\" -DVERSION=\"3.8.7\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_DLFCN_H=1 -DLT_OBJDIR=\".libs/\" -DHAVE_FDATASYNC=1 -DHAVE_USLEEP=1 -DHAVE_LOCALTIME_R=1 -DHAVE_GMTIME_R=1 -DHAVE_DECL_STRERROR_R=1 -DHAVE_STRERROR_R=1 -DHAVE_POSIX_FALLOCATE=1 -I.    -D_REENTRANT=1 -DSQLITE_THREADSAFE=1  -DSQLITE_ENABLE_FTS3 -DSQLITE_ENABLE_RTREE -g -O2 -MT sqlite3.lo -MD -MP -MF .deps/sqlite3.Tpo -m32 -c -o sqlite3.lo sqlite3.c
mv -f .deps/sqlite3.Tpo .deps/sqlite3.Plo
/bin/sh ./libtool --tag=CC   --mode=link gcc -D_REENTRANT=1 -DSQLITE_THREADSAFE=1  -DSQLITE_ENABLE_FTS3 -DSQLITE_ENABLE_RTREE -g -O2 -no-undefined -version-info 8:6:8 -m32 -o libsqlite3.la -rpath /usr/local/lib sqlite3.lo  -ldl -lpthread 
/bin/sh ./libtool   --mode=install /bin/install -c   libsqlite3.la '/usr/local/lib'

#176 Re: mORMot 1 » mORMot.pas » 2014-10-25 11:58:22

AOG wrote:

Strange.

Compiled mORMot 1.18.392 .

Installed Ach Linux 64 bit.
And installed lib32-glibc, lib32-sqlite, lib32-zlib, lib32-gcc-libs.

Result:
mORMot runs as expected inside my 64 bit Arch VirtualBox.

Sidenote:
I did sent some patches for mORMot to allow for static binding with Sqlite on Linux.
For self-contained executables. Keep in touch with the timeline / forum.

Sidenote2:
mORMot is not yet 64bit FPC ready.
You still have to compile as 32bit executable on Linux.

Thank you for your efforts and comments ! Right now I could not get CodeTyphon's Typhon64 to cross-compile via FPC32 on CentOS 7. Various packages are missing and I could not find them in CentOS repository. sad

Looking forward to the static binding with SQLite, and 64bit compatibility on Linux !

#177 Re: mORMot 1 » mORMot.pas » 2014-10-25 04:37:06

AOG wrote:

Thanks for your feedback !
Our very nice Linux mORMot needs sqlite3 installed on your system ....
This deadlock happens on systems without sqlite3 !

AOG wrote:

Thank you for testing.
And sorry about this.

On Linux, access to port 888 is limited to root processes.
(and I did perform the tests as root ... so I forgot about it)

I have made another executable, that uses port 8888, that is also available for non-root users.

https://drive.google.com/file/d/0B96fg3 … sp=sharing

Please report ... ;-)

Greetings and good luck.

Using the test executable in your post above, there is still a deadlock even if SQLite has been installed...
Could you help to comment ?

OS: CentOS 7.0 x64
IDE: CodeTyphon Typhon64
mORMot: http://synopse.info/fossil/info/cdc7ed7 … ff5e33226c
SQLite:  (1) Status can be seen from yum. (2) Although it is written as 3.7.17, the library file is "/lib/libsqlite3.so.0.8.6" and "/lib64/libsqlite3.so.0.8.6" and should thus be the latest.

[root@localhost Downloads]# yum info sqlite
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: mirrors.linode.com
 * extras: mirrors.linode.com
 * updates: mirrors.linode.com
Installed Packages
Name        : sqlite
Arch        : i686
Version     : 3.7.17
Release     : 4.el7
Size        : 798 k
Repo        : installed
From repo   : base
Summary     : Library that implements an embeddable SQL database engine
URL         : http://www.sqlite.org/
License     : Public Domain
Description : SQLite is a C library that implements an SQL database engine. A
            : large subset of SQL92 is supported. A complete database is stored
            : in a single disk file. The API is designed for convenience and
            : ease of use. Applications that link against SQLite can enjoy the
            : power and flexibility of an SQL database without the
            : administrative hassles of supporting a separate database server.
            : Version 2 and version 3 binaries are named to permit each to be
            : installed on a single host

Name        : sqlite
Arch        : x86_64
Version     : 3.7.17
Release     : 4.el7
Size        : 795 k
Repo        : installed
From repo   : anaconda
Summary     : Library that implements an embeddable SQL database engine
URL         : http://www.sqlite.org/
License     : Public Domain
Description : SQLite is a C library that implements an SQL database engine. A
            : large subset of SQL92 is supported. A complete database is stored
            : in a single disk file. The API is designed for convenience and
            : ease of use. Applications that link against SQLite can enjoy the
            : power and flexibility of an SQL database without the
            : administrative hassles of supporting a separate database server.
            : Version 2 and version 3 binaries are named to permit each to be
            : installed on a single host

[root@localhost Downloads]# 

#178 Re: mORMot 1 » mORMot.pas » 2014-10-25 04:01:29

Compilation of the "01 - In Memory ORM" succeeds. Congratulations !

However, when I try to add the message, the "name" and the "msg" field are empty.
The "Project01.db" file contains

[
{1,0,"",""},
{2,0,"",""}]

Could you help to comment the reason and the workaround ? smile

OS: CentOS 7.0 x64
IDE: CodeTyphon Typhon64
mORMot: http://synopse.info/fossil/info/cdc7ed7 … ff5e33226c
SQLite:  (1) Status can be seen from yum. (2) Although it is written as 3.7.17, the library file is "/lib64/libsqlite3.so.0.8.6" and should thus be the latest. (3) It does not help to download from the official site and overwrite the one under the lib64 directory (4) It does not help to install also the i686 version from the repository.

[root@localhost ~]# yum info sqlite
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: mirrors.linode.com
 * extras: mirrors.linode.com
 * updates: mirrors.linode.com
Installed Packages
Name        : sqlite
Arch        : x86_64
Version     : 3.7.17
Release     : 4.el7
Size        : 795 k
Repo        : installed
From repo   : anaconda
Summary     : Library that implements an embeddable SQL database engine
URL         : http://www.sqlite.org/
License     : Public Domain
Description : SQLite is a C library that implements an SQL database engine. A
            : large subset of SQL92 is supported. A complete database is stored
            : in a single disk file. The API is designed for convenience and
            : ease of use. Applications that link against SQLite can enjoy the
            : power and flexibility of an SQL database without the
            : administrative hassles of supporting a separate database server.
            : Version 2 and version 3 binaries are named to permit each to be
            : installed on a single host

Available Packages
Name        : sqlite
Arch        : i686
Version     : 3.7.17
Release     : 4.el7
Size        : 396 k
Repo        : base/7/x86_64
Summary     : Library that implements an embeddable SQL database engine
URL         : http://www.sqlite.org/
License     : Public Domain
Description : SQLite is a C library that implements an SQL database engine. A
            : large subset of SQL92 is supported. A complete database is stored
            : in a single disk file. The API is designed for convenience and
            : ease of use. Applications that link against SQLite can enjoy the
            : power and flexibility of an SQL database without the
            : administrative hassles of supporting a separate database server.
            : Version 2 and version 3 binaries are named to permit each to be
            : installed on a single host

[root@localhost ~]# 

#179 Re: mORMot 1 » mORMot.pas » 2014-10-24 05:30:44

ab wrote:

(1) not yet tested on Linux, but it should be possible, since we did it easily with FPC + MingGW under Windows

(2) from the client point of view, nothing changes.

(3) stack trace is not yet available on Linux. Logging works, but should be enhanced.

Many thanks for your comments ! A self-contained executable should be nice. smile

#180 Re: mORMot 1 » mORMot.pas » 2014-10-20 16:25:10

AOG wrote:

Unfortunately I cannot help you ....

I only found this on the web:

https://www.syncovery.com/documentation … t-linuxes/

Few minutes ago, I gave Ab the latest FPC / Linux patches ... so keep in touch with the forum / timeline !

Thank you for your efforts !

Could you help to comment:
(1) whether it is possible to statically link SQLite when mORMot samples are compiled with CodeTyphon on Linux ?
(2) if mORMot is 100% compatible with FPC on Linux, what is the relation between previous ways of writing clients and current ways of writing clients using units under the crossplatform directory ?
(3) Can TSynLog capture the stacktrace if mORMot samples are compiled with CodeTyphon on Linux ?

#181 Re: mORMot 1 » mORMot.pas » 2014-10-18 15:16:48

AOG wrote:

Thanks for your feedback !
Our very nice Linux mORMot needs sqlite3 installed on your system ....
This deadlock happens on systems without sqlite3 !

Do you happen to know how to "install 32 bit sqlite on 64 bit CentOS" ?

#182 Re: mORMot 1 » mORMot.pas » 2014-10-18 02:14:56

AOG wrote:

And .... if you want to test and help ....

An executable for Linux i386: https://drive.google.com/file/d/0B96fg3 … sp=sharing

An executable for Linux ARM: https://drive.google.com/file/d/0B96fg3 … sp=sharing

Both designed for Arch Linux, but I think ok for other Linux systems !


It seems the executable has met some dead lock. Please see the log:

[root@localhost Downloads]# ./testi386 

   Synopse mORMot Framework Automated tests
  ------------------------------------------


1. Synopse libraries

 1.1. Low level common: 
  - System copy record: 20 assertions passed  193us
  - TRawUTF8List: 70,005 assertions passed  48.66ms
  - TDynArray: 1,027,706 assertions passed  312.20ms
  - TDynArrayHashed: 1,200,629 assertions passed  168.29ms
  - TObjectListHashed: 999,758 assertions passed  549.17ms
  - TObjectDynArrayWrapper: 167,501 assertions passed  35.61ms
  - Fast string compare: 7 assertions passed  23us
  - IdemPropName: 30 assertions passed  28us
  - Url encoding: 132 assertions passed  1.82ms
  - GUID: 9,005 assertions passed  7.49ms
  - IsMatch: 599 assertions passed  238us
  - Soundex: 35 assertions passed  46us
  - Numerical conversions: 1,114,439 assertions passed  453.67ms
  - crc32c: 20,020 assertions passed  114.26ms
      pas 33.02ms 180.6 MB/s fast 13.78ms 432.9 MB/s
  - Curr 64: 20,053 assertions passed  3.30ms
  - CamelCase: 11 assertions passed  36us
  - Bits: 4,774 assertions passed  112us
  - Ini files: 7,004 assertions passed  75.85ms
  - UTF8: 82,106 assertions passed  1.12s
  - Iso 8601 date and time: 36,015 assertions passed  5.72ms
  - Url decoding: 1,100 assertions passed  394us
  - Mime types: 23 assertions passed  51us
  - TSynTable: 457 assertions passed  7.71ms
  - TSynCache: 404 assertions passed  215us
  - TSynFilter: 804 assertions passed  4.72ms
  - TSynValidate: 677 assertions passed  935us
  - TSynLogFile: 36 assertions passed  1.32ms
  Total failed: 0 / 4,763,350  - Low level common PASSED  2.91s

 1.2. Cryptographic routines: 
  - Adler32: 1 assertion passed  62us
  - MD5: 1 assertion passed  51us
  - SHA1: 5 assertions passed  58us
  - SHA256: 5 assertions passed  70us
  - AES256: 12,177 assertions passed  976.47ms
  - RC4: 1 assertion passed  34us
  - Base64: 11,994 assertions passed  334.42ms
  - CompressShaAes: 1,683 assertions passed  7.07ms
  Total failed: 0 / 25,867  - Cryptographic routines PASSED  1.31s

 1.3. Compression: 
  - In memory compression: 12 assertions passed  597.78ms
  - GZIP format: 19 assertions passed  1.11s
  - SynLZO: 3,006 assertions passed  173.47ms
  - SynLZ: 21,010 assertions passed  794.32ms
  Total failed: 0 / 24,047  - Compression PASSED  2.68s


2. mORMot

 2.1. File based: 

#183 Re: mORMot 1 » mORMot.pas » 2014-10-18 02:11:48

AOG wrote:

Hello,

You have to configure CodeTyphon to find the include file !

https://drive.google.com/file/d/0B96fg3 … sp=sharing

Add the path to mORMot (the path to synopse.inc) to the include files !!

And please give us a littlebit more time (few days) .... we are fighting with the last few bugs to enable full mORMot on Linux.
It's 99.99% ready now !!

Greetings, Alfred.

First of all, thank you for your excellent work very much ! smile

Thank you for the tip. It should be noted that after CodeTyphon is configured to find the include file, the compilation of the "01 - In Memory ORM" using CodeTyphon 5.0 under CentOS 7.0 still fails but complains about several things:
(1) The case of file name of "SynLZ".
(2) The case of file name of "synopseCommit.inc"
(3) The ambiguity of "W.Add(ID);" in "procedure TSQLPropInfoRTTIID.GetJSONValues" in "mORMot.pas".
(4) The asm in "procedure x64FakeStub; ".

Looking forward to have full mORMot on Linux ! smile

#184 Re: mORMot 1 » mORMot.pas » 2014-10-17 14:11:01

sjerinic wrote:

Is it possible to use mORMot.pas in FPC (Code Typon) on Linux?
Compiler gives me an error: mORMot.pas(1071,2) Fatal: Can not open include file "Synopse.inc". I need to use some functions from mORMot.pas like a JSONFileToObject. Is there any other alternative?

It seems that this issue is not yet solved ? That is to say, attempt to compile "01 - In Memory ORM" using CodeTyphon 5.0 on CentOS 7.0 still fails complaining  mORMot.pas (XXXX,X) Fatal: Can not open include file "Synopse.inc".

I read in other posts that the restful orm works great with all the advances in the FPC compatility. Could you help to comment ? smile

#185 Re: mORMot 1 » Wow! Full FPC support now??!! » 2014-10-15 07:56:13

ab wrote:

You can already retrieve the latest unstable version of the source code tree, and compile it with FPC 2.7.1.
......
But the restful ORM works great, under Linux!

Feel free to post here any question about installation with FPC.

Fantastic news ! Congratulations !

#186 Re: PDF Engine » Is it possible to use SynPdf to produce the given radial gradient ? » 2014-09-26 14:56:31

Dear Arnaud, is it possible for you to implement this feature ?  big_smile

#187 Re: Language » Working with windows logs (tutorial) » 2014-09-19 12:29:59

Thank you for your knowledgeable tutorial and kind sharing !

#190 Re: mORMot 1 » Is it possible to make TSynLog.Enter log the values of arguments ? » 2014-09-11 11:53:08

Thank you for your knowledgeable comments !

I am wondering whether the RTTI brought by latest Delphi has enough information about values of arguments ?

#191 mORMot 1 » Is it possible to make TSynLog.Enter log the values of arguments ? » 2014-09-11 08:21:06

ComingNine
Replies: 4

TSynLog.Enter will automatically log the function names when .map is present, which is very convenient.

I wonder if it is possible to make TSynLog.Enter also log the values of pass-in arguments ? I would think it will promote the productivity a lot. big_smile

#193 Re: Delphi » TSQLTableToDataSet(...) method not present on unit mORmotVCL » 2014-09-09 10:51:25

It seems that there is no such thing as TSQLTableToDataSet in offcial mORMot:

Administrator@WIN-E1EVP9UU0HK /cygdrive/c/DEV/_Delphi_Lib_/mORMot
$ find ./ -name '*.pas'  -print0 | xargs -0 grep -i --color=always -n TSQLTableToDataSet

Administrator@WIN-E1EVP9UU0HK /cygdrive/c/DEV/_Delphi_Lib_/mORMot
$

#194 Re: mORMot 1 » AutoFlushTimeOut has no effect when compiled app runs in non-C drive » 2014-09-09 08:01:19

ab wrote:

In fact, the scroll wheel is used to scroll from one row to another, since it allows to quickly read the full log content of each row in the bottom memo.
When debugging, it is much more convenient than scrolling per page.
This is a log viewer, for debugging, not a text viewer, for reading some text or code.
Purpose of this tool is to debug, not work like editors.

To scroll, you point, click, move and release the scrollbar.
Or you click on the event on the left side, to reach the left event.
Or you enter some text in the search box.

Thank you very much for your comments ! I can see your point !

About the scroll bar appearance (i.e., proportional to the log file length), the code of Chris Luck in http://www.delphigroups.info/2/0e/291440.html seems to work in a simple VCL project. Could you help to comment whether it is possible for LogView to have a proportional scroll bar ?

var 
  ScrollInfo: TScrollInfo; 
  I, J, K: Integer; 
  N1, N2: Double; 
begin 
//  Conditions for proportional thumb :- 
//  1) Take 127 as the *Minimum* value for nMax. 
//  2) nPage = nMax - 126. (for correct thumb positioning) 
//  3) nMax = (127 / (( RowCount / VisibleRowCount ) -1) ) + 127 
  // prevent drawing (WM_SETREDRAW in 'Messages' unit) 
  // or try DoubleBuffering to reduce flicker. 
  SG.Perform(WM_SETREDRAW, 0, 0); 
  try 
    // take a note of TopRow so we can reset it later 
    I := SG.TopRow; 
    // then set TopRow to 0 (no change if already there) 
    SG.TopRow := 0; 
    J := SG.RowCount-SG.FixedRows; 
    K := SG.VisibleRowCount-SG.FixedRows; 
    N1 := (J / K) -1; 
    FillChar(ScrollInfo,SizeOf(ScrollInfo),0); 
    ScrollInfo.cbSize := SizeOf(ScrollInfo); 
    ScrollInfo.fMask := SIF_PAGE; 
    // reset nPage to allow scrollbar to show 
    ScrollInfo.nPage := 0; 
    SetScrollInfo(SG.Handle, SB_VERT, ScrollInfo, false); 
    if N1 > 0.00001 then  // prevent div by 0 
    begin 
      N2 := (127 / N1)+127; 
      ScrollInfo.nMax := Round(N2); 
      ScrollInfo.nMin := 0; 
      ScrollInfo.nPage := ScrollInfo.nMax - 126; 
    end 
    else 
    begin 
      ScrollInfo.nMin := 0; 
      ScrollInfo.nMax := 127; 
      ScrollInfo.nPage := 0; 
    end; 
    ScrollInfo.fMask := SIF_RANGE or SIF_PAGE or SIF_POS; 
    SetScrollInfo(SG.Handle, SB_VERT, ScrollInfo, true); 
    // reset TopRow 
    SG.TopRow := I; 
  finally 
    SG.Perform(WM_SETREDRAW, 1, 0);  // enable drawing 
    SG.Refresh; 
  end; 
end; 

#195 Re: mORMot 1 » mORMot on ARM (RaspberryPi/BBB) » 2014-09-09 07:30:13

ab wrote:

1. There are indeed still dependencies to the Windows unit. So it won't work directly.

2. I'm not sure Delphi XE8 will have a Linux compiler. If you take a look at the pace of the new features in the recent versions of Delphi, and how it was difficult for them to add 64 bit support for Windows (and not yet for OSX), I would be tempted to say end of 2015.

> 1. There are indeed still dependencies to the Windows unit. So it won't work directly.

Oh ! Thank you for your comments ! yikes

> Supporting Linux for server is one of our wishes.
> mORMot code is FPC compatible, now most of it compiles, but we do not have time nor money to finish the port.
> We can buy some cheap Windows hosting, which would cost less money to us than finishing the FPC/Linux port.

Suddenly It feels much less reassuring to use mORMot natively in Linux ... tongue 

> 2. I'm not sure Delphi XE8 will have a Linux compiler. If you take a look at the pace of the new features in the recent versions of Delphi, and how it was difficult for them to add 64 bit support for Windows (and not yet for OSX), I would be tempted to say end of 2015.

Thank you for your comments ! They are doing a good job of pushing Delphi forward. Hope they continue or do even better.

#196 Re: mORMot 1 » AutoFlushTimeOut has no effect when compiled app runs in non-C drive » 2014-09-09 07:16:09

ab wrote:

(1) I can't follow you: you can not, at run-time, delete units from source code which is already compiled...

(2) We use a standard TListBox in virtual mode.
You may help us by proposing some code.

BTW I do not have any middle button in my microsoft mouse. wink
I you meant the "middle wheel", it will scroll from the current selected item. So just click in the list to select one row, then you could use the mouse wheel to scroll.

It was on purpose that we did not change the current selected item when some events come in, but just roll the top item of the list.
In fact, the current selected row is displayed as detail in the memo at the bottom of the form.
If you change the selected row when a new event comes in, you change the memo at the bottom - so you are not able to read it in peace.
We may add a "tracking" checkbox to disable the auto-scroll feature.
Still missing a "Save List" button to save a .log from the incoming events.

If you want to smile, enable the logs in TestSQL3.dpr - you will get a 550 MB of log.
Then try to open it with NotePad2 or UltraEdit, and compare the speed and memory used.


> (1) I can't follow you: you can not, at run-time, delete units from source code which is already compiled...

Sorry for the confusion ! The intent is to be able to log whether there is a LogView (log server) or not. It seems that commenting out the "exit;" in "FormCreate" of "RemoteLogMain.pas" will be enough :

  try
    Screen.Cursor := crHourGlass;
    try
      fClient := TSQLHttpClient.CreateForRemoteLogging(
        AnsiString(edtServer.Text),AnsiString(edtPort.Text),SQLite3Log);
    finally
      Screen.Cursor := crDefault;
    end;
  except
    on E: Exception do begin
      FreeAndNil(fClient);
      MessageDlg(E.Message,mtError,[mbOk],0);
      // exit;
    end;
  end;

Thank you very much for your efforts !

> It was on purpose that we did not change the current selected item when some events come in, but just roll the top item of the list.
> In fact, the current selected row is displayed as detail in the memo at the bottom of the form.
> If you change the selected row when a new event comes in, you change the memo at the bottom - so you are not able to read it in peace.
> We may add a "tracking" checkbox to disable the auto-scroll feature.
> Still missing a "Save List" button to save a .log from the incoming events.

Sorry for the confusion ! I agree with your decision that "auto-scroll" should be disabled so that the log view will not be disturbed by incoming messages. I also agree with you that a choice to enable "auto-scroll" for incoming messages is nice.

Please bear with me and see the following pictures:
The first picture is after I use LogView to open a log file:
sVBRLhP.png?1

An example of my comments of LogView's scrolling behavior: After I use LogView to open a log file, if I scroll the mouse wheel downwards, the listbox selection is being scrolled down instead of the scroll bar. The scroll bar will not move until the listbox selection is moved to the bottom. This is different from UltraEdit or Notepad or Microsoft Word, and thus counter-intuitive. tongue
S7iNmWG.png?1

Another example of my comments of LogView's scrolling behavior: After I use LogView to open a log file, if I use the left mouse button to drag the scroll bar downwards, the picture is shown below.
VKiK216.png?1
Now if I scroll the mouse wheel upwards or downwards, the display will jump to the very beginning because LogView will move the selection. The picture is shown below. However, at this point I normally want to move the display. Again, this is is different from UltraEdit or Notepad or Microsoft Word.
OBOb4vG.png?1

> If you want to smile, enable the logs in TestSQL3.dpr - you will get a 550 MB of log.
> Then try to open it with NotePad2 or UltraEdit, and compare the speed and memory used.

LogView is indeed lightning fast ! Kudos for your work ! ( But It should be noted that UltraEdit is also lightning fast. )
As mentioned above, the scrolling behavior when one scroll the mouse wheel in UltraEdit might be better.
As mentioned in the previous post, making the size of the scroll bar proportional to the log file length (i.e., big scroll bar when small log file is opened) might also be better.

#197 Re: mORMot 1 » mORMot on ARM (RaspberryPi/BBB) » 2014-09-08 21:06:29

ab wrote:

@mpv
Yes, libuv is a very good library, and should be used for mORMotHTTPServer.pas.
But problems about FPC support are much bigger than the HTTP server itself: even SynCommons.pas does not work as expected, due to diverse RTTI, and some other low-level tricks which won't work.
Even CrossKylix/Kylix, which targets Linux and share the same RTTI than Delphi, is not working as expected yet with SynCommons.

@AOG
Under Windows, with current CodeTyphon,  edit2.Text does not contain the expected text, AFAIR.

>
> Even CrossKylix/Kylix, which targets Linux and share the same RTTI than Delphi, is not working as expected yet with SynCommons.
>

Does this mean that even if Delphi XE8 has Linux compiler, we cannot produce mORMot-based binary executables to run in Linux OS ?

#198 Re: mORMot 1 » AutoFlushTimeOut has no effect when compiled app runs in non-C drive » 2014-09-08 20:52:00

Could you help to comment the following two questions ?

(1) In a non-mORMot-based application, I would like to first test if there is a listening LogView (log server). If there is,  in all places of all units of the application, mORMot will be in the uses list, and "SQLite3Log.Add.Enter" and "SQLite3Log.Add.Log(sllInfo" will be used. If there is not, in all places of all units of the application, only SynCommons will be in the uses list, and "var ILog: ISynLog" and "ILog := TSynLog.Enter" and "ILog.Log(sllInfo" will be used. Could you help to comment how to achieve this ?

(2) Could you help to modify (improve) the scroll-bar appearance and the scrolling behavior of LogView.exe ?
Regarding the scroll-bar appearance, from the pictures below, when UltraEdit or Notepad2 loads the same log file, the scroll bar is much larger than the one of LogView.exe.
Regarding the scrolling behavior, when the middle mouse button is scrolled, UltraEdit or Notepad2 will move the scroll-bar and not move the cursor. However, LogView.exe will move the cursor (and moves the scroll-bar based on the position of the cursor). This can be less comfortable, for example, when a large log file is loaded by LogView.exe, when I use the left mouse button to drag the scroll-bar down hundreds of lines, and then scroll the middle mouse button, the scroll-bar  suddenly jumps to the very beginning. For another example, if one wants to scroll down the view by scrolling the middle mouse button, one has to scroll multiple times because the cursor has to move from the beginning to the end of the  view.
Could you help to comment how to make the LogView.exe's scroll-bar similar to Notepad2's, and to make the LogView.exe's scrolling behavior similar to Notepad2's ?
w6kRIzp.png
8gDccdw.png

#199 Re: mORMot 1 » AutoFlushTimeOut has no effect when compiled app runs in non-C drive » 2014-09-08 20:26:52

ab wrote:

I've committed the remaining work.
See the latest commits of http://synopse.info/fossil/timeline

Introducing TSQLRest.Log() support for our cross-platform client units
  *  either logging to a file, in the same format than TSynLog / LogView
  *  or logging to a remote log server, e.g. our LogView tool running in server mode
  *  all ORM and SOA client methods will now use this logging abilities to trace the process
  *  tested with Delphi, FPC or SmartMobileStudio clients (only remote logs are allowed for SMS, since there is no file access from an HTML5 app)

Performance is very good, since several rows of logging can be gathered in one REST call.
This makes it pretty fast, especially with remote AJAX clients...
And under Win32/Win64, all sending is handled in a background thread.


  Really amazing work !!

  The "11 - Exception logging" sample compiles and runs smoothly. And a live show from a listening LogView.exe looks almost the same as what is shown when the log file is opened by LogView.exe.
w6kRIzp.png

Board footer

Powered by FluxBB