升级Xcode 15后,出现大量Duplicate symbols问题

https://developer.apple.com/forums/thread/731090

升级到Xcode 15后,原先Xcode14可以编译的项目出现大量Duplicate symbols,且引用报错指向同一个路径(一般为Framework)下的同一个文件。经过查找相关解决,可通过添加设置改正。

✅解决方案:

在Xcode -> Target -> Build Setting -> Other Linker Flags 添加一行"-ld64" 即可解决该问题

原因:

复制代码
Xcode 15 beta includes a new linker, known as `ld_prime`. This has a bunch of benefits, not least being the support for mergeable libraries, per WWDC 2023 Session 10268 [Meet mergeable libraries](https://developer.apple.com/videos/play/wwdc2023/10268/). However, any time you rewrite something that complex you inevitably run into the odd issue. Normally I'd suggest you file a bug about this, but we already have a bug report about this one (r. 110340167).

In the meantime, you should be able to work around it by reverting to the old linker. The linker has two options, `-ld64` and `-ld_prime`, that override its default algorithm for choosing a back end.

Xcode 15测试版包含一个新的链接器,称为ld_prime。根据WWDC 2023 Session 10268 Meet mergeable libraries,这有很多好处,尤其是支持可合并库。然而,每当你重写如此复杂的东西时,你不可避免地会遇到奇怪的问题。通常我建议你提交一个关于这个的bug,但我们已经有了关于这个bug的报告(r.110340167)。

同时,✅您应该能够通过恢复到旧的链接器来解决它✅。链接器有两个选项,-ld64和-ld_prime,它们覆盖了用于选择后端的默认算法。

添加设置可以选择使用旧的链接器 而不是默认的新的 -ld_prime 链接器。

⚠️警告:
-ld64 is deprecated, use -ld_classic instead

报警告,换成下面方案:

在Xcode -> Target -> Build Setting -> Other Linker Flags 添加一行"-ld_classic" 即可解决该问题

相关推荐
传奇开心果编程7 分钟前
【SwiftUI入门练中学】第7课 动画与手势:让界面更灵动
学习·macos·ui·ios·swiftui·swift
风华同学3 小时前
vscode远程连接
ide·vscode·编辑器
kiss strong5 小时前
idea显示前进后退按钮
java·ide·intellij-idea
ShuiShenHuoLe6 小时前
Visual Studio 2022 Community 下载指南
ide·visual studio
the3clipse7 小时前
MacOS、Linux 与 Windows 视频编解码对比:AV1、HEVC、ProRes 与硬件加速优劣势
linux·windows·macos·hevc·av1·视频解码·硬件解码
一路向北he17 小时前
trae或者vscode定义了文件,但是文件不亮是灰的
ide·vscode·编辑器
传奇开心果编程18 小时前
【SwiftUI娓娓道来】第3课:让界面活起来——交互与动画指南
学习·macos·ui·ios·swiftui·swift
朋友圈自动点赞工具1 天前
Gmail 委托邮箱在手机上关不掉
macos·智能手机·cocoa·硬件评测
小黄人软件1 天前
AndroidStudio老项目 macOS运行BlueTooth蓝牙串口助手(Android+Studio源码).rar
android·macos