升级Xcode15遇B/BL out of range编译错误,求解决方案
解决Xcode15编译报错「B/BL out of range ... to 'grrenderbufferStorageMultisample'」的方案
调整架构范围
打开项目Build Settings,找到Architectures,只保留arm64(iOS项目),删掉armv7这类冗余架构;同时检查Valid Architectures,同步只保留需要的架构,减少链接时的符号寻址范围。增加链接优化参数
在Other Linker Flags里添加-dead_strip,移除未被调用的符号,缩小二进制体积;还可以试试加-rename_section __TEXT __text __TEXT __text,regular,pure_instructions,不少开发者靠这个解决了地址偏移问题。优化编译等级
找到Optimization Level,Debug模式设为Fastest, Smallest [-Os],Release模式保持Fastest, Smallest [-Os],通过代码体积优化缓解地址范围限制。彻底清理缓存
按Cmd+Shift+K清项目缓存,再按Cmd+Option+Shift+K清Derived Data;也可以手动删除~/Library/Developer/Xcode/DerivedData下对应项目的文件夹,之后重新编译。Flutter项目额外处理
升级Flutter到最新稳定版(3.13及以上),官方已修复Xcode15的相关链接问题;在ios/Podfile里添加如下配置后,执行flutter clean && flutter pub get && cd ios && pod install:post_install do |installer| installer.pods_project.targets.each do |target| flutter_additional_ios_build_settings(target) target.build_configurations.each do |config| config.build_settings['OTHER_LDFLAGS'] = '-ld64' end end end
内容的提问来源于stack exchange,提问作者李志强
相关产品推荐
相关产品推荐

