After updating my MacOS to Monterey 12.6, I'm having an issue with compiling c++ codes with g++-12(homebrew gcc@12) like below.
0 0x100fe6ffa __assert_rtn + 139
1 0x100e1a28d mach_o::relocatable::Parser<x86_64>::parse(mach_o::relocatable::ParserOptions const&) + 4989
2 0x100e0af8f mach_o::relocatable::Parser<x86_64>::parse(unsigned char const*, unsigned long long, char const*, long, ld::File::Ordinal, mach_o::relocatable::ParserOptions const&) + 207
3 0x100e819d4 ld::tool::InputFiles::makeFile(Options::FileInfo const&, bool) + 2036
4 0x100e84fa0 ___ZN2ld4tool10InputFilesC2ER7Options_block_invoke + 48
5 0x7ff801da634a _dispatch_client_callout2 + 8
6 0x7ff801db8c45 _dispatch_apply_invoke_and_wait + 213
7 0x7ff801db8161 _dispatch_apply_with_attr_f + 1178
8 0x7ff801db8327 dispatch_apply + 45
9 0x100e84e2d ld::tool::InputFiles::InputFiles(Options&) + 669
10 0x100df5d48 main + 840
11 0x20116952e start + 462
A linker snapshot was created at:
/tmp/5557-2022-09-22-160757.ld-snapshot
ld: Assertion failed: (_file->_atomsArrayCount == computedAtomCount && "more atoms allocated than expected"), function parse, file macho_relocatable_file.cpp, line 2061.
collect2: error: ld returned 1 exit status
reinstalled g++-12 and CommandLineTools by brew uninstall g++-12 brew install g++-12 sudo rm -rf /Library/Developer/CommandLineTools xcode-select --install few times but still getting same problem.