WebRTC 的 XCFramework 更新后的任何 iOS 设备构建错误

问题描述

更新到 WebRTC 的 XCFramework 后出现错误。这是它的手动说明:https://swiftpackageregistry.com/alexpiezo/WebRTC

...missing required architecture armv7...

我不需要 Mac,所以我的步骤是这样的:

gn gen ./out/ios_arm64 --args='target_os="ios" target_cpu="arm64" is_component_build=false is_debug=false ios_deployment_target="10.0" rtc_libvpx_build_vp9=true use_goma=false ios_enable_code_signing=false enable_stripping=true enable_ios_bitcode=false'

gn gen out/ios_x64 --args='target_os="ios" target_cpu="x64" is_component_build=false is_debug=false ios_deployment_target="10.0" rtc_libvpx_build_vp9=true use_goma=false ios_enable_code_signing=false enable_stripping=true enable_ios_bitcode=false'

ninja -C out/ios_arm64 sdk:framework_objc
ninja -C out/ios_x64 sdk:framework_objc

xcodebuild -create-xcframework \
    -framework ./out/ios_arm64/WebRTC.framework \
    -framework ./out/ios_x64/WebRTC.framework \
    -output ./out/WebRTC.xcframework

它适用于 iOS 模拟器和真实设备,但任何 iOS 设备(arm64、armv7)都不起作用。

Undefined symbol: _OBJC_CLASS_$_RTCMediaConstraints
Undefined symbol: _kRTCMediaStreamTrackKindVideo
Undefined symbol: _OBJC_CLASS_$_RTCAudioSessionConfiguration
Undefined symbol: _OBJC_CLASS_$_RTCAudioSession
Undefined symbol: _OBJC_CLASS_$_RTCIceCandidate
Undefined symbol: _OBJC_CLASS_$_RTCIceServer
Undefined symbol: _OBJC_CLASS_$_RTCConfiguration
Undefined symbol: _OBJC_CLASS_$_RTCCallbackLogger
Undefined symbol: _OBJC_CLASS_$_RTCPeerConnectionFactory
Undefined symbol: _OBJC_CLASS_$_RTCDispatcher
Undefined symbol: _OBJC_CLASS_$_RTCDefaultVideoDecoderFactory
Undefined symbol: _OBJC_CLASS_$_RTCSessionDescription
Undefined symbol: _RTCSetMinDebugLogLevel
Undefined symbol: _OBJC_CLASS_$_RTCRtpTransceiverInit
Undefined symbol: _OBJC_CLASS_$_RTCCameraVideoCapturer
Undefined symbol: _OBJC_METACLASS_$_RTCEAGLVideoView
Undefined symbol: _OBJC_CLASS_$_RTCDefaultVideoEncoderFactory
Undefined symbol: _OBJC_CLASS_$_RTCEAGLVideoView

有什么建议我应该怎么做才能克服它?

解决方法

使用以下作为 gn gen 的参数:

--args='target_os="ios" ios_enable_code_signing=false use_xcode_clang=true is_component_build=false rtc_include_tests=false is_debug=false target_cpu="arm64" ios_deployment_target="10.0" rtc_libvpx_build_vp9=false enable_ios_bitcode=false use_goma=false rtc_enable_symbol_export=true enable_dsyms=true enable_stripping=true'

这里的关键是 rtc_enable_symbol_export=true 参数。

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...