4

I'm trying to compile WebRTC, but because we use a number of libraries, some of which are closed source and beyond our control, how it gets compiled is rather sensitive to match. I've already had to edit the build/config/win/BUILD.gn script to use /MDd and /MD build flags instead of /MTd and /MT respectively, as we use the multi-threaded DLL runtime. To build, we run

gn gen out/Debug --args="is_debug=true is_clang=false use_lld=false visual_studio_version=2019"
ninja -C out/Debug

However, when linking against webrtc.lib, it fails with multiple errors citing a mismatch between _ITERATOR_DEBUG_LEVEL. I've seen this error plenty, it happens when linking a release-built library (_ITERATOR_DEBUG_LEVEL=2) with a debug executable (_ITERATOR_DEBUG_LEVEL=0). However that's clearly not how I've compiled it. I've tried adding /DEBUG (which should be implied by /MDd as far as I know) but it produces an identical library with the same issue. I've confirmed checking the generated .ninja scripts that these arguments are in the cflags.

Is there a way to get ninja to properly observe the debug flags?

  • You really cannot. Use ninja and other build tools that WebRTC native API documentation recommends. I tried to create a Visual Studio build for two months, got older by 5 years during that time, failed and gave up. – user1390208 Jan 31 '20 at 22:48

2 Answers2

3

I had the same issue. Although, WebRTC is a powerful library, it looks terrible for native development. Neither good documentation nor examples, especially for using outside Google sources. Please, try this one argument, that helped me: enable_iterator_debugging=true

Kirill Chernikov
  • 1,387
  • 8
  • 21
Victor
  • 31
  • 2
0

I don't deal with libwebrtc myself, but I have heard that long term you might have a better experience pulling out all the files and using your own build system. Orchid did this, but I haven't looked at it myself.

There are other C/C++ WebRTC implementations if you are doing DataChannels only that might be helpful also!

Sean DuBois
  • 3,972
  • 1
  • 11
  • 22
  • Literally the only thing we're using is Peer Connection API to send a single video stream from our application to a browser running on a trusted device on the same network. I've looked around at alternative implementations but the ones I've found are either defunct or are limited in scope. – Mike Barriault Feb 01 '20 at 20:17