You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

开启rtc_use_h264编译iOS平台WebRTC时出现libtool错误

解决WebRTC iOS编译中libffmpeg_internal.a.rsp为空的错误

你在编译针对iOS arm64架构的WebRTC时,碰到了ffmpeg静态库构建失败的问题,具体表现为libtool提示obj/third_party/ffmpeg/libffmpeg_internal.a.rsp文件为空。先把你的构建参数和错误日志整理出来方便参考:

你的构建参数

INFO:root:Building WebRTC with args: target_os="ios" ios_enable_code_signing=false use_xcode_clang=true is_component_build=false is_debug=false is_component_build=false rtc_include_tests=false rtc_enable_protobuf=false use_rtti=true use_custom_libcxx=false rtc_use_h264=true ffmpeg_branding="Chrome" is_debug=false target_cpu="arm64" ios_deployment_target="10.0" rtc_libvpx_build_vp9=true enable_ios_bitcode=false use_goma=false enable_dsyms=true enable_stripping=true

错误日志

INFO:root:Building target: framework_objc
ninja: Entering directory `/webrtc-checkout/src/out_ios_libs/arm64_libs'
[85/168] LIBTOOL-STATIC obj/third_party/ffmpeg/libffmpeg_internal.a
FAILED: obj/third_party/ffmpeg/libffmpeg_internal.a
rm -f obj/third_party/ffmpeg/libffmpeg_internal.a && TOOL_VERSION=1592470677 python ../../build/toolchain/mac/filter_libtool.py /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool -static -D -o obj/third_party/ffmpeg/libffmpeg_internal.a -filelist obj/third_party/ffmpeg/libffmpeg_internal.a.rsp
fatal error: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool: file list file: obj/third_party/ffmpeg/libffmpeg_internal.a.rsp is empty

下面是几个针对性的解决方法,你可以按顺序尝试:

  • 清理构建目录,重新生成配置
    rsp文件为空大概率是之前的构建缓存或中间文件损坏导致的。先删掉当前的输出目录,再重新生成构建配置并编译:

    rm -rf out_ios_libs/arm64_libs
    gn gen out_ios_libs/arm64_libs --args='target_os="ios" ios_enable_code_signing=false use_xcode_clang=true is_component_build=false is_debug=false rtc_include_tests=false rtc_enable_protobuf=false use_rtti=true use_custom_libcxx=false rtc_use_h264=true ffmpeg_branding="Chrome" target_cpu="arm64" ios_deployment_target="10.0" rtc_libvpx_build_vp9=true enable_ios_bitcode=false use_goma=false enable_dsyms=true enable_stripping=true'
    ninja -C out_ios_libs/arm64_libs framework_objc
    
  • 排查ffmpeg相关参数的兼容性
    你启用了rtc_use_h264=true和ffmpeg_branding="Chrome",这两个参数依赖WebRTC对ffmpeg的补丁是否和当前Xcode工具链兼容。可以先临时禁用H264(把rtc_use_h264改成false)尝试构建,如果能成功,说明问题出在H264相关的配置上,这时候可以考虑切换到WebRTC的稳定分支(比如m115、m120这类经过验证的版本),或者检查代码库中ffmpeg的补丁是否完整。

  • 确认Xcode工具链版本匹配
    WebRTC对Xcode版本有严格要求,不同分支对应不同的Xcode版本(比如m115分支推荐Xcode 14.3及以上)。你可以先确认当前使用的Xcode版本是否符合要求,用下面的命令切换到指定版本的工具链:

    # 查看当前工具链路径
    xcode-select -p
    # 切换到符合要求的Xcode,比如Xcode 14.3
    sudo xcode-select -s /Applications/Xcode_14.3.app/Contents/Developer
    
  • 确保第三方依赖同步完整
    有时候依赖拉取不完整会导致ffmpeg的目标文件无法生成,进而导致rsp文件为空。运行下面的命令重新同步所有依赖:

    gclient sync --with_branch_heads --with_tags
    

内容的提问来源于stack exchange,提问作者Chaos Lucas

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.08 09:32:28