c++lldbdyldmacos-monterey

MacOS 12 beta dyld error: file Array.h, line 54


I wrote an QT application which works well on macOS Big Sur. Recently I upgrade to MacOS 12 beta 2. The compile process still works. But the application can't start. The backtrace stack shows it crashes at dyld process.

dyld[16971]: Assertion failed: (idx < _usedCount), function operator[], file Array.h, line 54.

* thread #1, stop reason = signal SIGABRT
  * frame #0: 0x000000010039cf5a dyld`__abort_with_payload + 10
    frame #1: 0x00000001003b303f dyld`abort_with_payload_wrapper_internal + 80
    frame #2: 0x00000001003b3071 dyld`abort_with_payload + 9
    frame #3: 0x00000001003624d7 dyld`dyld4::halt(char const*) + 375
    frame #4: 0x00000001003b2805 dyld`abort_report_np + 173
    frame #5: 0x00000001003b2842 dyld`__assert_rtn + 61
    frame #6: 0x00000001003b0c1e dyld`invocation function for block in dyld4::Loader::applyFixupsGeneric(Diagnostics&, dyld4::RuntimeState&, dyld3::Array<void const*> const&, dyld3::Array<void const*> const&, bool, dyld3::Array<dyld4::Loader::MissingFlatLazySymbol> const&) const + 33
    frame #7: 0x000000010036c534 dyld`invocation function for block in dyld4::Loader::applyFixupsGeneric(Diagnostics&, dyld4::RuntimeState&, dyld3::Array<void const*> const&, dyld3::Array<void const*> const&, bool, dyld3::Array<dyld4::Loader::MissingFlatLazySymbol> const&) const + 233
    frame #8: 0x00000001003954fa dyld`dyld3::MachOAnalyzer::forEachBind_OpcodesWeak(Diagnostics&, dyld3::MachOLoaded::LinkEditInfo const&, dyld3::MachOFile::SegmentInfo const*, void (char const*, dyld3::MachOLoaded::LinkEditInfo const&, dyld3::MachOFile::SegmentInfo const*, bool, bool, unsigned int, int, unsigned int, unsigned char, unsigned long long, unsigned char, char const*, bool, bool, unsigned long long, bool, bool&) block_pointer, void (char const*) block_pointer) const + 606
    frame #9: 0x00000001003948c2 dyld`dyld3::MachOAnalyzer::forEachBindUnified_Opcodes(Diagnostics&, bool, void (unsigned long long, dyld3::MachOAnalyzer::BindTargetInfo const&, bool&) block_pointer, void (unsigned long long, dyld3::MachOAnalyzer::BindTargetInfo const&, bool&) block_pointer) const + 818
    frame #10: 0x000000010039603f dyld`dyld3::MachOAnalyzer::forEachBindLocation_Opcodes(Diagnostics&, void (unsigned long long, unsigned int, bool&) block_pointer, void (unsigned long long, unsigned int, bool&) block_pointer) const + 105
    frame #11: 0x000000010036c19f dyld`dyld4::Loader::applyFixupsGeneric(Diagnostics&, dyld4::RuntimeState&, dyld3::Array<void const*> const&, dyld3::Array<void const*> const&, bool, dyld3::Array<dyld4::Loader::MissingFlatLazySymbol> const&) const + 407
    frame #12: 0x000000010036f452 dyld`dyld4::JustInTimeLoader::applyFixups(Diagnostics&, dyld4::RuntimeState&, dyld4::DyldCacheDataConstLazyScopedWriter&, bool) const + 534
    frame #13: 0x000000010035dd15 dyld`dyld4::prepare(dyld4::APIs&, dyld3::MachOAnalyzer const*) + 1876
    frame #14: 0x000000010035d4b4 dyld`start + 388

Since I can't stop during dyld and don't have source code for dyld, I used some flag to show the process. Then I got the following info:

...
dyld[16806]: mprotect 0x000106D9C000->0x000106DA0000 to read-only
dyld[16806]: <libabsl_raw_hash_set.2103.0.1.dylib/bind#0> -> 0x7ff805b6d2b1 (libdyld.dylib/__tlv_bootstrap)
dyld[16806]: fixup: *0x000106DB0018 = 0x000106DB0000 <rebase>
dyld[16806]: fixup: *0x000106DB0000 = 0x7FF805B6D2B1 <libabsl_raw_hash_set.2103.0.1.dylib/bind#0>
dyld[16806]: Assertion failed: (idx < _usedCount), function operator[], file Array.h, line 54.

My questions are: 1) Is there any way to debug dyld and find out which library cause this error? 2) Does the dyld log means the error is in libabsl_raw_hash_set library? 3) Is it possible that it's a dyld error itself and will be fixed in the release version of MacOS Monterey?

Many thanks!


Solution

  • This has been fixed in MacOS Monterey public beta 3.