mORMot2 icon indicating copy to clipboard operation
mORMot2 copied to clipboard

Error E2065 'memchr' in mormot.db.raw.sqlite3.static.pas with Delphi 12.2 64-bit Compilation

Open flydev-fr opened this issue 1 year ago • 4 comments

Description:

When compiling a 64-bit project with Delphi 12.2 using the latest 2.3.stable static binaries, i get the following error:

[dcc64 Error] mormot.db.raw.sqlite3.static.pas(1323): E2065 Unsatisfied forward or external declaration: 'memchr'

This issue does not occur in 32-bit compilation, only in 64-bit compilation.

flydev-fr avatar Oct 19 '24 21:10 flydev-fr

Did you also update the pascal sources?

synopse avatar Oct 20 '24 14:10 synopse

Yes, I removed everything, downloaded new pascal sources and binaries from release page then compiled mormot2test.

I get the issue on delphi 64-bit compilation only.

  • no issue on delphi 32-bit
  • no issue with fpc on 32-bit and 64-bit

If I put sqlite 3.44.2 (from mormot v2.2), compilation is ok but I get the expected: warning Linked version is 3.44.2 whereas the current/expected is 3.46.1

ps: I just did it again to triple check, same issue.

flydev-fr avatar Oct 20 '24 15:10 flydev-fr

I also just tested with dynamic lib on mvc-blog sample; By commenting raw.sqlite3.static and compiling for 64-bit, it's ok. (I downloaded precompiled binaries for Windows 64-bit from sqlite.org)

uses
  ...
    //mormot.db.raw.sqlite3.static,
  ...
  
begin
  sqlite3 := TSqlite3LibraryDynamic.Create('sqlite3.dll');
  ...


It works also using sqlite3-64.dll from static binaries 7z archive.

flydev-fr avatar Oct 20 '24 15:10 flydev-fr

just in case, my only way to compile for 64-bit is to leave memchr implementation from mormot.db.raw.sqlite3.static.pas (permalink)

{$endif CPU32} // <-- 

function memchr(p: pointer; c: byte; n: PtrInt): PAnsiChar; cdecl;
...

I then could compile mormot2test and all tests passed.

I was going to try to go deeper but i am not able to install c++builder as emb. getit server return error 500..

flydev-fr avatar Oct 21 '24 11:10 flydev-fr

I am sorry, I am not able to easily make commits from where I am, because I don't have the right computer - I am on holidays in Danemark to give some conference sessions about mORMot.

Could you create a Pull Request just moving the CPU32 endif above, as you did? It seems the right temporary fix.

synopse avatar Oct 23 '24 09:10 synopse

there's no hurry, I was just pointing out the problem :)

(I will create the PR in about 30 minutes, thank!)

flydev-fr avatar Oct 23 '24 09:10 flydev-fr