Recent

Author Topic: Mac mini M1, Lazarus crashing when opening project.  (Read 1405 times)

josh

  • Hero Member
  • *****
  • Posts: 818
Mac mini M1, Lazarus crashing when opening project.
« on: April 03, 2021, 02:42:48 pm »
Hi

Just got Mac M1, installed native Arch64 Lazarus, and am having problem loading in a project in the ide.

First problem I had, was the it complained  that Project CPU Target options was wrong clicked ok, then Lazarus would just crash out..
So I created another project build option and set that to Arch64 cocoa, and set as current Build option.
Now when I try to open the project, the first message is not there, but it just crashes immediately after trying to open a project, no error, just crash report.

Any body aware of such behaviour, what to look for, and possibly how to fix, it seems it is trying to show some model message, but is failing.


Code: [Select]
Process:               lazarus [9058]
Path:                  /Users/USER/Documents/*/lazarus.app/Contents/MacOS/lazarus
Identifier:            lazarus.freepascal.ide
Version:               2.1.0 (1)
Code Type:             ARM-64 (Native)
Parent Process:        ??? [1]
Responsible:           lazarus [9058]
User ID:               501

Date/Time:             2021-04-03 00:14:44.963 +0100
OS Version:            macOS 11.2.3 (20D91)
Report Version:        12
Anonymous UUID:        93F595A2-2AEB-CD19-A06C-DA3BBCD9B155


Time Awake Since Boot: 3300 seconds

System Integrity Protection: enabled

Crashed Thread:        0  Dispatch queue: com.apple.main-thread

Exception Type:        EXC_BAD_ACCESS (SIGABRT)
Exception Codes:       KERN_INVALID_ADDRESS at 0x0000000300000000
Exception Note:        EXC_CORPSE_NOTIFY

VM Regions Near 0x300000000:
    MALLOC metadata             283a88000-283ac8000    [  256K] rw-/rwx SM=PRV 
-->
    commpage (reserved)         fc0000000-1000000000   [  1.0G] ---/--- SM=NUL  reserved VM address space (unallocated)

Application Specific Information:
*** Terminating app due to uncaught exception 'NSGenericException', reason: '-[NSAlert runModal] may not be invoked inside of transaction begin/commit pair, or inside of transaction commit (usually this means it was invoked inside of a view's -drawRect: method.)'
abort() called
terminating with uncaught exception of type NSException

ps All the components used are installed and working; as other projects work when Extra Build option created.
« Last Edit: April 03, 2021, 03:44:59 pm by josh »
Development Installation Lazarus 1.3, FPC 2.7.1,Windows 7/8 32/64, OSX, *nix

Test Environment Lazarus & FPC Trunk on Windows and OSX (Cocoa Mainly on OSX). Testing also Crosscompile windows to OSX.. 
Any posts made from 2015 will be based on Lazarus Trunk.

trev

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1581
  • Former Delphi 1-7, 10.2 user
Re: Mac mini M1, Lazarus crashing when opening project.
« Reply #1 on: April 04, 2021, 01:06:32 am »
Where did this project come from - it sounds like the project file may be corrupted.
Lazarus 2.3 2021-08-10 FPC 3.3.1 r49223 macOS 10.14.6 Xcode 11.3.1
Lazarus 2.3 r65500 FPC 3.3.1 r49634 macOS 11.5.2 aarch64 Xcode 12.5.1
Lazarus 2.3 2021-08-11 FPC 3.2.2 FreeBSD 13.0 amd64 VMware VM
Lazarus 2.1 r61574 FPC 3.0.4 Ubuntu 20.04 Parallels VM
Lazarus 2.0.10 FPC 3.2.0 Win10 Parallels VM

Igor Kokarev

  • Sr. Member
  • ****
  • Posts: 347
Re: Mac mini M1, Lazarus crashing when opening project.
« Reply #2 on: April 04, 2021, 08:27:09 am »
I have M1 Mini and we use Lazarus trunk and FPC 3.2.0 fixes tree for a large project. It compiles fine for aarch64/darwin and x86-64/darwin.

josh

  • Hero Member
  • *****
  • Posts: 818
Re: Mac mini M1, Lazarus crashing when opening project.
« Reply #3 on: April 04, 2021, 12:06:24 pm »
Hi

Thanks for your replies.

I have installed X86-64 Version as well, so this would then be using rosetta.
Using the same versions of Laz 64902 and FPC (Arch64 3.3.1 49108, Intel 3.3.1 49113) Trunk, and same components (same folder), and this accesses the same project (same folder) and compiles and runs the project in Intel mode.

Below is further information that may help, I should have put this in the opening post.

Any help appreciated.

Code: [Select]
Application Specific Backtrace 1:
0   CoreFoundation                      0x000000018e77e320 __exceptionPreprocess + 240
1   libobjc.A.dylib                     0x000000018e4acc04 objc_exception_throw + 60
2   CoreFoundation                      0x000000018e77e16c +[NSException exceptionWithName:reason:userInfo:] + 0
3   AppKit                              0x000000019177be6c _NSRunModal + 164
4   AppKit                              0x0000000191233b34 -[NSAlert runModal] + 272
5   lazarus                             0x0000000102969eec COCOAINT_$$_COCOAPROMPTUSER$crcF62BAB40 + 1228
6   lazarus                             0x000000010296a11c COCOAINT$_$TCOCOAWIDGETSET_$__$$_PROMPTUSER$crc484A2DB2 + 76
7   lazarus                             0x00000001028ea0b0 LCLINTF_$$_PROMPTUSER$crc484A2DB2 + 96
8   lazarus                             0x00000001028eaaa4 LCLINTF_$$_PROMPTUSER$crcB76EAC20 + 100
9   lazarus                             0x00000001027ad4a0 FORMS$_$TAPPLICATION_$__$$_SHOWEXCEPTION$EXCEPTION + 544
10  lazarus                             0x0000000102bc374c LCLEXCEPTIONSTACKTRACE$_$TEVENTCONTAINER_$__$$_HANDLEAPPLICATIONEXCEPTION$TOBJECT$EXCEPTION + 316
11  lazarus                             0x00000001027ac480 FORMS$_$TAPPLICATION_$__$$_HANDLEEXCEPTION$TOBJECT + 416
12  lazarus                             0x000000010299cb80 LCLMESSAGEGLUE_$$_DELIVERMESSAGE$TOBJECT$formal$$INT64 + 320
13  lazarus                             0x000000010299d5f8 LCLMESSAGEGLUE_$$_LCLSENDPAINTMSG$TCONTROL$HDC$PPAINTSTRUCT$$INT64 + 72
14  lazarus                             0x000000010299aae0 COCOAWSCOMMON$_$TLCLCOMMONCALLBACK_$__$$_DRAW$NSGRAPHICSCONTEXT$CGRECT$CGRECT + 464
15  lazarus                             0x000000010296c334 -[TCocoaCustomControl drawRect:] + 564
16  AppKit                              0x000000019104281c _NSViewDrawRect + 148
17  AppKit                              0x0000000191772b98 -[NSView _recursive:displayRectIgnoringOpacity:inContext:stopAtLayerBackedViews:] + 1300
18  AppKit                              0x0000000191041f9c -[NSView(NSLayerKitGlue) _drawViewBackingLayer:inContext:drawingHandler:] + 676
19  QuartzCore                          0x00000001949a4ab4 CABackingStoreUpdate_ + 180
20  QuartzCore                          0x0000000194a00fcc ___ZN2CA5Layer8display_Ev_block_invoke + 64
21  QuartzCore                          0x00000001949a3e64 -[CALayer _display] + 1732
22  AppKit                              0x0000000191041bf4 -[_NSBackingLayer display] + 372
23  AppKit                              0x0000000190fb3124 -[_NSViewBackingLayer display] + 644
24  QuartzCore                          0x00000001949a2f8c _ZN2CA5Layer17display_if_neededEPNS_11TransactionE + 768
25  QuartzCore                          0x0000000194acad2c _ZN2CA7Context18commit_transactionEPNS_11TransactionEdPd + 432
26  QuartzCore                          0x0000000194984a78 _ZN2CA11Transaction6commitEv + 732
27  AppKit                              0x0000000191056c88 __62+[CATransaction(NSCATransaction) NS_setFlushesWithDisplayLink]_block_invoke + 304
28  AppKit                              0x00000001917a9c6c ___NSRunLoopObserverCreateWithHandler_block_invoke + 64
29  CoreFoundation                      0x000000018e6ffe08 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 36
30  CoreFoundation                      0x000000018e6ffc54 __CFRunLoopDoObservers + 576
31  CoreFoundation                      0x000000018e6ff1ac __CFRunLoopRun + 768
32  CoreFoundation                      0x000000018e6fe740 CFRunLoopRunSpecific + 600
33  HIToolbox                           0x00000001962235c4 RunCurrentEventLoopInMode + 292
34  HIToolbox                           0x0000000196223284 ReceiveNextEventCommon + 320
35  HIToolbox                           0x0000000196223124 _BlockUntilNextEventMatchingListInModeWithFilter + 76
36  AppKit                              0x0000000190ed882c _DPSNextEvent + 868
37  AppKit                              0x0000000190ed71ac -[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 1312
38  lazarus                             0x000000010295ed94 -[TCocoaApplication nextEventMatchingMask:untilDate:inMode:dequeue:] + 84
39  lazarus                             0x000000010295f470 COCOAINT$_$TCOCOAWIDGETSET_$__$$_APPRUNMESSAGES$BOOLEAN$NSDATE + 128
40  lazarus                             0x000000010295f510 COCOAINT$_$TCOCOAWIDGETSET_$__$$_APPPROCESSMESSAGES + 32
41  lazarus                             0x00000001027ac5f4 FORMS$_$TAPPLICATION_$__$$_HANDLEMESSAGE + 52
42  lazarus                             0x00000001027acb70 FORMS$_$TAPPLICATION_$__$$_RUNLOOP + 64
43  lazarus                             0x000000010295e400 -[TCocoaApplication run] + 64
44  lazarus                             0x000000010295f3e4 COCOAINT$_$TCOCOAWIDGETSET_$__$$_APPRUN$TAPPLICATIONMAINLOOP + 84
45  lazarus                             0x00000001027acb24 FORMS$_$TAPPLICATION_$__$$_RUN + 100
46  lazarus                             0x0000000102732a84 PASCALMAIN + 772
47  lazarus                             0x000000010275a18c FPC_SysEntry + 28
48  lazarus                             0x0000000102732710 FPC_SYSTEMMAIN + 80
49  lazarus                             0x0000000102732768 main + 40
50  libdyld.dylib                       0x000000018e621f34 start + 4

Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0   libsystem_kernel.dylib        0x000000018e5d4cec __pthread_kill + 8
1   libsystem_pthread.dylib        0x000000018e605c24 pthread_kill + 292
2   libsystem_c.dylib              0x000000018e54d864 abort + 104
3   libc++abi.dylib                0x000000018e5c5cf8 abort_message + 132
4   libc++abi.dylib                0x000000018e5b6e4c demangling_terminate_handler() + 308
5   libobjc.A.dylib                0x000000018e4af6c8 _objc_terminate() + 144
6   libc++abi.dylib                0x000000018e5c50e0 std::__terminate(void (*)()) + 20
7   libc++abi.dylib                0x000000018e5c8150 __cxa_rethrow + 148
8   libobjc.A.dylib                0x000000018e4ad000 objc_exception_rethrow + 44
9   com.apple.AppKit              0x000000019177c08c _NSRunModal + 708
10  com.apple.AppKit              0x0000000191233b34 -[NSAlert runModal] + 272
11  lazarus.freepascal.ide        0x0000000102969eec COCOAINT_$$_COCOAPROMPTUSER$crcF62BAB40 + 1228
12  lazarus.freepascal.ide        0x000000010296a11c COCOAINT$_$TCOCOAWIDGETSET_$__$$_PROMPTUSER$crc484A2DB2 + 76
13  lazarus.freepascal.ide        0x00000001028ea0b0 LCLINTF_$$_PROMPTUSER$crc484A2DB2 + 96
14  lazarus.freepascal.ide        0x00000001028eaaa4 LCLINTF_$$_PROMPTUSER$crcB76EAC20 + 100
15  lazarus.freepascal.ide        0x00000001027ad4a0 FORMS$_$TAPPLICATION_$__$$_SHOWEXCEPTION$EXCEPTION + 544
16  lazarus.freepascal.ide        0x0000000102bc374c LCLEXCEPTIONSTACKTRACE$_$TEVENTCONTAINER_$__$$_HANDLEAPPLICATIONEXCEPTION$TOBJECT$EXCEPTION + 316
17  lazarus.freepascal.ide        0x00000001027ac480 FORMS$_$TAPPLICATION_$__$$_HANDLEEXCEPTION$TOBJECT + 416
18  lazarus.freepascal.ide        0x000000010299cb80 LCLMESSAGEGLUE_$$_DELIVERMESSAGE$TOBJECT$formal$$INT64 + 320
19  lazarus.freepascal.ide        0x000000010299d5f8 LCLMESSAGEGLUE_$$_LCLSENDPAINTMSG$TCONTROL$HDC$PPAINTSTRUCT$$INT64 + 72
20  lazarus.freepascal.ide        0x000000010299aae0 COCOAWSCOMMON$_$TLCLCOMMONCALLBACK_$__$$_DRAW$NSGRAPHICSCONTEXT$CGRECT$CGRECT + 464
21  lazarus.freepascal.ide        0x000000010296c334 -[TCocoaCustomControl drawRect:] + 564
22  com.apple.AppKit              0x000000019104281c _NSViewDrawRect + 148
23  com.apple.AppKit              0x0000000191772b98 -[NSView _recursive:displayRectIgnoringOpacity:inContext:stopAtLayerBackedViews:] + 1300
24  com.apple.AppKit              0x0000000191041f9c -[NSView(NSLayerKitGlue) _drawViewBackingLayer:inContext:drawingHandler:] + 676
25  com.apple.QuartzCore          0x00000001949a4ab4 CABackingStoreUpdate_ + 180
26  com.apple.QuartzCore          0x0000000194a00fcc invocation function for block in CA::Layer::display_() + 64
27  com.apple.QuartzCore          0x00000001949a3e64 -[CALayer _display] + 1732
28  com.apple.AppKit              0x0000000191041bf4 -[_NSBackingLayer display] + 372
29  com.apple.AppKit              0x0000000190fb3124 -[_NSViewBackingLayer display] + 644
30  com.apple.QuartzCore          0x00000001949a2f8c CA::Layer::display_if_needed(CA::Transaction*) + 768
31  com.apple.QuartzCore          0x0000000194acad2c CA::Context::commit_transaction(CA::Transaction*, double, double*) + 432
32  com.apple.QuartzCore          0x0000000194984a78 CA::Transaction::commit() + 732
33  com.apple.AppKit              0x0000000191056c88 __62+[CATransaction(NSCATransaction) NS_setFlushesWithDisplayLink]_block_invoke + 304
34  com.apple.AppKit              0x00000001917a9c6c ___NSRunLoopObserverCreateWithHandler_block_invoke + 64
35  com.apple.CoreFoundation      0x000000018e6ffe08 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 36
36  com.apple.CoreFoundation      0x000000018e6ffc54 __CFRunLoopDoObservers + 576
37  com.apple.CoreFoundation      0x000000018e6ff1ac __CFRunLoopRun + 768
38  com.apple.CoreFoundation      0x000000018e6fe740 CFRunLoopRunSpecific + 600
39  com.apple.HIToolbox            0x00000001962235c4 RunCurrentEventLoopInMode + 292
40  com.apple.HIToolbox            0x0000000196223284 ReceiveNextEventCommon + 320
41  com.apple.HIToolbox            0x0000000196223124 _BlockUntilNextEventMatchingListInModeWithFilter + 76
42  com.apple.AppKit              0x0000000190ed882c _DPSNextEvent + 868
43  com.apple.AppKit              0x0000000190ed71ac -[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 1312
44  lazarus.freepascal.ide        0x000000010295ed94 -[TCocoaApplication nextEventMatchingMask:untilDate:inMode:dequeue:] + 84
45  lazarus.freepascal.ide        0x000000010295f470 COCOAINT$_$TCOCOAWIDGETSET_$__$$_APPRUNMESSAGES$BOOLEAN$NSDATE + 128
46  lazarus.freepascal.ide        0x000000010295f510 COCOAINT$_$TCOCOAWIDGETSET_$__$$_APPPROCESSMESSAGES + 32
47  lazarus.freepascal.ide        0x00000001027ac5f4 FORMS$_$TAPPLICATION_$__$$_HANDLEMESSAGE + 52
48  lazarus.freepascal.ide        0x00000001027acb70 FORMS$_$TAPPLICATION_$__$$_RUNLOOP + 64
49  lazarus.freepascal.ide        0x000000010295e400 -[TCocoaApplication run] + 64
50  lazarus.freepascal.ide        0x000000010295f3e4 COCOAINT$_$TCOCOAWIDGETSET_$__$$_APPRUN$TAPPLICATIONMAINLOOP + 84
51  lazarus.freepascal.ide        0x00000001027acb24 FORMS$_$TAPPLICATION_$__$$_RUN + 100
52  lazarus.freepascal.ide        0x0000000102732a84 PASCALMAIN + 772
53  lazarus.freepascal.ide        0x000000010275a18c FPC_SysEntry + 28
54  lazarus.freepascal.ide        0x0000000102732710 FPC_SYSTEMMAIN + 80
55  lazarus.freepascal.ide        0x0000000102732768 main + 40
56  libdyld.dylib                  0x000000018e621f34 start + 4
« Last Edit: April 04, 2021, 12:11:18 pm by josh »
Development Installation Lazarus 1.3, FPC 2.7.1,Windows 7/8 32/64, OSX, *nix

Test Environment Lazarus & FPC Trunk on Windows and OSX (Cocoa Mainly on OSX). Testing also Crosscompile windows to OSX.. 
Any posts made from 2015 will be based on Lazarus Trunk.

trev

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1581
  • Former Delphi 1-7, 10.2 user
Re: Mac mini M1, Lazarus crashing when opening project.
« Reply #4 on: April 04, 2021, 12:45:07 pm »
I think you are going to have to determine what causes the issue by stripping the project back bit by bit using the Intel version which will load it and then trying the ARM64 version. Then you'll be in a position to log a reproducible issue in the BugTracker.

Also, as mentioned by Jonas in another of your threads, the trunk versions are "in development" versions subject to occasional breakages especially in the FPC ARM64 code which is undergoing optimisation. Although my current issues in that regard were recently fixed, I noticed that there are other pending issues listed in the BugTracker.

As a temporary workaround, you could use the Intel Lazarus version and the native ARM64 FPC compiler.
Lazarus 2.3 2021-08-10 FPC 3.3.1 r49223 macOS 10.14.6 Xcode 11.3.1
Lazarus 2.3 r65500 FPC 3.3.1 r49634 macOS 11.5.2 aarch64 Xcode 12.5.1
Lazarus 2.3 2021-08-11 FPC 3.2.2 FreeBSD 13.0 amd64 VMware VM
Lazarus 2.1 r61574 FPC 3.0.4 Ubuntu 20.04 Parallels VM
Lazarus 2.0.10 FPC 3.2.0 Win10 Parallels VM

josh

  • Hero Member
  • *****
  • Posts: 818
Re: Mac mini M1, Lazarus crashing when opening project.
« Reply #5 on: April 04, 2021, 01:19:07 pm »
Hi Trev,

Yes I can cross compile to Arch64 from the intel version (created a seperate build mode (making sure the WM are set 11.2.0, that works.

The issue is Lazarus Arch64 throwing a wobbly when trying to just open the project .

How easy is it to compile laz in Full debug mode, would this help in tracing where laz is crashing out?

nb a side effect of this which may help a little bit, is that it has already set the last project used, so then if you try opening laz it immediately crashes, i have to manually edit out the las open project.
Development Installation Lazarus 1.3, FPC 2.7.1,Windows 7/8 32/64, OSX, *nix

Test Environment Lazarus & FPC Trunk on Windows and OSX (Cocoa Mainly on OSX). Testing also Crosscompile windows to OSX.. 
Any posts made from 2015 will be based on Lazarus Trunk.

trev

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1581
  • Former Delphi 1-7, 10.2 user
Re: Mac mini M1, Lazarus crashing when opening project.
« Reply #6 on: April 05, 2021, 02:37:55 am »
How easy is it to compile laz in Full debug mode, would this help in tracing where laz is crashing out?

I've not done it, but I guess that:

Code: Bash  [Select][+][-]
  1. make distclean all LINKSMART=1  CREATESMART=1  DEBUG=1 OPTIMIZE=0  OPT="-va -glh -gw -godwarfsets -O-1"  >& /tmp/build.log

should do it. You may even get a line number...

Lazarus 2.3 2021-08-10 FPC 3.3.1 r49223 macOS 10.14.6 Xcode 11.3.1
Lazarus 2.3 r65500 FPC 3.3.1 r49634 macOS 11.5.2 aarch64 Xcode 12.5.1
Lazarus 2.3 2021-08-11 FPC 3.2.2 FreeBSD 13.0 amd64 VMware VM
Lazarus 2.1 r61574 FPC 3.0.4 Ubuntu 20.04 Parallels VM
Lazarus 2.0.10 FPC 3.2.0 Win10 Parallels VM

 

TinyPortal © 2005-2018