skip to Main Content

After updating to Xcode 15, I cannot use g++.

I downgraded to Xcode 14.3.1 and "brew reinstall gcc", result was not changed.

When I use g++ xxx.cpp the below error is displayed.

-macosx_version_min has been renamed to -macos_version_min
0  0x105edff43  __assert_rtn + 64
1  0x105de1f43  ld::AtomPlacement::findAtom(unsigned char, unsigned long long, ld::AtomPlacement::AtomLoc const*&, long long&) const + 1411
2  0x105dfe431  ld::InputFiles::SliceParser::parseObjectFile(mach_o::Header const*) const + 19745
3  0x105e0eb71  ld::InputFiles::parseAllFiles(void (ld::AtomFile const*) block_pointer)::$_7::operator()(unsigned long, ld::FileInfo const&) const + 657
4  0x7ff80752f066  _dispatch_client_callout2 + 8
5  0x7ff80754218f  _dispatch_apply_invoke_and_wait + 213
6  0x7ff807541692  _dispatch_apply_with_attr_f + 1207
7  0x7ff807541847  dispatch_apply + 45
8  0x105ea7972  ld::AtomFileConsolidator::parseFiles(bool) + 370
9  0x105e2ed67  main + 12263
ld: Assertion failed: (resultIndex < sectData.atoms.size()), function findAtom, file Relocations.cpp, line 1336.
collect2: error: ld returned 1 exit status

What should I do?

2

Answers


  1. Chosen as BEST ANSWER

    I temporary fixed with below flow.

    $ brew install gcc
    

    This results in gcc with apple clang. As a result, following command worked well.

    $ g++ main.cpp -std=c++11
    

  2. I also faced a similar issue, updating gcc works pretty well.

    brew install gcc
    

    This command will install, or update the current version on GCC accordingly, you don’t need to delete the current version and install the new one.
    I am currently using an M1 MacBook, and it works pretty well!

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search