Skip to content

Xcode15使用问题汇总

macos升级到Sonama版本后,必须升级Xcode到15版本。
该记录的Xcode版本为: Version 15.0 (15A240d)

问题1:

c
clang: error: unable to execute command: Segmentation fault: 11
clang: error: linker command failed due to signal (use -v to see invocation)
clang: error: unable to execute command: Segmentation fault: 11
clang: error: linker command failed due to signal (use -v to see invocation)

解决: Project->target->Build Settings->Other linker Flags 路径下,添加 -ld64

Xcode15采用了新的链接器(Linker),被称作“ld_prime”。新的连接器有诸多好处,尤其是对合并库的支持方面,具体可以查看WWDC 2023 SESSION 10268 Meet mergeable libraries.

问题2:

c
Command PhaseScriptExecution failed with a nonzero exit code
Command PhaseScriptExecution failed with a nonzero exit code

估计是Cocoapods版本的问题,解决方法,搜索source="$(readlink "${source}")"并改成 source="$(readlink -f "${source}")"

或者升级版本也能解决: brew upgrade cocoapods

问题3:

c
clang: error: SDK does not contain 'libarclite' at the path '/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/arc/libarclite_iphoneos.a'; try increasing the minimum deployment target
clang: error: SDK does not contain 'libarclite' at the path '/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/arc/libarclite_iphoneos.a'; try increasing the minimum deployment target

历史原因,场景的项目设置的最低版本为10.0。 依赖pods的版本很多都是8.0。将pods最低版本修改为10.0即可
修改方式:

  1. 手动修改 Minimum Deployments改成10.0
  2. 或者修改pod脚本:
ruby
post_install do |installer|
  installer.pods_project.targets.each do |target|
    target.build_configurations.each do |config|
      config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "arm64"
      if config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'].to_f < 10.0
        config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '10.0'
      end
    end
  end
end
post_install do |installer|
  installer.pods_project.targets.each do |target|
    target.build_configurations.each do |config|
      config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "arm64"
      if config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'].to_f < 10.0
        config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '10.0'
      end
    end
  end
end