A program with an empty main, linking to homebrew's default sdl3 + sdl2-compat and compiled with -fsanitize=address, crashes at start time with a MacOS gui alert:
Fatal error! Cannot continue!
Failed loading SDL3 library.
Removing -fsanitize=address, the program runs and exits normally.
Compilation command:
clang main.c $(sdl2-config --cflags --libs) -fsanitize=address.
lldb backtrace:
Process 72767 stopped
* thread #1, queue = 'com.apple.main-thread', stop reason = signal SIGABRT
frame #0: 0x000000019050f5b0 libsystem_kernel.dylib`__pthread_kill + 8
libsystem_kernel.dylib`__pthread_kill:
-> 0x19050f5b0 <+8>: b.lo 0x19050f5d0 ; <+40>
0x19050f5b4 <+12>: pacibsp
0x19050f5b8 <+16>: stp x29, x30, [sp, #-0x10]!
0x19050f5bc <+20>: mov x29, sp
(lldb) bt
* thread #1, queue = 'com.apple.main-thread', stop reason = signal SIGABRT
* frame #0: 0x000000019050f5b0 libsystem_kernel.dylib`__pthread_kill + 8
frame #1: 0x0000000190549888 libsystem_pthread.dylib`pthread_kill + 296
frame #2: 0x000000019044e850 libsystem_c.dylib`abort + 124
frame #3: 0x0000000100184688 libSDL2-2.0.0.dylib`dllinit.cold.1 + 24
frame #4: 0x0000000100144734 libSDL2-2.0.0.dylib`dllinit + 28
frame #5: 0x000000019019ecb0 dyld`invocation function for block in dyld4::Loader::findAndRunAllInitializers(dyld4::RuntimeState&) const + 444
frame #6: 0x00000001901dc730 dyld`invocation function for block in dyld3::MachOAnalyzer::forEachInitializer(Diagnostics&, dyld3::MachOAnalyzer::VMAddrConverter const&, void (unsigned int) block_pointer, void const*) const + 324
frame #7: 0x00000001901fb534 dyld`invocation function for block in mach_o::Header::forEachSection(void (mach_o::Header::SectionInfo const&, bool&) block_pointer) const + 312
frame #8: 0x00000001901f8158 dyld`mach_o::Header::forEachLoadCommand(void (load_command const*, bool&) block_pointer) const + 208
frame #9: 0x00000001901f99f0 dyld`mach_o::Header::forEachSection(void (mach_o::Header::SectionInfo const&, bool&) block_pointer) const + 124
frame #10: 0x00000001901dc220 dyld`dyld3::MachOAnalyzer::forEachInitializer(Diagnostics&, dyld3::MachOAnalyzer::VMAddrConverter const&, void (unsigned int) block_pointer, void const*) const + 516
frame #11: 0x000000019019ea68 dyld`dyld4::Loader::findAndRunAllInitializers(dyld4::RuntimeState&) const + 172
frame #12: 0x00000001901a68b0 dyld`dyld4::JustInTimeLoader::runInitializers(dyld4::RuntimeState&) const + 36
frame #13: 0x000000019019f214 dyld`dyld4::Loader::runInitializersBottomUp(dyld4::RuntimeState&, dyld3::Array<dyld4::Loader const*>&, dyld3::Array<dyld4::Loader const*>&) const + 308
frame #14: 0x000000019019f1b4 dyld`dyld4::Loader::runInitializersBottomUp(dyld4::RuntimeState&, dyld3::Array<dyld4::Loader const*>&, dyld3::Array<dyld4::Loader const*>&) const + 212
frame #15: 0x00000001901a3e50 dyld`dyld4::Loader::runInitializersBottomUpPlusUpwardLinks(dyld4::RuntimeState&) const::$_0::operator()() const + 180
frame #16: 0x000000019019f530 dyld`dyld4::Loader::runInitializersBottomUpPlusUpwardLinks(dyld4::RuntimeState&) const + 716
frame #17: 0x00000001901c104c dyld`dyld4::APIs::runAllInitializersForMain() + 400
frame #18: 0x0000000190183158 dyld`dyld4::prepare(dyld4::APIs&, mach_o::Header const*) + 3112
frame #19: 0x0000000190181d04 dyld`start + 7104
Edit to add:
I should mention that I am not using SDL3 yet; homebrew now ships SDL3 + sdl2-compat with brew install sdl2, and no longer provides sdl2 itself. So this is a regression from the POV of a dev using SDL2 with homebrew.
A program with an empty main, linking to homebrew's default sdl3 + sdl2-compat and compiled with
-fsanitize=address, crashes at start time with a MacOS gui alert:Removing
-fsanitize=address, the program runs and exits normally.Compilation command:
clang main.c $(sdl2-config --cflags --libs) -fsanitize=address.lldb backtrace:
Edit to add:
I should mention that I am not using SDL3 yet; homebrew now ships SDL3 + sdl2-compat with
brew install sdl2, and no longer provides sdl2 itself. So this is a regression from the POV of a dev using SDL2 with homebrew.