最新的webrtc(M79)在win10+vs2019下编译

最新的webrtc(M79)在win10+vs2019下编译时可能会出现STL100 error: need clang10及以上版本:

解决方法:

加上:is_clang=false

gn gen out/Release "--args=is_debug=false is_clang=false"

 

由于需要支持h264,所以只能硬着打开clang了。

gn gen out/debug "--args=rtc_use_h264=true clang_use_chrome_plugins =false" --ide=vs2019

开始踩坑了....

1、webrtc STL1000: Unexpected compiler version, expected Clang 10.0.0 or newer.

webrtc的clang版本是9.0.0,可是vs2019要求是10.0.0 ???

2、一些-Werror 的问题,很是崩溃....

问题:

1)../../rtc_base/random.cc(52,21): error: implicit conversion from 'unsigned long long' to 'double' changes value from 18446744073709551614 to 18446744073709551616 [-Werror,-Wimplicit-int-float-conversion]
  result = result / 0xFFFFFFFFFFFFFFFEull;   

2)../../rtc_tools/frame_editing/frame_editing.cc(89,25): error: object backing the pointer will be destroyed at the end of the full-expression [-Werror,-Wdangling-gsl]
  const char* in_path = parser.GetFlag("in_path").c_str();

...

 const char* out_path = parser.GetFlag("out_path").c_str();

改为:

  std::string in_path_s = parser.GetFlag("in_path");
  const char* in_path = in_path_s.c_str();

....

  std::string out_path_s = parser.GetFlag("out_path");
  const char* out_path = out_path_s.c_str();

 

3)../../test/logging/memory_log_writer.cc(46,29): error: class with destructor marked 'final' cannot be inherited from [-Werror,-Wfinal-dtor-non-final-class]
  ~MemoryLogWriterFactory() final {}

注掉 final

4)../../third_party/ffmpeg/libavformat/utils.c(1214,17): error: misleading indentation; statement is not part of the previous 'if' [-Werror,-Wmisleading-indentation]
                pktl->pkt.duration = duration;
                ^
../../third_party/ffmpeg/libavformat/utils.c(1211,13): note: previous statement is here
            if (!st->internal->avctx->has_b_frames)

  删除pktl->pkt.duration = duration;前面多余的空格 

5)../../third_party/ffmpeg/libavformat/matroskadec.c(2128,40): error: implicit conversion from 'unsigned long long' to 'double' changes value from 18446744073709551615 to 18446744073709551616 [-Werror,-Wimplicit-int-float-conversion]
                if (default_duration > UINT64_MAX || default_duration < 0) {

6)../../third_party/ffmpeg/libavformat/utils.c(2703,40): error: implicit conversion from 'long long' to 'double' changes value from 9223372036854775807 to 9223372036854775808 [-Werror,-Wimplicit-int-float-conversion]
        if (bitrate >= 0 && bitrate <= INT64_MAX)

7)../../third_party/ffmpeg/libavformat/avio.c(59,137): error: implicit conversion from 'long long' to 'double' changes value from 9223372036854775807 to 9223372036854775808 [-Werror,-Wimplicit-int-float-conversion]
    {"rw_timeout", "Timeout for IO operations (in microseconds)", offsetof(URLContext, rw_timeout), AV_OPT_TYPE_INT64, { .i64 = 0 }, 0, INT64_MAX, AV_OPT_FLAG_ENCODING_PARAM | AV_OPT_FLAG_DECODING_PARAM },

....

....

.....

陆续有来....

 

经过一番分析,终于得到解决方法:

1、问题1的解决方法:

clang(官方)https://github.com/llvm/llvm-project/releases/download/llvmorg-10.0.0/LLVM-10.0.0-win64.exe 下载后安装,

或者用vs2019中的clang,把安装后的bin和lib库copy到webrtc/src/third_party/llvm-build/Release+Asserts下,

记住,原来bin还有其它工具程序,不要删除,反正我是copy进去的,lib下是clang/10.10.0目录,旧的9.0.0留着没影响。

2、问题2的解决方法:

在webrtc\src\build\config\clang\BUILD.gn中的

config("extra_warnings") {
  cflags = [

...

....

    "-Wno-implicit-fallthrough",
    "-Wno-implicit-int-float-conversion",
    "-Wno-misleading-indentation",
    "-Wno-dangling-gsl",
    "-Wno-final-dtor-non-final-class",
  ]
}

此文件需注意空格与tab键的区分。

3、加了-Wno-misleading-indentation,在yam模块中还是不行:

../../third_party/yasm/source/patched-yasm/tools/re2c/code.c(464,6): error: misleading indentation; statement is not part of the previous 'for' [-Werror,-Wmisleading-indentation]
            if (dFlag)

去掉空格吧,我跪了.......

4、终于编译过去了,不知道是否可以用了,验证去了。

 

 

评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值