1

我正在尝试使用 OpenSSL 编译 WebRTC M85,并且我必须编辑一些 BUILD.gn 文件以将硬编码的依赖项修改为 BoringSSL。

命令行类似于(简化):

gn gen "intermediate/" --args="target_cpu=\"x64\" rtc_build_ssl=false rtc_ssl_root=\"path/to/openssl/include\""

但是当它运行时我收到这个错误:

ERROR at //third_party/libsrtp/BUILD.gn:118:7: Undefined identifier
if (rtc_build_ssl) {
  ^------------
See //pc/BUILD.gn:135:15: which caused the file to be included.
deps += [ "//third_party/libsrtp" ]

third_party/libsrtp/BUILD.gn 中的代码:

static_library("libsrtp") {
 
  ...
  if (rtc_build_ssl) {
      public_deps += [ "//third_party/boringssl:boringssl" ]
  }
}

通过 pc/BUILD.gn 调用third_party/libsrtp/BUILD.gn:

rtc_library("rtc_pc_base") {
    visibility = [ "*" ]
    ...

    if (rtc_build_libsrtp) {
      deps += [ "//third_party/libsrtp" ]
    }
}

并且 pc/BUILD.gn 直接加载到根 BUILD.gn 中:

if (!build_with_chromium) {
  # Target to build all the WebRTC production code.
  rtc_static_library("webrtc") {

    deps = [
      ":webrtc_common",
      "api:create_peerconnection_factory",
      ...
      "pc:libjingle_peerconnection",
      "pc:peerconnection",
      "pc:rtc_pc",
      "pc:rtc_pc_base",
      "rtc_base",
      ...
    ]
  }
}

因此,似乎在 BUILD.gn 文件中的其他任何地方都可以使用的参数 rtc_build_ssl 没有填充到这个 third_party/libsrtp/BUILD.gn

我对 GN 文件不熟悉,是否需要添加一些内容才能使参数在子包含文件中保持定义?

4

0 回答 0