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

Windows 10编译Firebase C++ SDK 11.x版本遇CMake构建错误

Windows 10下编译Firebase C++ SDK 11.3.0/11.4.0时CMake构建失败的排查方案

问题场景

  • 系统:Windows 10
  • SDK版本:11.4.0、11.3.0
  • 环境:CMake 3.27.4,VS Community 2019/2022
  • 操作步骤:通过git clone https://github.com/firebase/firebase-cpp-sdk.git拉取源码,执行命令:
    mkdir desktop_build && cd desktop_build
    cmake -G “Visual Studio 16 2019” ..
    
  • 错误信息:
    CMake Error at desktop_build/external/src/firestore/cmake/firebase_utils.cmake:87 (message):
      firebase_execute_process(): command failed with non-zero exit code 1:
      C:/Program Files/CMake/bin/cmake.exe --build .  -- (working directory:
      E:/Program
      Files/Firebase/firebase-cpp-sdk-11.4.0/desktop_build/external/src/firestore-build/external)
    Call Stack (most recent call first):
      desktop_build/external/src/firestore/cmake/external_rules.cmake:61 (firebase_execute_process)
      desktop_build/external/src/firestore/CMakeLists.txt:118 (download_external_sources)
    

排查与解决步骤

1. 修复路径与权限问题

  • 源码路径包含空格(E:/Program Files/Firebase/...),CMake对带空格的路径处理易出异常。建议将SDK迁移到无空格路径,比如E:/Firebase/firebase-cpp-sdk-11.4.0,重新执行构建。
  • 以管理员权限运行VS和CMake,避免权限不足导致依赖下载或构建失败。

2. 修正CMake生成器引号

  • 命令中使用了中文全角引号“Visual Studio 16 2019”,CMake无法正确识别生成器。替换为英文半角引号:
    cmake -G "Visual Studio 16 2019" ..
    

3. 清理缓存后重新构建

  • 删除旧构建目录,避免缓存干扰:
    rmdir /s /q desktop_build
    mkdir desktop_build && cd desktop_build
    cmake -G "Visual Studio 16 2019" ..
    

4. 检查依赖下载状态

  • 错误源于Firestore外部依赖构建失败,大概率是依赖下载不完整或超时。检查desktop_build/external/src/firestore-build/external目录下文件是否完整,切换稳定网络后重新尝试。
  • 若需代理,可添加参数配置:
    cmake -G "Visual Studio 16 2019" -DCMAKE_PROXY_URL=http://your-proxy:port ..
    

5. 匹配VS版本与CMake生成器

  • 若使用VS 2022,对应生成器应为"Visual Studio 17 2022",执行命令:
    cmake -G "Visual Studio 17 2022" ..
    
  • 可尝试降级CMake到3.26.x版本,测试是否兼容问题。

6. 获取详细错误日志

  • 添加--verbose参数执行CMake,查看具体失败环节:
    cmake -G "Visual Studio 16 2019" --verbose ..
    
  • 或直接进入E:/Program Files/Firebase/firebase-cpp-sdk-11.4.0/desktop_build/external/src/firestore-build/external目录,手动执行cmake --build .,定位具体错误。

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.07.10 17:23:31