windows编译webrtc静态库x86版本

windows编译webrtc

  • licode 客户端需要webrtc
  • webrtc版本似乎较老了
  • is_component_build 是chrome用来编译动态库而非静态库的
  • 但是webrtc库一定是静态库,所以这个选项无用
The Gn argument `is_component_build` is currently ignored for WebRTC builds.
Component builds are supported by Chromium and the argument `is_component_build` makes it possible to create shared libraries instead of static libraries.
If an app depends on WebRTC it makes sense to just depend on the WebRTC static library, so there is no difference between `is_component_build=true` and `is_component_build=false`.

看不到webrtc版本的

PS E:\rrrtc\hjrtc\webrtc-checkout> gclient revinfo -a
src: https://webrtc.googlesource.com/src.git@3ee3c40f95ebf36ab45fcf49c4374d0184068b19
src/base: https://chromium.googlesource.com/chromium/src/base@2b324906836a034cccde270d9446851c0ea81e0a
src/build: https://chromium.googlesource.com/chromium/src/build@64006c6a4c7f0a3b40ede10f27a813eaac60b76d
src/buildtools: https://chromium.googlesource.com/chromium/buildtools.git@2dff9c9c74e9d732e6fe57c84ef7fd044cc45d96
src/testing: https://chromium.googlesource.com/chromium/src/testing@3915e3c26566b5abd3a224a43cb290c1b62f9c4e
src/third_party: https://chromium.googlesource.com/chromium/src/third_party@b7885b25e46ea357e88f6e8820abdbe03e4862b6
src/third_party/boringssl/src: https://boringssl.googlesource.com/boringssl.git@7f4f41fa81c03e0f8ef1ab5b3d1d566b5968f107
src/third_party/catapult: https://chromium.googlesource.com/catapult.git@985f6fe58181316d5bcb8bd9b04682b331d9df3c
src/third_party/colorama/src: https://chromium.googlesource.com/external/colorama.git@799604a1041e9b3bc5d2789ecbd7e8db2e18e6b8
src/third_party/depot_tools: https://chromium.googlesource.com/chromium/tools/depot_tools.git@f837545214f5a8666c49f02c3b717bdc04604f7a
src/third_party/ffmpeg: https://chromium.googlesource.com/chromium/third_party/ffmpeg.git@90210b5e10d3917567a3025e4853704bfefd8384
src/third_party/freetype/src: https://chromium.googlesource.com/chromium/src/third_party/freetype2.git@dfddc2d97596489134d21ed6224462331cb1cd73
src/third_party/googletest/src: https://chromium.googlesource.com/external/github.com/google/googletest.git@2e68926a9d4929e9289373cd49e40ddcb9a628f7
src/third_party/gtest-parallel: https://chromium.googlesource.com/external/github.com/google/gtest-parallel@fe7f791f14769390d0b124ef8231cde4d575eb12
src/third_party/harfbuzz-ng/src: https://chromium.googlesource.com/external/github.com/harfbuzz/harfbuzz.git@22defe0965adddaa09eebc13df7fa6c64e2abba3
src/third_party/icu: https://chromium.googlesource.com/chromium/deps/icu.git@7ca3ffa77d635e44b9735e1b54fb9c4da3b6c821
src/third_party/jsoncpp/source: https://chromium.googlesource.com/external/github.com/open-source-parsers/jsoncpp.git@f572e8e42e22cfcf5ab0aea26574f408943edfa4
src/third_party/libFuzzer/src: https://chromium.googlesource.com/chromium/llvm-project/compiler-rt/lib/fuzzer.git@a2d200e6a586f6e291572aafae08e49c71166a5a
src/third_party/libjpeg_turbo: https://chromium.googlesource.com/chromium/deps/libjpeg_turbo.git@61a2bbaa9aec89cb2c882d87ace6aba9aee49bb9
src/third_party/libsrtp: https://chromium.googlesource.com/chromium/deps/libsrtp.git@650611720ecc23e0e6b32b0e3100f8b4df91696c
src/third_party/libvpx/source/libvpx: https://chromium.googlesource.com/webm/libvpx.git@96e1c6b7ce910ed4b7c79069a9d55307bd6dd257
src/third_party/libyuv: https://chromium.googlesource.com/libyuv/libyuv.git@9a07219dc8fbf2b77e390d16bd24809444838a91
src/third_party/openh264/src: https://chromium.googlesource.com/external/github.com/cisco/openh264@3b51f16a4a41df729f8d647f03e48c5f272911ff
src/third_party/usrsctp/usrsctplib: https://chromium.googlesource.com/external/github.com/sctplab/usrsctp@7a8bc9a90ca96634aa56ee712856d97f27d903f8
src/third_party/winsdk_samples: https://webrtc.googlesource.com/deps/third_party/winsdk_samples_v71@a59391ef795986633735a1695caa97622a9bfd56
src/third_party/yasm/binaries: https://chromium.googlesource.com/chromium/deps/yasm/binaries.git@52f9b3f4b0aa06da24ef8b123058bb61ee468881
src/third_party/yasm/source/patched-yasm: https://chromium.googlesource.com/chromium/deps/yasm/patched-yasm.git@720b70524a4424b15fc57e82263568c8ba0496ad
src/tools: https://chromium.googlesource.com/chromium/src/tools@71141cd723175c196fc4261702c7776352915250
src/tools/swarming_client: https://chromium.googlesource.com/infra/luci/client-py.git@486c9b53c4d54dd4b95bb6ce0e31160e600dfc11
src\buildtools\clang_format\script: https://chromium.googlesource.com/chromium/llvm-project/cfe/tools/clang-format.git@0653eee0c81ea04715c635dd0885e8096ff6ba6d
src\buildtools\third_party\libc++\trunk: https://chromium.googlesource.com/chromium/llvm-project/libcxx.git@85a7702b4cc5d69402791fe685f151cf3076be71
src\buildtools\third_party\libc++abi\trunk: https://chromium.googlesource.com/chromium/llvm-project/libcxxabi.git@05a73941f3fb177c4a891d4ff2a4ed5785e3b80c
src\buildtools\third_party\libunwind\trunk: https://chromium.googlesource.com/external/llvm.org/libunwind.git@1e1c6b739595098ba5c466bfe9d58b993e646b48
PS E:\rrrtc\hjrtc\webrtc-checkout>

powershell 执行命令行一直报错

  • 不识别参数,无法生成args.gn文件
gn gen out/zhangbin-Debug32 -ide=vs2019 --args="is_debug=true is_component_build=true target_cpu=\"x86\" is_clang=false ffmpeg_branding=\"Chrome\"  rtc_use_h264=true rtc_include_tests=false "

gn gen --target=x86 --args="is_clang = true use_custom_libcxx = false use_rtti=true rtc_include_tests=false rtc_libvpx_build_vp9=true enable_iterator_debugging=true symbol_level=0 proprietary_codecs=true use_openh264=true ffmpeg_branding=\"Chrome\"" --ide=vs2019 out/x86_debug_zhangbin

在这里插入图片描述

cmd可以,但是我这个webrtc不认识vs2019

  • cmd 里执行可以生成args.gn 文件,但不是vs2019
C:\Users\zhangbin>E:

E:\>cd E:\rrrtc\hjrtc\webrtc-checkout\src

E:\rrrtc\hjrtc\webrtc-checkout\src>gn gen --target=x86 --args="is_clang = true use_custom_libcxx = false use_rtti=true rtc_include_tests=false rtc_libvpx_build_vp9=true enable_iterator_debugging=true symbol_level=0 proprietary_codecs=true use_openh264=true ffmpeg_branding=\"Chrome\"" --ide=vs2019 out/x86_debug_zhangbin
ERROR Unknown IDE: vs2019

E:\rrrtc\hjrtc\webrtc-checkout\src>gn gen --target=x86 --args="is_clang = true use_custom_libcxx = false use_rtti=true rtc_include_tests=false rtc_libvpx_build_vp9=true enable_iterator_debugging=true symbol_level=0 proprietary_codecs=true use_openh264=true ffmpeg_branding=\"Chrome\"" --ide=vs2017 out/x86_debug_zhangbin
Generating Visual Studio projects took 12400ms
Done. Made 589 targets from 176 files in 14401ms

E:\rrrtc\hjrtc\webrtc-checkout\src>

在这里插入图片描述

或者写好一个args.gn放一个目录下

targert_cpu,target_os,这两个是自己需要的,一个是指定x86,另一个指定win系统。不过自己在执行gn命令的时候,老是出错。自己在指定的目录下建立一个文件:args.gn。里面的内容的是:

target_os = "win"
target_cpu = "x86"
然后执行命令就可以了,命令行:gn args out/Debug。生成ninja文件,然后执行就可以了。
ps:

命令行:gn gen out/Default --args='target_os="linux" target_cpu="x86"'

  • 比如 E:\rrrtc\hjrtc\webrtc-checkout\src\out\zhangbin-Debug32 下
is_debug = true
rtc_enable_protobuf = false
rtc_build_ssl = false
rtc_ssl_root = "E:\\rrrtc\\hjrtc\\webrtc-checkout\\src\\third_party\\openssl\include"
target_cpu = "x86"
target_os = "win"
is_clang = false
libyuv_include_tests = false
rtc_include_tests = false
is_component_build = true

  • gn args .\out\zhangbin-Debug32\
PS E:\rrrtc\hjrtc\webrtc-checkout\src> gn args .\out\zhangbin-Debug32\
Waiting for editor on "E:\rrrtc\hjrtc\webrtc-checkout\src\out\zhangbin-Debug32\args.gn"...
interrupted
终止批处理操作吗(Y/N)? Y
PS E:\rrrtc\hjrtc\webrtc-checkout\src> gn args .\out\zhangbin-Debug32\
Waiting for editor on "E:\rrrtc\hjrtc\webrtc-checkout\src\out\zhangbin-Debug32\args.gn"...
Generating files...
The Gn argument `is_component_build` is currently ignored for WebRTC builds.
Component builds are supported by Chromium and the argument `is_component_build` makes it possible to create shared libraries instead of static libraries.
If an app depends on WebRTC it makes sense to just depend on the WebRTC static library, so there is no difference between `is_component_build=true` and `is_component_build=false`.
More info about component builds at: https://chromium.googlesource.com/chromium/src/+/master/docs/component_build.md
Done. Made 541 targets from 166 files in 5528ms
  • 但是这样的不生成vs工程
  • 编译 ninja -C .\out\zhangbin-Debug32\

注意: 包含文件:  E:\rrrtc\hjrtc\webrtc-checkout\src\third_party\yasm\source\patched-yasm\modules/parsers/nasm/nasm-parser.h
注意: 包含文件:   e:\rrrtc\hjrtc\webrtc-checkout\src\third_party\yasm\source\patched-yasm\modules\parsers\nasm\nasm-parser-struct.h
注意: 包含文件:  E:\rrrtc\hjrtc\webrtc-checkout\src\third_party\yasm\source\patched-yasm\modules/preprocs/nasm/nasm.h
[2294/2442] LINK(DLL) boringssl.dll boringssl.dll.lib boringssl.dll.pdb
  正在创建库 ./boringssl.dll.lib 和对象 ./boringssl.dll.exp
[2440/2442] LINK(DLL) webrtc_unity_plugin.dll webrtc_unity_plugin.dll.lib webrtc_unity_plugin.dll.pdb
  正在创建库 ./webrtc_unity_plugin.dll.lib 和对象 ./webrtc_unity_plugin.dll.exp
[2442/2442] STAMP obj/default.stamp

E:\rrrtc\hjrtc\webrtc-checkout\src>

配置参数

不支持ffmpeg和openh264的64位debug版:gn gen --target=x64 --args="is_clang = true use_custom_libcxx = false use_rtti=true rtc_include_tests=false enable_iterator_debugging=true symbol_level=0" --ide=vs2017 out/x64_debug支持ffmpeg和openh264的64位debug版(支持h264编解码):gn gen --target=x64 --args="is_clang = true use_custom_libcxx = false use_rtti=true rtc_include_tests=false rtc_libvpx_build_vp9=true enable_iterator_debugging=true symbol_level=0 proprietary_codecs=true use_openh264=true ffmpeg_branding=\"Chrome\"" --ide=vs2017 out/x64_debug提示done后,会在out/x64_debug目录下生成all.sln,使用vs2017打开就能翻阅webrtc的源码了

  • 我上面cmd的好像生成的不是x86,是默认的x64的
is_clang = true
use_custom_libcxx = false
use_rtti = true
rtc_include_tests = false
rtc_libvpx_build_vp9 = true
enable_iterator_debugging = true
symbol_level = 0
proprietary_codecs = true
use_openh264 = true
ffmpeg_branding = "Chrome"

正确的命令行

gn gen --ide=vs2017 out/x86_debug_zhangbin  --args=" target_cpu=\"x86\" target_os=\"win\" is_clang = true use_custom_libcxx = false use_rtti=true rtc_include_tests=false rtc_libvpx_build_vp9=true enable_iterator_debugging=true symbol_level=0 proprietary_codecs=true use_openh264=true ffmpeg_branding=\"Chrome\"" 
  • args.gn文件
target_cpu = "x86"
target_os = "win"
is_clang = true
use_custom_libcxx = false
use_rtti = true
rtc_include_tests = false
rtc_libvpx_build_vp9 = true
enable_iterator_debugging = true
symbol_level = 0
proprietary_codecs = true
use_openh264 = true
ffmpeg_branding = "Chrome"

在这里插入图片描述

E:\rrrtc\hjrtc\webrtc-checkout\src>gn gen --ide=vs2017 out/x86_debug_zhangbin  --args=" target_cpu=\"x86\" target_os=\"win\" is_clang = true use_custom_libcxx = false use_rtti=true rtc_include_tests=false rtc_libvpx_build_vp9=true enable_iterator_debugging=true symbol_level=0 proprietary_codecs=true use_openh264=true ffmpeg_branding=\"Chrome\""
Generating Visual Studio projects took 13027ms
Done. Made 589 targets from 176 files in 16798ms
  • 在这里插入图片描述
发布了693 篇原创文章 · 获赞 58 · 访问量 220万+

猜你喜欢

转载自blog.csdn.net/commshare/article/details/104881277