#1 2019-10-13 16:07:11

lvaskov
Member
Registered: 2019-10-13
Posts: 3

Access violation with FPC 3.3.1

Hi,

I tried to run the example project "14 - Interface based services\Project14ServerHttp" on a Raspberry Pi 3B+.

Using fpcupdeluxe, I installed the recommended versions of FPC trunk (rev. 40491) and Lazarus (2.1.0, rev. 59757) on Windows, the cross compiler for Linux/arm, the latest mORMot.

The project builds successfully, but there is an exception at the initialization of the application when I run it on the Pi:

An unhandled exception occurred at $000A34EC:
EAccessViolation: Access violation
  $000A34EC  GETENUMNAME,  line 21167 of C:/FreePascal/ccr/mORMot/SynCommons.pas
  $000ADDD0  TOTEXT,  line 26120 of C:/FreePascal/ccr/mORMot/SynCommons.pas
  $000ADF8C  SETLINUXDISTRIB,  line 26308 of C:/FreePascal/ccr/mORMot/SynCommons.pas
  $000AE6E0  RETRIEVESYSTEMINFO,  line 26386 of C:/FreePascal/ccr/mORMot/SynCommons.pas
  $00133C84  SYNCOMMONS_$$_init$,  line 62842 of C:/FreePascal/ccr/mORMot/SynCommons.pas
  $00033260

Looks like the problem is in getting the type info of enumeration types.

Next I tried to change the code that is in SynCommons.pas in the GetEnumInfo function and call the standard FPC function TypeInfo(aTypeInfo) instead of the mORMot one GetTypeInfo(aTypeInfo).
Looks like it fixed this issue, but another one appears after that and it is a problem with interfaces type info:

An unhandled exception occurred at $001F11C4:
EInterfaceResolverException: TInterfaceResolverInjected.RegisterGlobal(): TAutoLocker does not implement AutoLocker`g0CUtdJr]
SynCommons2
                TA
  $001F11C4  TINTERFACERESOLVERINJECTED__REGISTERGLOBALCHECK,  line 58096 of C:/FreePascal/ccr/mORMot/SQLite3/mORMot.pas
  $001F13B8  TINTERFACERESOLVERINJECTED__REGISTERGLOBAL,  line 58114 of C:/FreePascal/ccr/mORMot/SQLite3/mORMot.pas
  $00207FD0  MORMOT_$$_init$,  line 62974 of C:/FreePascal/ccr/mORMot/SQLite3/mORMot.pas
  $00033260

As you can see the interface IAutoLocker has its type info wrong and causes the check to fail.

Did I stumble on a bug or is there some setting or compiler directive that I've missed?

Last edited by lvaskov (2019-10-13 16:11:56)

Offline

#2 2019-10-13 17:17:20

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

Re: Access violation with FPC 3.3.1

Yes, there is currently a regression for ARM. It is due to RTTI changes in the trunk.

Please note that GetTypeInfo() is not at all replaceable by TypeInfo(). In fact, it uses  GetTypeInfo(TypeInfo(....)) kind of call.

Alfred is working on it - and I will do it if he can't.

Offline

#3 2019-10-13 19:07:55

lvaskov
Member
Registered: 2019-10-13
Posts: 3

Re: Access violation with FPC 3.3.1

OK, thank you, I will wait for the fix.

Offline

#4 2019-10-18 10:40:46

ttomas
Member
Registered: 2013-03-08
Posts: 119

Re: Access violation with FPC 3.3.1

Can someone suggest working revisions for Raspbian Pi3. I try FPC 40491 with Lazarus2fix with fpcupdeluxe and mormot trunk git from yesterday. Lazarus build is OK, SynDB application build but same error in execution. What version of mormot is working on Pi arm? I think I need older version of mormot.

Offline

#5 2019-10-25 11:46:12

AOG
Member
Registered: 2014-02-24
Posts: 490

Re: Access violation with FPC 3.3.1

A pull-request is pending/created for some ARM changes.
Not yet perfect. Awaiting Ab response.

Offline

#6 2019-10-28 07:03:21

AOG
Member
Registered: 2014-02-24
Posts: 490

Re: Access violation with FPC 3.3.1

I have completed the work on ARM.
The results (waiting for approval) are available at:

https://github.com/LongDirtyAnimAlf/mORMot

You are very welcome to tests these changes.

Sidenote:
Due to a compiler bug, use -O0 or -O1 for your project.
You may get some errors when using -O2

Offline

#7 2019-10-28 22:14:03

ertank
Member
Registered: 2016-03-16
Posts: 163

Re: Access violation with FPC 3.3.1

Are these changes waiting tests from users before going in to the main code base?

Thanks.

Last edited by ertank (2019-10-28 22:15:09)

Offline

#8 2019-10-29 06:41:00

AOG
Member
Registered: 2014-02-24
Posts: 490

Re: Access violation with FPC 3.3.1

Ab has his own RPi's these days. So he can review by himself. But feedback is always welcome !

Today I will start working on getting mORMot to run with current FPC trunk on ARM.

Offline

#9 2019-10-29 11:09:04

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

Re: Access violation with FPC 3.3.1

Thank you AOG!

Offline

#10 2019-10-29 12:17:37

AOG
Member
Registered: 2014-02-24
Posts: 490

Re: Access violation with FPC 3.3.1

If you are on Windows or Intel Linux, you can already have a go at mORMot for current FPC trunk:
https://github.com/LongDirtyAnimAlf/mOR … /FPC_trunk

Offline

#11 2019-11-01 20:24:22

lvaskov
Member
Registered: 2019-10-13
Posts: 3

Re: Access violation with FPC 3.3.1

I can confirm that mORMot works fine on Raspberry Pi after the current changes for ARM platform.
Thanks a lot, AOG!

Offline

Board footer

Powered by FluxBB