Build webrtc M75 as a dll with VS2017

517 views
Skip to first unread message

yuwu tang

unread,
Jul 4, 2019, 4:01:46 AM7/4/19
to discuss-webrtc
Hi,
I am a new developer in WebRTC. Now I have downloaded M75 branch and built it. I want to build it as a dll with VS2017. 
I get the next prompt when build:

gn gen --ide=vs --args="target_os=\"win\" target_cpu=\"x86\" is_debug=false is_component_build=true proprietary_codecs=true rtc_use_h264=true ffmpeg_branding=\"Chrome\"" out\Release
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`.
ERROR at //webrtc.gni:27:3: Assertion failed.
  assert(!is_component_build, "Component builds are not supported in WebRTC.")
  ^-----
Component builds are not supported in WebRTC.
See //BUILD.gn:17:1: whence it was imported.
import("webrtc.gni")
^------------------


Does WebRTC support to build as a shared dll?


I meet some errors when I use the static lib. 

VS2017 prompt some errors like this:
webrtc.lib(jitter_estimator.obj):-1: error: LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in ....ob
And I change configs to :configs = [":dynamic_crt"] . And it fails to build.
How to fix the problem that can not link webrtc.lib?

Thank you very much!

Bo Zhou

unread,
Jul 4, 2019, 5:58:17 AM7/4/19
to discuss-webrtc
WebRTC could not be compiled as shared library EXCEPT with Chromium.

Kunal Jathal

unread,
Jul 5, 2019, 2:32:07 PM7/5/19
to discuss-webrtc
For your second question, check this post:

I was getting the same linker error (LNK2038) and I fixed it.

Fang Yu

unread,
Apr 6, 2021, 12:29:29 PM4/6/21
to discuss-webrtc
Hi, 

I am trying to use `webrtc.lib` on Windows and running into similar build issues.

I asked my question here https://groups.google.com/forum/#!topic/discuss-webrtc/YZaNOPdWG2Y but I posting here as well just in case. I think I am running into the same error mentioned in that thread: `with "rtc_enable_symbol_export" is broken. Tons of errors arise from exported classes with forgotten deletion of copy constructor/assignment operator.`

With just `is_debug = false`, ninja builds fine, but when I try to link it into a desktop app using CMakeLists.txt and build in Visual Studio I got many unresolved external symbol errors, e.g, `error LNK2019: unresolved external symbol "public: __cdecl webrtc::PeerConnectionInterface::IceServer::IceServer(void)"`

So I am trying to build webrtc.lib using `rtc_enable_symbol_export = true`, but ninja fails now with error, e.g.,
../../buildtools/third_party/libc++/trunk/include\memory(2528,3): note: copy constructor is implicitly deleted because 'unique_ptr<const webrtc::RTCStats, std::__1::default_delete<const webrtc::RTCStats>>' has a user-declared move constructor
  unique_ptr(unique_ptr&& __u) _NOEXCEPT
  ^

Did you get a working version of `webrtc.lib`?

Thanks a lot!
Reply all
Reply to author
Forward
0 new messages