#1 2020-05-16 12:42:43

array81
Member
From: Italy
Registered: 2010-07-23
Posts: 411

Cannot compile last timeline version

After a long time I have try to upgrade my Synopse with last timeline version (2020-05-14 16:06:21).

On Delphi 10.3 I get these errors:

[dcc32 Error] SyNodeRemoteDebugger.pas(224): E2003 Undeclared identifier: 'SafePush'
[dcc32 Error] SyNodeRemoteDebugger.pas(525): E2003 Undeclared identifier: 'SafePush'
[dcc32 Error] SyNodeRemoteDebugger.pas(602): E2003 Undeclared identifier: 'SafeClear'
[dcc32 Error] SyNodeRemoteDebugger.pas(603): E2003 Undeclared identifier: 'SafeClear'
[dcc32 Error] SyNodeRemoteDebugger.pas(620): E2010 Incompatible types: 'TRawUTF8ListLocked' and 'TRawUTF8List'
[dcc32 Error] SyNodeRemoteDebugger.pas(621): E2010 Incompatible types: 'TRawUTF8ListLocked' and 'TRawUTF8List'
[dcc32 Error] SyNodeRemoteDebugger.pas(683): E2003 Undeclared identifier: 'SafeClear'
[dcc32 Error] SyNodeRemoteDebugger.pas(684): E2003 Undeclared identifier: 'SafeClear'
[dcc32 Error] SyNodeRemoteDebugger.pas(777): E2003 Undeclared identifier: 'SafePop'
[dcc32 Error] SyNodeRemoteDebugger.pas(777): E2015 Operator not applicable to this operand type
[dcc32 Error] SyNodeRemoteDebugger.pas(777): E2015 Operator not applicable to this operand type
[dcc32 Fatal Error] SyNode.pas(1319): F2063 Could not compile used unit 'SyNodeRemoteDebugger.pas'

Offline

#2 2020-05-17 17:42:36

mpv
Member
From: Ukraine
Registered: 2012-03-24
Posts: 1,534
Website

Re: Cannot compile last timeline version

@array81 - wokring SyNode version is currently in feature/synodeCleanup brunch. I try to keep it in sync with master..

Offline

#3 2020-05-19 21:21:59

array81
Member
From: Italy
Registered: 2010-07-23
Posts: 411

Re: Cannot compile last timeline version

mpv wrote:

@array81 - wokring SyNode version is currently in feature/synodeCleanup brunch. I try to keep it in sync with master..

I have try to use https://github.com/synopse/mORMot/tree/ … odeCleanup but this is the result:

[dcc32 Error] SpiderMonkey.pas(600): E2398 Class methods in record types must be static
[dcc32 Error] SpiderMonkey.pas(601): E2398 Class methods in record types must be static
[dcc32 Error] SpiderMonkey.pas(602): E2398 Class methods in record types must be static
[dcc32 Error] SpiderMonkey.pas(603): E2398 Class methods in record types must be static
[dcc32 Error] SpiderMonkey.pas(604): E2398 Class methods in record types must be static
[dcc32 Error] SpiderMonkey.pas(605): E2398 Class methods in record types must be static
[dcc32 Error] SpiderMonkey.pas(606): E2398 Class methods in record types must be static
[dcc32 Error] SpiderMonkey.pas(607): E2398 Class methods in record types must be static
[dcc32 Error] SpiderMonkey.pas(609): E2398 Class methods in record types must be static
[dcc32 Error] SpiderMonkey.pas(2026): E1030 Invalid compiler directive: 'external'
[dcc32 Error] SpiderMonkey.pas(2026): E2029 ',' or ':' expected but identifier 'name' found
[dcc32 Error] SpiderMonkey.pas(2028): E2070 Unknown directive: 'JS_DisableExtraThreads'
[dcc32 Error] SpiderMonkey.pas(2029): E2004 Identifier redeclared: 'external'
[dcc32 Error] SpiderMonkey.pas(2029): E2029 ',' or ':' expected but identifier 'name' found
[dcc32 Error] SpiderMonkey.pas(2043): E2029 Type expected but 'TYPE' found
[dcc32 Error] SpiderMonkey.pas(2044): E1030 Invalid compiler directive: 'external'
[dcc32 Error] SpiderMonkey.pas(2044): E2029 ',' or ':' expected but identifier 'name' found
[dcc32 Error] SpiderMonkey.pas(2047): E2029 Type expected but 'TYPE' found
[dcc32 Error] SpiderMonkey.pas(2048): E1030 Invalid compiler directive: 'external'
[dcc32 Error] SpiderMonkey.pas(2048): E2029 ',' or ':' expected but identifier 'name' found
[dcc32 Error] SpiderMonkey.pas(2051): E2029 Type expected but 'TYPE' found
[dcc32 Error] SpiderMonkey.pas(2052): E1030 Invalid compiler directive: 'external'
[dcc32 Error] SpiderMonkey.pas(2052): E2029 ',' or ':' expected but identifier 'name' found
[dcc32 Error] SpiderMonkey.pas(2055): E2029 Type expected but 'TYPE' found
[dcc32 Error] SpiderMonkey.pas(2056): E1030 Invalid compiler directive: 'external'
[dcc32 Error] SpiderMonkey.pas(2056): E2029 ',' or ':' expected but identifier 'name' found
[dcc32 Error] SpiderMonkey.pas(2060): E2029 Type expected but 'TYPE' found
[dcc32 Error] SpiderMonkey.pas(2061): E1030 Invalid compiler directive: 'external'
[dcc32 Error] SpiderMonkey.pas(2061): E2029 ',' or ':' expected but identifier 'name' found
[dcc32 Error] SpiderMonkey.pas(2065): E2029 Type expected but 'TYPE' found
[dcc32 Error] SpiderMonkey.pas(2066): E1030 Invalid compiler directive: 'external'
[dcc32 Error] SpiderMonkey.pas(2066): E2029 ',' or ':' expected but identifier 'name' found
[dcc32 Error] SpiderMonkey.pas(2069): E2029 Type expected but 'TYPE' found
[dcc32 Error] SpiderMonkey.pas(2072): E1030 Invalid compiler directive: 'external'
[dcc32 Error] SpiderMonkey.pas(2072): E2029 ',' or ':' expected but identifier 'name' found
[dcc32 Error] SpiderMonkey.pas(2074): E2029 Type expected but 'TYPE' found
[dcc32 Error] SpiderMonkey.pas(2075): E1030 Invalid compiler directive: 'external'
[dcc32 Error] SpiderMonkey.pas(2075): E2029 ',' or ':' expected but identifier 'name' found
[dcc32 Fatal Error] SpiderMonkey.pas(2075): E2226 Compilation terminated; too many errors

Offline

#4 2020-06-02 18:02:28

mpv
Member
From: Ukraine
Registered: 2012-03-24
Posts: 1,534
Website

Re: Cannot compile last timeline version

The only supported targets for this brunch is FPC 3.2.0 x64 Linux (cross compile to Windows). Sorry, I don’t have the resources to support anything else

Offline

#5 2020-08-16 14:10:37

ComingNine
Member
Registered: 2010-07-29
Posts: 294

Re: Cannot compile last timeline version

Is there any news on this ? As @array81 reported, latest mORMot and SyNode are incompatible with each other when Delphi is used.

Offline

#6 2020-08-16 17:22:42

ComingNine
Member
Registered: 2010-07-29
Posts: 294

Re: Cannot compile last timeline version

The following regex could be helpful to alleviate the burden to support Delphi compatibility of SpiderMonkey.pas

(?gs)type\s([_A-Za-z]+)\s*=\s*(function|procedure)(.*?cdecl;)\s*var(\s[_A-Za-z]+):\s*([_A-Za-z]+)\s(external.*?;)

See also the online tester

Offline

#7 2020-08-17 06:03:40

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

Re: Cannot compile last timeline version

Nice rexex!

cool

Offline

#8 2020-08-17 10:27:42

mpv
Member
From: Ukraine
Registered: 2012-03-24
Posts: 1,534
Website

Re: Cannot compile last timeline version

I can resolve an error "Class methods in record types must be static" - it's not a problem.

Problem is about E1030 Invalid compiler directive: 'external'

SpiderMonkey itself is a C++, so we need to export a C++ function as a cdecl.
To avoid unnecessary function call we export a variable what contains pointer to a C++ function from our wrapper - see synsm.h line 10 for example as such:

extern "C" {
  JS_PUBLIC_API(bool) (*SM_Initialize)(void) = &JS_Init;

SM_Initialize is a pointer to a function.

And when import it in the SpiderMonkey.pas using

type TJS_Initialize = function : Boolean; cdecl;
var JS_Init: TJS_Initialize external SpiderMonkeyLib name 'SM_Initialize';

I don't know how to do such in Delphi.

Last edited by mpv (2020-08-17 10:29:30)

Offline

#9 2020-08-17 11:19:56

ComingNine
Member
Registered: 2010-07-29
Posts: 294

Re: Cannot compile last timeline version

If the following two code blocks are equivalent to each other, the regex posted above could be used to automatically transform the hundreds of declarations in SpiderMonkey.pas big_smile

current

type TJS_Initialize = function : Boolean; cdecl;
var JS_Init: TJS_Initialize external SpiderMonkeyLib name 'SM_Initialize';

Delphi compatible

function SM_Initialize: Boolean; cdecl; external SpiderMonkeyLib name 'SM_Initialize';
type TJS_Initialize = function : Boolean; cdecl;
var JS_Init: TJS_Initialize = SM_Initialize; // external SpiderMonkeyLib name 'SM_Initialize';

Last edited by ComingNine (2020-08-17 11:21:14)

Offline

#10 2020-08-17 12:47:04

mpv
Member
From: Ukraine
Registered: 2012-03-24
Posts: 1,534
Website

Re: Cannot compile last timeline version

@ComingNine - `SM_Initialize` exported by SpiderMonkeyLib is a pointer to function, not a function. So

function SM_Initialize: Boolean; cdecl; external SpiderMonkeyLib name 'SM_Initialize';

not works (at last in FPC I got AV).
Did you verify your code in Delphi? It's work?

Offline

#11 2020-08-17 13:13:41

ComingNine
Member
Registered: 2010-07-29
Posts: 294

Re: Cannot compile last timeline version

Thank you for your efforts ! IIRC, to realize a pointer to external function in Delphi (and FPC as well), one does not use external keyword but SafeLoadLibrary followed by GetProcAddress. I have to try and return.

Last edited by ComingNine (2020-08-17 13:14:27)

Offline

Board footer

Powered by FluxBB