Debug build app crashes (on macOS 15.5) while built app runs fine

I have a test app that calls into a dylib that I’ve built. When the Xojo app tries to access this dylib it crashes, but only on macOS 15.5 (ARM) with a debug build. Built apps run fine, and the debug build of the same app with same version of Xojo runs fine on macOS 13.7 (Intel).

Here’s the crash log:

Process:               MyApp.debug [58506]
Path:                  /Users/USER/Documents/*/MyApp.debug.app/Contents/MacOS/MyApp.debug
Identifier:            MyApp.debug
Version:               ???
Code Type:             ARM-64 (Native)
Parent Process:        launchd [1]
User ID:               501

Date/Time:             2025-07-17 16:22:20.9386 +1000
OS Version:            macOS 15.5 (24F74)
Report Version:        12
Anonymous UUID:        68BA4D5D-AE10-DAC0-6D65-7400A1D32445


Time Awake Since Boot: 110000 seconds

System Integrity Protection: enabled

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

Exception Type:        EXC_BAD_ACCESS (SIGKILL (Code Signature Invalid))
Exception Codes:       UNKNOWN_0x32 at 0x00000001045f0000
Exception Codes:       0x0000000000000032, 0x00000001045f0000

Termination Reason:    Namespace CODESIGNING, Code 2 Invalid Page

VM Region Info: 0x1045f0000 is in 0x1045d4000-0x104614000;  bytes after start: 114688  bytes before end: 147455
      REGION TYPE                    START - END         [ VSIZE] PRT/MAX SHRMOD  REGION DETAIL
      VM_ALLOCATE                 1045d0000-1045d4000    [   16K] rw-/rwx SM=PRV  
--->  mapped file                 1045d4000-104614000    [  256K] r--/rwx SM=COW  Object_id=e9b25263
      GAP OF 0xcc4000 BYTES
      mapped file                 1052d8000-10dca8000    [137.8M] r--/rwx SM=COW  Object_id=59029a35

Thread 0 Crashed::  Dispatch queue: com.apple.main-thread
0   dyld                          	       0x19b9da960 dyld3::MachOFile::isMachO(Diagnostics&, unsigned long long) const + 60
1   dyld                          	       0x19b9da830 dyld3::FatFile::isValidSlice(Diagnostics&, unsigned long long, unsigned int, unsigned int, unsigned int, unsigned long long, unsigned long long) const + 80
2   dyld                          	       0x19b9dab40 dyld3::FatFile::forEachSlice(Diagnostics&, unsigned long long, bool, void (unsigned int, unsigned int, void const*, unsigned long long, bool&) block_pointer) const + 324
3   dyld                          	       0x19b9daf74 dyld3::FatFile::isFatFileWithSlice(Diagnostics&, unsigned long long, dyld3::GradedArchs const&, bool, unsigned long long&, unsigned long long&, bool&) const + 176
4   dyld                          	       0x19b9dc36c dyld3::MachOFile::compatibleSlice(Diagnostics&, unsigned long long&, unsigned long long&, void const*, unsigned long, char const*, mach_o::Platform, bool, dyld3::GradedArchs const&, bool) + 152
5   dyld                          	       0x19b9b3784 dyld4::JustInTimeLoader::makeJustInTimeLoaderDisk(Diagnostics&, dyld4::RuntimeState&, char const*, dyld4::Loader::LoadOptions const&, bool, unsigned int, mach_o::Layout const*) + 272
6   dyld                          	       0x19b9a68b0 dyld4::Loader::makeDiskLoader(Diagnostics&, dyld4::RuntimeState&, char const*, dyld4::Loader::LoadOptions const&, bool, unsigned int, mach_o::Layout const*) + 176
7   dyld                          	       0x19b9a82cc invocation function for block in dyld4::Loader::getLoader(Diagnostics&, dyld4::RuntimeState&, char const*, dyld4::Loader::LoadOptions const&) + 2884
8   dyld                          	       0x19b9a6fd8 dyld4::Loader::forEachResolvedAtPathVar(dyld4::RuntimeState&, char const*, dyld4::Loader::LoadOptions const&, dyld4::ProcessConfig::PathOverrides::Type, bool&, void (char const*, dyld4::ProcessConfig::PathOverrides::Type, bool&) block_pointer) + 764
9   dyld                          	       0x19b992118 dyld4::ProcessConfig::PathOverrides::forEachPathVariant(char const*, mach_o::Platform, bool, bool, bool&, void (char const*, dyld4::ProcessConfig::PathOverrides::Type, bool&) block_pointer) const + 1508
10  dyld                          	       0x19b9a6b18 dyld4::Loader::forEachPath(Diagnostics&, dyld4::RuntimeState&, char const*, dyld4::Loader::LoadOptions const&, void (char const*, dyld4::ProcessConfig::PathOverrides::Type, bool&) block_pointer) + 260
11  dyld                          	       0x19b9a73b0 dyld4::Loader::getLoader(Diagnostics&, dyld4::RuntimeState&, char const*, dyld4::Loader::LoadOptions const&) + 920
12  dyld                          	       0x19b9cf4e0 dyld4::APIs::dlopen_from(char const*, int, void*)::$_0::operator()() const::'lambda'()::operator()() const + 284
13  dyld                          	       0x19b9cf350 void dyld4::RuntimeLocks::withLoadersWriteLockAndProtectedStack<dyld4::APIs::dlopen_from(char const*, int, void*)::$_0::operator()() const::'lambda'()>(dyld4::APIs::dlopen_from(char const*, int, void*)::$_0::operator()() const::'lambda'())::'lambda'()::operator()() const + 192
14  dyld                          	       0x19b9ced74 dyld4::APIs::dlopen_from(char const*, int, void*)::$_0::operator()() const + 944
15  dyld                          	       0x19b9c3f5c dyld4::APIs::dlopen_from(char const*, int, void*) + 1136
16  dyld                          	       0x19b9c3a40 dyld4::APIs::dlopen(char const*, int) + 128
17  SISlib0635.dylib              	       0x10dd976e8 DeclareLibraryConstructorF(REALobjectStruct*, REALfolderItemStruct*) + 128
18  MyApp.debug             	       0x10057e35c DeclareLibraryMBS.Constructor%%o<DeclareLibraryMBS>o<FolderItem> + 72
19  MyApp.debug             	       0x1005f852c obPPClient.CallLibFunc_02_CallLib%s%o<obPPClient>o<FolderItem>i8ssbssb + 6112 (/obPPClient:623)
20  MyApp.debug             	       0x1005e9ff0 obPPClient.CallLibFuncBase%o<JSONItem>%o<obPPClient>i8ss&sbssb + 6528 (/obPPClient:127)
21  MyApp.debug             	       0x1005f3828 obPPClient.CallFunc_RunClient%s%o<obPPClient>ssbb&s + 628 (/obPPClient:440)
22  MyApp.debug             	       0x1005aed18 winMain.winMain.pbRunClient_Action%%o<winMain.winMain>o<PushButton> + 1404 (/winMain:533)
23  MyApp.debug             	       0x1005dc1c0 Delegate.IM_Invoke%%o<PushButton> + 60
24  MyApp.debug             	       0x1005dc20c AddHandler.Stub.15%% + 56
25  AppKit                        	       0x19fedf020 -[NSApplication(NSResponder) sendAction:to:from:] + 560
26  AppKit                        	       0x19fededc0 -[NSControl sendAction:to:] + 72
27  AppKit                        	       0x19feded04 __26-[NSCell _sendActionFrom:]_block_invoke + 100
28  AppKit                        	       0x19fedec2c -[NSCell _sendActionFrom:] + 204
29  AppKit                        	       0x19fedeb28 -[NSButtonCell _sendActionFrom:] + 96
30  AppKit                        	       0x19fedc0d4 NSControlTrackMouse + 1492
31  AppKit                        	       0x19fedbad4 -[NSCell trackMouse:inRect:ofView:untilMouseUp:] + 144
32  AppKit                        	       0x19fedb94c -[NSButtonCell trackMouse:inRect:ofView:untilMouseUp:] + 580
33  AppKit                        	       0x19fedadf8 -[NSControl mouseDown:] + 492
34  XojoFramework                 	       0x1016d6abc 0x1015ec000 + 961212
35  AppKit                        	       0x19fed9c54 -[NSWindow(NSEventRouting) _handleMouseDownEvent:isDelayedEvent:] + 3664
36  AppKit                        	       0x19fe65cc4 -[NSWindow(NSEventRouting) _reallySendEvent:isDelayedEvent:] + 492
37  AppKit                        	       0x19fe65910 -[NSWindow(NSEventRouting) sendEvent:] + 288
38  XojoFramework                 	       0x1016e2f60 0x1015ec000 + 1011552
39  AppKit                        	       0x1a06dd330 -[NSApplication(NSEventRouting) sendEvent:] + 1504
40  XojoFramework                 	       0x1016d29ac 0x1015ec000 + 944556
41  MyApp.debug             	       0x1003f7b38 Application._CallFunctionWithExceptionHandling%%o<Application>p + 164
42  XojoFramework                 	       0x10185dd24 CallFunctionWithExceptionHandling(void (*)()) + 180
43  XojoFramework                 	       0x1016d295c 0x1015ec000 + 944476
44  AppKit                        	       0x1a02dc42c -[NSApplication _handleEvent:] + 60
45  AppKit                        	       0x19fd32c8c -[NSApplication run] + 520
46  XojoFramework                 	       0x10185c414 RuntimeRun + 60
47  MyApp.debug             	       0x1004f6490 REALbasic._RuntimeRun + 28
48  MyApp.debug             	       0x100674b28 _Main + 632 (/#main:100)
49  MyApp.debug             	       0x100674048 main + 36
50  dyld                          	       0x19b98eb98 start + 6076

I tried signing the debug app with a post build script created by AppWrapper 4, but that doesn’t help. Is the app crashing because of a signing issue? Something new in macOS15.x? Thanks

Using Xojo 2025r1.1

It is crashing in DeclareLibraryMBS. Is the library you are using available to the debug build and also the correct version?

Yes the library is available in the debug build. I just added a breakpoint in the code before the library is accessed and when I run the debug build and show the contents of the debug app I see the library in the Frameworks folder. However, I see this library has a Date Modified showing yesterday, while all other dylib files have been updated with the debug build. Does that mean that Xojo is signing all dylibs in this folder during debug build but not this external dylib which I’m copying with a build step post build? Yes it’s the correct version - it works with a regular build.

“Code Signature Invalid”.

The library is signed with same certificate as your app?

2 Likes

Thanks Christian, a simple code sign of the library fixed the issue.

1 Like