g++ compiler error after updating to xcode 14

Viewed 45

I am using M1 Mac with MacOS 12.5.1 (Monterey). For some reasons, after updating xcode to version 14.0, I cannot compile some C++ codes which worked perfectly fine before. I have reinstalled Xcode, homebrew, and the gcc compiler, but they didn't seem to work. For example, I can compile the code on the left, but the code on the right gives this message:

1  0x102eaba8c  mach_o::relocatable::Parser<arm64>::parse(mach_o::relocatable::ParserOptions const&) + 4536
2  0x102e7dd38  mach_o::relocatable::Parser<arm64>::parse(unsigned char const*, unsigned long long, char const*, long, ld::File::Ordinal, mach_o::relocatable::ParserOptions const&) + 148
3  0x102ee64ac  ld::tool::InputFiles::makeFile(Options::FileInfo const&, bool) + 1468
4  0x102ee9360  ___ZN2ld4tool10InputFilesC2ER7Options_block_invoke + 56
5  0x1ad77c1f4  _dispatch_client_callout2 + 20
6  0x1ad790f8c  _dispatch_apply_invoke_and_wait + 224
7  0x1ad79026c  _dispatch_apply_with_attr_f + 1152
8  0x1ad79047c  dispatch_apply + 108
9  0x102ee91f4  ld::tool::InputFiles::InputFiles(Options&) + 616
10  0x102e6b6c0  main + 552
A linker snapshot was created at:
        /tmp/INterm_A-2022-09-17-095228.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

What is causing the error, and how do I fix this?

0 Answers
Related