#Jenkins + Xcode 26 打包报错:dylibToOrdinal

1. 链接器崩溃(最优先处理)

现象:ld: Assertion failed: (it != _dylibToOrdinal.end()), function dylibToOrdinal

原因:Xcode 26/16+ 与旧链接器 -ld_classic 不兼容。

处理:在主 App 的 Other Linker Flags 里删掉 -Wl 和 -ld_classic,只留 $(inherited),然后 Clean + 再 Archive。

2. Swift 库路径不存在

现象:directory not found for .../Metal.xctoolchain/usr/lib/swift/iphoneos 或 NotificationService 报 swiftCompatibility 相关错。

原因:Pods 的 xcconfig 里用了 ${TOOLCHAIN_DIR},在部分环境会指向不存在的 Metal 工具链。

处理:

给主 App 和 NotificationService 的 Library Search Paths 增加:

$(DEVELOPER_DIR)/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/$(PLATFORM_NAME)

在 Podfile 的 post_install 里把上述 TOOLCHAIN_DIR 路径替换成 DEVELOPER_DIR 的路径(文档里有完整脚本)。

若该 Mac 不跑 pod install,就按文档里「方式 B」直接改 Pods 下的 xcconfig 和 frameworks.sh。

3. Category / 重复符号

现象:conflicts with same method from another category 或 overrides method from class,然后链接失败或 dylibToOrdinal。

原因:同一方法在主类和 Category、或两个 Category 里都有实现。

处理:只保留一处实现;若从主类删实现,一定要在对应 .h 里保留声明。本工程里改过的有:UIView+UL、ULSSZipArchive、ULIMService、ULCommonTag、ULHomeFavoriteListViewController、ULRadioDramaAlbumDetailController、ULRadioDramaCVListController(文档里有表格)。

4. 其他 Mac 上 Jenkins 的推荐顺序

先去掉 -ld_classic,Clean 后 Archive。

若还有 Swift 路径或 NotificationService 链接问题,按文档做 Library Search Paths + Podfile/post_install(或手动改 Pods)。

若还有 “conflicts / overrides” 的 ld 警告,按文档第三节和表格逐处去重并补声明。

确保 Jenkins 打包前执行 pod install,且 Xcode 版本/路径一致。

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

友情链接更多精彩内容