#1 2023-10-18 09:01:10

tern
Member
Registered: 2023-10-18
Posts: 2

Apple Silicon M1

The following problem occurred while testing Mormot with Lazarus on a Macbook Air M1:

TTestRecord = class(TORM)
  protected
    fName: string;
    fAge: integer;
  published
    property Name: string read fName write fName;
    property Age: integer read fAge write fAge;
  end;

var
  SQLRestServerDB: TSQLRestServerDB;
  SQLModel: TSQLModel;  
...
  begin
  SQLModel := TSQLModel.Create([TTestRecord], 'test');
  SQLRestServerDB := TSQLRestServerDB.Create(SQLModel, ExeVersion.ProgramFilePath +
    'testsqlite.db3', False);
  SQLRestServerDB.model.owner := SQLRestServerDB;
  SQLRestServerDB.CreateMissingTables; 
end
...
 var
  AgeInt,id: integer;
  TestRecord: TTestRecord;
begin
  ...
  TestRecord := TTestRecord.Create;
  try
    TestRecord.Name := edtName.Text;
    TestRecord.Age := AgeInt;
    ID := SQLRestServerDB.Add(TestRecord, True);
  finally
    TestRecord.Free;
  end;      
 ....

When I run this code in the IDE, nothing happens, also exceptions are not thrown, no matter if in debug or release mode.

If I run the compiled program (project1.app), also no effect.

But if I start the executable (project) in the terminal, a 'testsqlite.db3' is created and also adding the record works. So then everything works as expected, only the input in the text field is directed to the terminal, so the input in the text fields is only possible with copy-paste. But the framework works as expected.

The problem occurs in this way both with the precompiled packages (Laz 2.2.6 FPC 3.2.0) and with a Lazarus IDE compiled with fpcupdeluxe (Laz fixes-2.2, FPC fixes-3.2). In both cases only the file executed in the terminal works (project1, but not project1.app).

No problems on Linux and Windows.

I am somewhat at a loss as to what to do here. Does anyone have a suggestion on this?
Link to the complete test project

Offline

#2 2023-10-18 10:03:18

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

Re: Apple Silicon M1

We run the regression tests on Mac M1 with no problem.
For instance tonight: https://luti.tranquil.it/get_folder_res … 9tYWNfYXJt

The issue is not in mORMot, I am afraid.
The issue seems to be in Lazarus and its limited/buggy debugger support, which is a well known limitation.

Here, we don't use Lazarus on M1.

Offline

#3 2023-10-18 12:59:49

tern
Member
Registered: 2023-10-18
Posts: 2

Re: Apple Silicon M1

Thanks Arnaud for your comment, I appreciate it.

I like to submit the following update:

I installed the precompiled packages from here.
And re-cloned mormot2 from github. Unfortunately, compiling the mormot2.lpk failed at first. Then I checked out on commit 087cc87 'added missing sqlite3 compilation script for aarch64-darwin'.

Now the sample project works without failure, both the trunk version and the precompiled one.

Last edited by tern (2023-10-18 13:00:22)

Offline

Board footer

Powered by FluxBB