赞
踩
上文 WebRTC源码环境搭建_luansxx的专栏-CSDN博客_webrtc环境搭建
增加下列环境变量:
- PATH = %PATH%:Y:\work\webrtc\depot_tools
- DEPOT_TOOLS_WIN_TOOLCHAIN = 0
- GYP_MSVS_OVERRIDE_PATH = C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional
- GYP_MSVS_VERSION = 2017
- WINDOWSSDKDIR = C:\Program Files (x86)\Windows Kits\10
WebRTC 默认用clang编译,但是Windows的 clang 环境配置很麻烦,(clang只是一个编译前端,并未实现C的标准库,C的标准库需要MinGW来提供。),若用 clang 方式构建,可参考:
我们用 vs2017 构建,所以 配置 is_clang=false:
- gn gen --ide=vs2017 --args="is_clang=false is_debug=false target_cpu=\"x86\"" out\Msvc2017-32
- gn gen --ide=vs2017 --args="is_clang=false target_cpu=\"x86\" enable_iterator_debugging=true" out\Msvc2017-32d
自己的项目用ninja编译的问题
字符集问题,编译器警告,警告太多还会导致 ninja 没有输出详细错误详细
解决:
忽略该警告
cflags += [ "/wd4828" ] # charset
rtti 运行时类型安全问题
解决:
增加 rtti 选项
异常选项
解决:
打开异常
cflags += [ ""/EHsc" ] # exception throw
configs += [ "//build/config/compiler:rtti" ]
poison codec 问题(gn no_deps)
解决:
允许不建议的音视频编解码
allow_poison = [ "audio_codecs", "software_video_codecs" ]
rumtime type 问题
boost lib 是 dynamic runtime
webrtc 默认 static runtime
解决:(临时方案)
修改默认 runtime
参考:
/MD, /MT, /LD (Use Run-Time Library) /MD, -MT, -LD (Use Run-Time Library) | Microsoft Docs
diff --git a/config/win/BUILD.gn b/config/win/BUILD.gn
index 995638a..e5754a9 100644
--- a/config/win/BUILD.gn
+++ b/config/win/BUILD.gn
@@ -442,7 +442,7 @@ config("default_crt") {
configs = [ ":dynamic_crt" ]
} else {
# Desktop Windows: static CRT.
- configs = [ ":static_crt" ]
+ configs = [ ":dynamic_crt" ]
}
}
}
显示include树,太多会导致 ninja 没有输出详细错误详细
解决:(临时方案)
删除 /showIncludes 选项
diff --git a/toolchain/win/BUILD.gn b/toolchain/win/BUILD.gn
index a7d7bfd..ea2affd 100644
--- a/toolchain/win/BUILD.gn
+++ b/toolchain/win/BUILD.gn
@@ -185,7 +185,7 @@ template("msvc_toolchain") {
"$object_subdir/{{source_name_part}}.obj",
]
- command = "$env_wrapper$cl /nologo /showIncludes ${clflags} $sys_include_flags{{defines}} {{include_dirs}} {{cflags}} {{cflags_c}} /c {{source}} /Fo{{output}} /
+ command = "$env_wrapper$cl /nologo ${clflags} $sys_include_flags{{defines}} {{include_dirs}} {{cflags}} {{cflags_c}} /c {{source}} /Fo{{output}} /Fd\"$pdbname\"
}
tool("cxx") {
@@ -201,7 +201,7 @@ template("msvc_toolchain") {
"$object_subdir/{{source_name_part}}.obj",
]
- command = "$env_wrapper$cl /nologo /showIncludes ${clflags} $sys_include_flags{{defines}} {{include_dirs}} {{cflags}} {{cflags_cc}} /c {{source}} /Fo{{output}}
+ command = "$env_wrapper$cl /nologo ${clflags} $sys_include_flags{{defines}} {{include_dirs}} {{cflags}} {{cflags_cc}} /c {{source}} /Fo{{output}} /Fd\"$pdbname\
}
openssl 实现冲突
webrtc 用的是 boringssl
解决:
boost 使用 boringssl
websocketcpp 里面也使用 openssl ,改为 boringssl 有一处问题
SSL_R_SHORT_READ 改为 SSL_R_UNEXPECTED_RECORD
diff --git a/webrtc/netengine/websocketpp/websocketpp/transport/asio/security/tls.hpp b/webrtc/netengine/websocketpp/websocketpp/transport/asio/security/tls.hpp
index 8434a5c..c30b74d 100644
--- a/webrtc/netengine/websocketpp/websocketpp/transport/asio/security/tls.hpp
+++ b/webrtc/netengine/websocketpp/websocketpp/transport/asio/security/tls.hpp
@@ -307,7 +307,7 @@ protected:
*/
lib::error_code translate_ec(boost::system::error_code ec) {
if (ec.category() == boost::asio::error::get_ssl_category()) {
- if (ERR_GET_REASON(ec.value()) == SSL_R_SHORT_READ) {
+ if (ERR_GET_REASON(ec.value()) == SSL_R_UNEXPECTED_RECORD) {
return make_error_code(transport::error::tls_short_read);
} else {
// We know it is a TLS related error, but otherwise don't know
字符集问题,_T("是是是") 中的字符集是 gbk
解决:
转换字符集
iconv -f gbk -t utf8
连接错误,bad_cast::~bad_cast() 本地导入
解决:
定义_NO_EXCEPTIONS=1,能够解决问题
问题好像是 MSVCRT.DLL 符号名称错误,已经报告问题
Visual Studio Feedback
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。