我刚刚安装了 xcode 15(因为如果不这样做,git 将无法工作)。我没注意到我之前用的是什么版本。
现在我无法编译一些c++代码,而这些代码之前编译得很好。当我尝试
make
时,会显示以下输出:
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
我使用 MacPorts 安装了 c++ 和用于此代码的所有库,并且我尝试更新所有已安装的端口,但产生了相同的错误。
我真的不确定是否要深入安装,也不知道从哪里开始解决重复路径。有一个简单的解决办法吗?或者我必须尝试降级我的 xcode 版本(不理想)?
我也有同样的问题。 Xcode15 已自动安装,从那时起我无法再将我的代码与 gcc 链接。唯一有效的解决方案是从 Apple 开发者网站重新安装 Xcode 14.3.1。