Xcode26 编译报错 ld: Assertion failed: (it != _dylibToOrdinal.end()), function dyli

3 阅读1分钟

报错信息

ld: Assertion failed: (it != _dylibToOrdinal.end()), function dylibToOrdinal, fileOutputFile.cpp, line 5196.

解决方式

Build Settings -> Other Link Flags 中移除 "-ld64" 和 -ld_classic。
然后在列表末尾添加 "-Xlinker" 和 -allow_dead_duplicates, 每个命令独占一行。

注意

如果Podfile文件中有以下代码, 去除代码,重新 pod install

#            if xcode_version >= 15

#              xcconfig_path = config.base_configuration_reference.real_path

#              xcconfig = File.read(xcconfig_path)

#              if xcconfig.include?("OTHER_LDFLAGS") == false

#                xcconfig = xcconfig + "\n" + 'OTHER_LDFLAGS = $(inherited) "-ld_classic"'

#              else

#                if xcconfig.include?("OTHER_LDFLAGS = $(inherited)") == false

#                  xcconfig = xcconfig.sub("OTHER_LDFLAGS", "OTHER_LDFLAGS = $(inherited)")

#                end

#                if xcconfig.include?("-ld_classic") == false

#                  xcconfig = xcconfig.sub("OTHER_LDFLAGS = $(inherited)", 'OTHER_LDFLAGS = $(inherited) "-ld_classic"')

#                end

#              end

#              File.open(xcconfig_path, "w") { |file| file << xcconfig }

#            end