升级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" 即可解决该问题

相关推荐
大熊猫侯佩16 小时前
桃花岛 Xcode 构建秘籍:Swift 中的 “Feature Flags” 心法
app·xcode·swift
悄然林静17 小时前
Mac终端执行`brew doctor`报`openssl@1.1`警告
mac·xcode·apple
权咚1 天前
阿权的开发经验小集
git·ios·xcode
小溪彼岸1 天前
macOS自带截图命令ScreenCapture
macos
TESmart碲视2 天前
Mac 真正多显示器支持:TESmart USB-C KVM(搭载 DisplayLink 技术)如何实现
macos·计算机外设·电脑
龙腾-虎跃2 天前
FreeSWITCH FunASR语音识别模块
人工智能·语音识别·xcode
2501_915106322 天前
Xcode 上传 ipa 全流程详解 App Store 上架流程、uni-app 生成 ipa 文件上传与审核指南
android·macos·ios·小程序·uni-app·iphone·xcode
CAE虚拟与现实2 天前
VSCode中的下载VSIX是指什么?
ide·vscode·编辑器
路边闲人22 天前
vscode启用GEMINI CODE ASSIST插件
ide·vscode·gemini
小蕾Java2 天前
Java 开发工具,最新2025 IDEA使用(附详细教程)
java·ide·intellij-idea