xcodegcccompiler-errorsmacportsxcode-command-line-tools

xcode 15, c++ compilation errors


I just installed xcode 15 (because git wouldn't work without doing so). I didn't note what version I had before.

Now I can't compile some c++ code, which was compiling perfectly well before. when I try to make, the following output is shown:

g++-mp-12 -std=c++14 -Wall -O3 -fopenmp -o owt1d-nonlocal main.o linear.o nonlinear.o read.o energy.o intensity.o spectrum.o initialise.o flux.o fourier.o  -L/opt/local/lib -framework Accelerate -march=native -lfftw3 -lfftw3_threads -lopenblas -larmadillo -lm -lpthread
-macosx_version_min has been renamed to -macos_version_min
ld: warning: ignoring duplicate libraries: '-lgcc'
0  0x100a97648  __assert_rtn + 72
1  0x1009cbfac  ld::AtomPlacement::findAtom(unsigned char, unsigned long long, ld::AtomPlacement::AtomLoc const*&, long long&) const + 1204
2  0x1009e1924  ld::InputFiles::SliceParser::parseObjectFile(mach_o::Header const*) const + 15164
3  0x1009eee30  ld::InputFiles::parseAllFiles(void (ld::AtomFile const*) block_pointer)::$_7::operator()(unsigned long, ld::FileInfo const&) const + 420
4  0x193098440  _dispatch_client_callout2 + 20
5  0x1930abf1c  _dispatch_apply_invoke + 224
6  0x193098400  _dispatch_client_callout + 20
7  0x1930a9fb8  _dispatch_root_queue_drain + 684
8  0x1930aa6c0  _dispatch_worker_thread2 + 164
9  0x193244038  _pthread_wqthread + 228
ld: Assertion failed: (resultIndex < sectData.atoms.size()), function findAtom, file Relocations.cpp, line 1336.
ld: warning: duplicate LC_RPATH are deprecated ('/opt/local/lib/libgcc')
collect2: error: ld returned 1 exit status
make: *** [owt1d-nonlocal] Error 1

I installed c++ and all the libraries used for this code with MacPorts, and I have tried updating all my installed ports, but the same error is produced.

I'm really not sure about going into the guts of the installations, and don't know where to start resolving the duplicate paths. Is there an easy fix? Or will I have to try downgrading my version of xcode (not ideal)?


Solution

  • I have the same problem. Xcode15 was automatically installed and since then I can no longer link my code with gcc. The only solution that worked was to reinstall Xcode 14.3.1 from the Apple developer site.