升级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 小时前
Anaconda国内镜像配置与conda常用命令
ide·经验分享·python·conda
weixin_531670898 小时前
Interlude起来:Swift原生Mac软件有什么优势?原生Mac应用和Electron应用有什么区别?
人工智能·macos·mac·swift
k4m7v2pz8 小时前
Swift Package Manager 在 macOS 26 上的三个编译错误排查指南
macos·spm·ai编程·xcode·swift·命令行工具
雾沉川9 小时前
Rust IDE 选型:除 VS Code 之外,RustRover 非商业场景可免费使用
ide·vscode·rust
zhonyu鱼11 小时前
Pot 翻译:开源免费的跨平台划词翻译与 OCR 工具
windows·macos·开源·ocr·开源软件
杜子麟12 小时前
Android studio模拟器离线安装
android·macos·android studio
守城小轩1 天前
Chromium 148 编译指南 macOS篇:环境配置要求(一)
macos
Codeking__1 天前
iOS 动画:core Animation 底层原理
macos·objective-c·cocoa
SatanII1 天前
读懂 SELinux:强制访问控制 MAC,解决 httpd 服务权限报错实战
linux·运维·服务器·网络·macos
2501_915918411 天前
iOS 真机调试工具推荐,安装运行、性能分析有哪些工具
ide·vscode·ios·objective-c·个人开发·swift·敏捷流程