#1 2019-09-19 09:03:11

johnnysynop
Member
Registered: 2018-07-01
Posts: 29

Delphi 64bit sqlite compilation

@ab Are you going to support oficially? Why only FPC x64 build is supported?
I need static linking of 64 bit obj, does anyone have?

Offline

#2 2019-09-19 10:40:00

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

Re: Delphi 64bit sqlite compilation

This is a Delphi linker issue.
It is not able to link properly .o files as generated by gcc.

Offline

#3 2019-09-19 13:00:59

johnnysynop
Member
Registered: 2018-07-01
Posts: 29

Re: Delphi 64bit sqlite compilation

ab wrote:

This is a Delphi linker issue.
It is not able to link properly .o files as generated by gcc.

What about BCC 64? For those who has license on BCC it will be still useful.
Is there any technical problem with embarcadero c++ compiler x64 for sqlite object?

Offline

#4 2019-09-19 14:34:10

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

Re: Delphi 64bit sqlite compilation

I don't have any Bcc64 licence, so I can't use it.

Offline

#5 2019-09-19 21:06:05

Greg0r
Member
Registered: 2019-01-28
Posts: 48

Re: Delphi 64bit sqlite compilation

@ab what about vc++ express and coff/comm converter?

Offline

#6 2019-09-20 09:38:40

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

Re: Delphi 64bit sqlite compilation

IIRC the problem was not about object file format, but reference linking issues.

Offline

#7 2019-09-20 12:01:21

pvn0
Member
From: Slovenia
Registered: 2018-02-12
Posts: 209

Re: Delphi 64bit sqlite compilation

I used to have this problem then I moved to FPC, problem solved big_smile

Offline

#8 2019-09-20 12:29:17

Greg0r
Member
Registered: 2019-01-28
Posts: 48

Re: Delphi 64bit sqlite compilation

Please understand guys that it's not matter loving one or another but matter of business choices I like both FPC and Delphi the same.
Lack of full 64 bit support with static linking and encryption in SQLite is big pain in ass and makes such wonderful product like mormot little "retarded"

So if there is technical issue with object build let's open fund for @ab Arnaud and he will buy C++ builder compiler and make 64 bit version.

Last edited by Greg0r (2019-09-21 12:27:44)

Offline

#9 2019-09-20 20:07:45

emk
Member
Registered: 2013-10-24
Posts: 96

Re: Delphi 64bit sqlite compilation

@ab

mORMot is a open-source project, so you can use C++ Builder Community Edition.

Offline

#10 2019-09-20 20:11:57

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

Re: Delphi 64bit sqlite compilation

The 10.3 community edition is using LLVM for Win64, so it would increase the problems in respect to the older bcc64 - at least this is what occurred last time I tried.
I will try doing something with an older bcc64 command line compiler I have available somewhere.

AFAIR there was some linking problem, but I will try to fix it.

Stay tuned!

Offline

#11 2019-09-20 20:48:10

johnnysynop
Member
Registered: 2018-07-01
Posts: 29

Re: Delphi 64bit sqlite compilation

@ab, what a wonderfull news!
Just my suggestion - I would use 10.3.2 don't worry about older bcc64, if there is community edition for free now (finally) old licensed users of BCC 64 can download new.
I think in this case trying to satifying all could be not good idea.
I'd go with option of using latest LLVM from 10.3.2 community, I don't think it could be the problem for those who really need it will buy new version.
As Mormot is free project it should care more about free compilers rather than older which were paid.
Free is from 10.x v.

C++ compiler which is known from very serious bugs in the past first of x64 versions do another reason to use latest.

Last edited by johnnysynop (2019-09-20 20:49:42)

Offline

#12 2019-09-21 09:10:47

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

Re: Delphi 64bit sqlite compilation

Some results:

Windows 10 64bit (10.0.18362) (cp1252)
    4 x Intel(R) Core(TM) i7-3517U CPU @ 1.90GHz (x64)
Using mORMot 1.18.5367 PRTL
    TSQLite3LibraryStatic 3.29.0 with internal MM
Generated with: Delphi 10.3 Rio 64 bit compiler

Time elapsed for all tests: 1m31
Performed 2019-09-21 11:09:03 by User on ACER

Total assertions failed for all test suits:  0 / 41,852,771
! All tests passed successfully.

And encryption seemed to work as expected!

 2.9. External database:
  - TQuery: 2,003 assertions passed  19.47ms
  - SynDBRemote: 42,707 assertions passed  395.04ms
  - DB properties persistence: 7 assertions passed  1.22ms
  - External records: 2 assertions passed  290us
  - Auto adapt SQL: 942 assertions passed  7.40ms
  - Crypted database: 253,277 assertions passed  164.36ms
  - External via REST: 170,355 assertions passed  916.07ms
  - External via virtual table: 170,355 assertions passed  1.93s
  - External via REST with change tracking: 180,455 assertions passed  2.71s
  Total failed: 0 / 820,103  - External database PASSED  6.15s

I have committed it, with a dedicated sqlite3.o static file for Delphi+Win64.
It is now included in https://github.com/synopse/mORMot or you need to download again
smile

See http://blog.synopse.info/post/2019/09/2 … lphi-Win64

Offline

#13 2019-09-21 11:12:34

Vitaly
Member
From: UAE
Registered: 2017-01-31
Posts: 168
Website

Re: Delphi 64bit sqlite compilation

Nice! smile Thank you!

Offline

#14 2019-09-21 12:54:19

Greg0r
Member
Registered: 2019-01-28
Posts: 48

Re: Delphi 64bit sqlite compilation

Fantastic! Thank you so much..
1) Successfully build with bcc64 7.40 from 10.3 Community with warnings and without -6 switch
https://i.imgur.com/8d0jkGL.png
2) While build Delphi mormot sample and 64 bit .o build above, following errs:
[dcc64 Error] SynSQLite3Static.pas(1279): E2065 Unsatisfied forward or external declaration: '_FInf'
[dcc64 Error] SynSQLite3Static.pas(1279): E2065 Unsatisfied forward or external declaration: '_Log'
[dcc64 Fatal Error] TestSQL3.dpr(874): F2063 Could not compile used unit 'SynSQLite3Static.pas'

Last edited by Greg0r (2019-09-21 12:55:39)

Offline

#15 2019-09-22 07:30:23

pvn0
Member
From: Slovenia
Registered: 2018-02-12
Posts: 209

Re: Delphi 64bit sqlite compilation

That's so awesome, thanks ab!

Offline

#16 2019-09-22 20:20:33

emk
Member
Registered: 2013-10-24
Posts: 96

Re: Delphi 64bit sqlite compilation

smile Thank you!

Offline

#17 2019-09-22 23:20:14

profh
Member
Registered: 2010-07-02
Posts: 159

Re: Delphi 64bit sqlite compilation

@ab, thanks, and you are my hero.

Offline

#18 2019-09-23 09:50:02

johnnysynop
Member
Registered: 2018-07-01
Posts: 29

Re: Delphi 64bit sqlite compilation

profh wrote:

@ab, thanks, and you are my hero.

mORMot king is getting even better now, wonderful. Thank you Arnaud.
Yes @ab is the boss, it reminds me this /watch?v=kKR1rrjvq-I  from 1:36 to 1:41

BTW: Will it work with Community edition of c++ compiler?

Offline

#19 2019-09-23 10:30:22

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

Re: Delphi 64bit sqlite compilation

I used a XE7 bcc64 compiler.

Currently, the LLVM-based compiler (the one from 10.3) is not supported, so the Community edition will fail linking, as reported by Greg0r https://synopse.info/forum/viewtopic.ph … 241#p30241
Perhaps it may give better performance - even if we need real timing, not just marketing stuff.

IIRC I can't install Delphi and C++ Builder Community editions at the same time on the same machine.
This is why I didn't try to install it yet... building a VM just for a compiler is not worth it...

Offline

#20 2019-09-23 14:24:03

Greg0r
Member
Registered: 2019-01-28
Posts: 48

Re: Delphi 64bit sqlite compilation

Yes, indeed preety strange that there is no RAD studio community and problem with installing both at same time.
Do you think sharing files would work? I could pack installed folder od 10.3 free and share archive for "lend"/test.

Offline

#21 2019-09-24 08:48:34

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

Re: Delphi 64bit sqlite compilation

Yes, I guess you could try to find out the correct files in the "bin" and "include" sub-folders...
Then send me an email with the link.

Offline

#22 2019-09-24 09:46:36

Greg0r
Member
Registered: 2019-01-28
Posts: 48

Re: Delphi 64bit sqlite compilation

@ab, check msg

Offline

#23 2019-09-24 11:07:15

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

Re: Delphi 64bit sqlite compilation

I am looking into it now.

Offline

#24 2019-09-24 12:57:10

Greg0r
Member
Registered: 2019-01-28
Posts: 48

Re: Delphi 64bit sqlite compilation

Ok thank you

Offline

#25 2019-09-24 13:56:23

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

Re: Delphi 64bit sqlite compilation

I was able to compile using the latest LLVM compiler, and let it link:

Windows 10 64bit (10.0.18362) (cp1252)
    4 x Intel(R) Core(TM) i7-3517U CPU @ 1.90GHz (x64)
Using mORMot 1.18.5377
    TSQLite3LibraryStatic 3.29.0 with internal MM
Generated with: Delphi 10.3 Rio 64 bit compiler

Time elapsed for all tests: 1m34
Performed 2019-09-24 15:54:15 by User on ACER

Total assertions failed for all test suits:  0 / 41,854,545
! All tests passed successfully.

So it seems not faster than the XE7 compiler.
But I guess I will use it, since you made a simple cut-down version of the command-line compiler, very easy to work with!

I will post the new sqlite3.o now.

Offline

#26 2019-09-24 14:18:57

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

Re: Delphi 64bit sqlite compilation

One issue is that with Delphi XE4 Win64, I have the following error with I use the LLVM-compiler Sqlite3.o:

Embarcadero Delphi for Win64 compiler version 25.0
Copyright (c) 1983,2013 Embarcadero Technologies, Inc.
D:\Dev\Lib\SynSQLite3Static.pas(1278) Fatal: F2084 Internal Error: URW1154

No problem with XE6:

Windows 10 64bit (10.0.18362) (cp1252)
    4 x Intel(R) Core(TM) i7-3517U CPU @ 1.90GHz (x64)
Using mORMot 1.18.5377
    TSQLite3LibraryStatic 3.29.0 with internal MM
Generated with: Delphi XE6 64 bit compiler

Time elapsed for all tests: 1m44
Performed 2019-09-24 16:16:09 by User on ACER

Total assertions failed for all test suits:  0 / 41,850,842
! All tests passed successfully.

Or XE7:

Windows 10 64bit (10.0.18362) (cp1252)
    4 x Intel(R) Core(TM) i7-3517U CPU @ 1.90GHz (x64)
Using mORMot 1.18.5377
    TSQLite3LibraryStatic 3.29.0 with internal MM
Generated with: Delphi XE7 64 bit compiler

Time elapsed for all tests: 1m48
Performed 2019-09-24 16:18:29 by User on ACER

Total assertions failed for all test suits:  0 / 41,852,585
! All tests passed successfully.

(see above for the Delphi 10.3 CE)

Note that the "time elapsed for all tests" above is not very consistent, and should not be taken as a proof of the performance of each compiler, since I did some other things in parallel on my computer, so a few seconds difference seems as expected.

Please check https://synopse.info/fossil/info/753c2bbe1d

Offline

#27 2019-09-24 15:03:05

Greg0r
Member
Registered: 2019-01-28
Posts: 48

Re: Delphi 64bit sqlite compilation

Quick test, No problem noticed with Delphi 10.3.2 will continue testing.

Using mORMot 1.18.5378
    TSQLite3LibraryStatic 3.29.0 with internal MM
Generated with: Delphi 10.3 Rio 64 bit compiler

Time elapsed for all tests: 1m01
Performed 2019-09-24 16:54:48 by Greg0r on DESKTOP-GR

As for noticed problems looks like .o from new compiler must be used with XE6+ without issues
Anyway great results and lot of Delphi's are covered assuming usage of both "normal" and newer llvm compiler.

Last edited by Greg0r (2019-09-24 15:11:38)

Offline

#28 2019-09-24 20:58:20

Eugene Ilyin
Member
From: milky_way/orion_arm/sun/earth
Registered: 2016-03-27
Posts: 132
Website

Re: Delphi 64bit sqlite compilation

ab, Greg0r,

I have a slightly different issue compared to Greg0r's 30241#p30241 on the most recent 1.18.5378 version with Delphi 10.3 Update 2 on Windows 64-bit target platform and sqlite3.o file taken from https://synopse.info/files/sqlite3obj.7z as it mentioned on Blog's article and the Download section.

The missed declarations are slightly different (for example log instead of _log):

[dcc64 Error] SynSQLite3Static.pas(1277): E2065 Unsatisfied forward or external declaration: '_fltused'
[dcc64 Error] SynSQLite3Static.pas(1277): E2065 Unsatisfied forward or external declaration: 'log'
[dcc64 Fatal Error] F2063 Could not compile used unit 'SynSQLite3Static.pas'

The sqlite3obj.7z archive contains sqlite3.o file modified Sep 20, 2019 (4 days ago).

ab is Sep 20 is the recent compiled sqlite3.o available (because you modified SynSQLite3Static code yesterday, Sep 23)?

I suggest to keep both declaration variants to support both compilers for the current available sqlite3.o
All that is needed is to add the next lines:

SynSQLite3Static.pas: 728

Before

function _log(x: double): double; cdecl; export;
begin
  result := ln(x);
end;

After

function _log(x: double): double; cdecl; export;
begin
  result := ln(x);
end;

function log(x: double): double; cdecl; export;
begin
  result := ln(x);
end;

SynSQLite3Static.pas: 751

Before

var
  _finf: double = 1.0 / 0.0; // compiles to some double infinity constant

After

var
  _finf: double = 1.0 / 0.0; // compiles to some double infinity constant

  _fltused: uint64 = 0; // required for linking with old non-LLVM bcc64 compiler

With these two small additions the compilations of 1.18.5378 with downloaded sqlite3.o under Delphi 10.3 Update 2 Windows 64-bit platform goes without errors.

Last edited by Eugene Ilyin (2019-09-24 22:47:06)

Offline

#29 2019-09-24 23:41:53

Greg0r
Member
Registered: 2019-01-28
Posts: 48

Re: Delphi 64bit sqlite compilation

@Eugene Ilyin,

Nice addition anyway hmm strange for me works without this mod with D10.3.2 x64 under Win10x64 on .o included in .5378 as well in my own build of sqlite.o with bcc64 llvm

Offline

#30 2019-09-25 07:58:31

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

Re: Delphi 64bit sqlite compilation

Oups.... I guess I forgot to upload the new sqlite3.o file in https://synopse.info/files/sqlite3obj.7z
Should be available now.
Sorry!

I also added compatibility to link old non-LLVM bcc64 compiler in https://synopse.info/fossil/info/e3441c9689 as @Eugene proposed.

Offline

#31 2019-09-25 10:03:57

Eugene Ilyin
Member
From: milky_way/orion_arm/sun/earth
Registered: 2016-03-27
Posts: 132
Website

Re: Delphi 64bit sqlite compilation

ab,

Confirmed. Thanks!
With updated sqlite3.o all compiled as expected.

Offline

#32 2020-01-15 11:05:46

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

Re: Delphi 64bit sqlite compilation

Hello ab,

I'm getting a "[dcc64 Fatal Error] F2084 Internal Error: AV0858E903-R343E15EC-0" error when trying to compile with XE4/Win64.
I'm wondering if there is a any workaround, I'm currently using dynamic linking (.dll)? I'm using the latest github repository committed on  Jan 14, 2020.
Thanks.

Last edited by edwinsn (2020-01-15 11:43:33)


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

Offline

#33 2020-01-15 13:35:46

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

Re: Delphi 64bit sqlite compilation

This is sadly a XE4 bug for Win64.
I was not able to find out what was wrong during linking - I tested with XE7 and later with no problem.

The only workaround I know is indeed to use dynamic linking with an external .dll - or switch to FPC or a newer Delphi compiler.

Offline

#34 2020-01-15 15:00:31

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

Re: Delphi 64bit sqlite compilation

@ab,

No problem, I'll use dynamic linking for now.


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

Offline

#35 2020-01-15 16:52:09

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

Re: Delphi 64bit sqlite compilation

We still keep in synch the Win64 .dll with the latest SQLite3 stable version, as the static version.
But you loose the ability to encrypt the DB file... sad

Offline

#36 2020-01-15 17:52:16

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

Re: Delphi 64bit sqlite compilation

In this case I don't need to encrypt the sqlite db file, I guess I don't lose any other features aside from slightly slower performance, right?

BTW, for dynamic linking I should download the sqlite3.dll from sqlite.org but not from somewhere on synopse.info, right?


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

Offline

#37 2020-01-16 14:26:37

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

Re: Delphi 64bit sqlite compilation

If you use the one from synopse.info, you will have the same SQLite3 conditionals than with the static version, so it could help in some cases.

Offline

#38 2020-01-16 17:47:57

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

Re: Delphi 64bit sqlite compilation

Thank you, ab.
I downloaded sqlite3-64.dll from http://synopse.info/files/SQLite3-64.7z, and found it's 600+KB smaller than the official one from sqlite.org, not sure why. I assume it has all the FTS4/5 and json1, right?


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

Offline

#39 2020-01-17 09:47:57

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

Re: Delphi 64bit sqlite compilation

IIRC we use VC++ RTL library for some part, so it may be smaller for this reason.
FTS and JSON1 are included in our DLL.
Just the same conditionals than the static .o/.obj - except the encryption.

Offline

Board footer

Powered by FluxBB