Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to compile WebRTC properly with Visual Studio in debug?

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?

like image 458
Mike Barriault Avatar asked Sep 15 '25 02:09

Mike Barriault


1 Answers

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

like image 159
Victor Avatar answered Sep 16 '25 18:09

Victor