c++linuxc++17webrtclibc++

Build WebRTC on Linux using host libc++


When attempting to build WebRTC on Linux it has a ton of undefined symbols in both the static and even the shared build. These include basic_string things in the std::__Cr namespace (I guess that is Googles custom libc++?), SSL functions, protobuf stuff, and things like dbus, free among other things.

Configuring it with use_custom_libcxx=false in the gn args it will simply fail to compile due to some emplace function missing in optional.

The host system has an up to date libc++ and clang toolchain installed and available, which is fully aware of said function, however I have not found a way to make the webRTC build aware of it and use that instead.

Preferably I want a static build of libwebrtc, that uses the host libc++ and is compatible with the rest of the code (which uses the host libc++) that will ultimately link libwebrtc.


Solution

  • Regarding building webrtc with use_custom_libcxx=false, I was running into the same issue as you (no matching member function for call to 'emplace'). The problem was actually reported to LLVM in this GitHub issue and there's also a workaround mentioned in there.

    To fix it, simply declare a default constructor and default it outside of the class. In my case, I only had to do that for webrtc::LossBasedBweV2::Config (in modules/congestion_controller/goog_cc/loss_based_bwe_v2.<h/cc>.

    After that, I was able to build webrtc with libstdc++. Worked with both the sysroot provided by webrtc and the host system.