About libmediasoupclient build & use

Nice to meet you. I am noob programmer who try to use mediasoup native client. I have successfully compile and build mediasoup server. I really appreciate your hard work and I want to be part of this enormous open-source system ( I did a few test, If i can I will try to share about it ).

Anyway, I try to build libmediasoupclient. I follow your installation guide. I can successfully build libmediasoupclient. But I can’t compile it. I don’t know how to use cmake or other build system so I just use g++ compiler.

Environment
OS : Ubuntu 20.04 ( I tried at 18.04 but I can’t even build libmediasoupclient ) in VMware
gcc : 9.4.0
python3 : 3.8.10
python2 : 2.7.18
cmake : 3.16.3
make : 4.2.1

g++ test.cc -o test.out -I./src -I./src/rtc_base -I./libmediasoupclient/include -L/usr/local/lib -L./src/out/m94/obj -I/usr/include/nlohmann -I./src/third_party/abseil-cpp -lmediasoupclient -std=c++11

Code (test.cc) :

#define WEBRTC_POSIX
#include "nlohmann/json.hpp"
#include "mediasoupclient/mediasoupclient.hpp"
#include <iostream>

int main(){
    using namespace std;
    // mediasoupclient::Initialize();
    cout << mediasoupclient::Version() << endl;

    return 0;
}

I just want to just simply test.
I got this compile fair message

In file included from ./src/api/units/time_delta.h:22,
                 from ./src/api/units/timestamp.h:21,
                 from ./src/api/rtp_headers.h:21,
                 from ./src/api/rtp_packet_info.h:19,
                 from ./src/api/rtp_packet_infos.h:19,
                 from ./src/api/audio/audio_frame.h:20,
                 from ./src/api/audio/audio_mixer.h:16,
                 from ./src/api/peer_connection_interface.h:83,
                 from ./libmediasoupclient/include/PeerConnection.hpp:5,
                 from ./libmediasoupclient/include/Handler.hpp:4,
                 from ./libmediasoupclient/include/Device.hpp:4,
                 from /usr/local/include/mediasoupclient/mediasoupclient.hpp:4,
                 from test.cc:3:
./src/rtc_base/units/unit_base.h: In instantiation of ‘static constexpr Unit_T webrtc::rtc_units_impl::UnitBase<Unit_T>::FromValue(T) [with T = long int; typename std::enable_if<std::is_integral<T>::value>::type* <anonymous> = 0; Unit_T = webrtc::webrtc::webrtc::DataSize]’:
./src/api/units/data_size.h:30:21:   required from ‘static constexpr webrtc::webrtc::webrtc::DataSize webrtc::webrtc::webrtc::DataSize::Bytes(T) [with T = long int]’
./src/api/units/data_rate.h:108:57:   required from here
./src/rtc_base/units/unit_base.h:102:3: error: body of ‘constexpr’ function ‘static constexpr Unit_T webrtc::rtc_units_impl::UnitBase<Unit_T>::FromValue(T) [with T = long int; typename std::enable_if<std::is_integral<T>::value>::type* <anonymous> = 0; Unit_T = webrtc::webrtc::webrtc::DataSize]’ not a return-statement
  102 |   }
      |   ^
./src/rtc_base/units/unit_base.h: In instantiation of ‘static constexpr Unit_T webrtc::rtc_units_impl::UnitBase<Unit_T>::FromValue(T) [with T = long int; typename std::enable_if<std::is_integral<T>::value>::type* <anonymous> = 0; Unit_T = webrtc::webrtc::webrtc::Frequency]’:
./src/api/units/frequency.h:32:21:   required from ‘static constexpr webrtc::webrtc::webrtc::Frequency webrtc::webrtc::webrtc::Frequency::MilliHertz(T) [with T = long int]’
./src/api/units/data_rate.h:124:44:   required from here
./src/rtc_base/units/unit_base.h:97:5: error: ‘one_sided’ is not a member of ‘webrtc::webrtc::webrtc::Frequency’
   97 |     if (Unit_T::one_sided)
      |     ^~
./src/rtc_base/units/unit_base.h:101:12: error: no matching function for call to ‘webrtc::webrtc::webrtc::Frequency::Frequency(long int)’
  101 |     return Unit_T(rtc::dchecked_cast<int64_t>(value));
      |            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ./src/api/units/data_rate.h:23,
                 from ./src/api/call/bitrate_allocation.h:13,
                 from ./src/api/audio_codecs/audio_encoder.h:22,
                 from ./src/api/audio_codecs/audio_encoder_factory.h:19,
                 from ./src/api/peer_connection_interface.h:85,
                 from ./libmediasoupclient/include/PeerConnection.hpp:5,
                 from ./libmediasoupclient/include/Handler.hpp:4,
                 from ./libmediasoupclient/include/Device.hpp:4,
                 from /usr/local/include/mediasoupclient/mediasoupclient.hpp:4,
                 from test.cc:3:
./src/api/units/frequency.h:27:7: note: candidate: ‘constexpr webrtc::webrtc::webrtc::Frequency::Frequency(const webrtc::webrtc::webrtc::Frequency&)’
   27 | class Frequency final : public rtc_units_impl::RelativeUnit<Frequency> {
      |       ^~~~~~~~~
./src/api/units/frequency.h:27:7: note:   no known conversion for argument 1 from ‘long int’ to ‘const webrtc::webrtc::webrtc::Frequency&’
./src/api/units/frequency.h:27:7: note: candidate: ‘constexpr webrtc::webrtc::webrtc::Frequency::Frequency(webrtc::webrtc::webrtc::Frequency&&)’
./src/api/units/frequency.h:27:7: note:   no known conversion for argument 1 from ‘long int’ to ‘webrtc::webrtc::webrtc::Frequency&&’
In file included from ./src/api/units/time_delta.h:22,
                 from ./src/api/units/timestamp.h:21,
                 from ./src/api/rtp_headers.h:21,
                 from ./src/api/rtp_packet_info.h:19,
                 from ./src/api/rtp_packet_infos.h:19,
                 from ./src/api/audio/audio_frame.h:20,
                 from ./src/api/audio/audio_mixer.h:16,
                 from ./src/api/peer_connection_interface.h:83,
                 from ./libmediasoupclient/include/PeerConnection.hpp:5,
                 from ./libmediasoupclient/include/Handler.hpp:4,
                 from ./libmediasoupclient/include/Device.hpp:4,
                 from /usr/local/include/mediasoupclient/mediasoupclient.hpp:4,
                 from test.cc:3:
./src/rtc_base/units/unit_base.h:102:3: error: body of ‘constexpr’ function ‘static constexpr Unit_T webrtc::rtc_units_impl::UnitBase<Unit_T>::FromValue(T) [with T = long int; typename std::enable_if<std::is_integral<T>::value>::type* <anonymous> = 0; Unit_T = webrtc::webrtc::webrtc::Frequency]’ not a return-statement
  102 |   }
      |   ^
./src/rtc_base/units/unit_base.h: In instantiation of ‘static constexpr Unit_T webrtc::rtc_units_impl::UnitBase<Unit_T>::FromValue(T) [with T = long int; typename std::enable_if<std::is_integral<T>::value>::type* <anonymous> = 0; Unit_T = webrtc::webrtc::webrtc::webrtc::DataRate]’:
./src/api/units/data_rate.h:37:21:   required from ‘static constexpr webrtc::webrtc::webrtc::webrtc::DataRate webrtc::webrtc::webrtc::webrtc::DataRate::BitsPerSec(T) [with T = long int]’
./src/api/units/data_rate.h:133:66:   required from here
./src/rtc_base/units/unit_base.h:102:3: error: body of ‘constexpr’ function ‘static constexpr Unit_T webrtc::rtc_units_impl::UnitBase<Unit_T>::FromValue(T) [with T = long int; typename std::enable_if<std::is_integral<T>::value>::type* <anonymous> = 0; Unit_T = webrtc::webrtc::webrtc::webrtc::DataRate]’ not a return-statement

There is a tons of more error messages. But I write a few.

I also tried to build mediasoup-broadcaster-demo. But also got this messages.

/usr/bin/ld: /home/foo/src/webrtc-checkout/src/out/m94/obj/libwebrtc.a(audio_device_alsa_linux.o): in function `webrtc::AudioDeviceLinuxALSA::Terminate() [clone .part.0]':
audio_device_alsa_linux.cc:(.text._ZN6webrtc20AudioDeviceLinuxALSA9TerminateEv.part.0+0x51): undefined reference to `XCloseDisplay'
/usr/bin/ld: /home/foo/src/webrtc-checkout/src/out/m94/obj/libwebrtc.a(audio_device_alsa_linux.o): in function `webrtc::AudioDeviceLinuxALSA::KeyPressed() const':
audio_device_alsa_linux.cc:(.text._ZNK6webrtc20AudioDeviceLinuxALSA10KeyPressedEv+0x35): undefined reference to `XQueryKeymap'
/usr/bin/ld: /home/foo/src/webrtc-checkout/src/out/m94/obj/libwebrtc.a(audio_device_alsa_linux.o): in function `webrtc::AudioDeviceLinuxALSA::Init()':
audio_device_alsa_linux.cc:(.text._ZN6webrtc20AudioDeviceLinuxALSA4InitEv+0x53): undefined reference to `XOpenDisplay'
/usr/bin/ld: /home/foo/src/webrtc-checkout/src/out/m94/obj/libwebrtc.a(audio_device_pulse_linux.o): in function `webrtc::AudioDeviceLinuxPulse::KeyPressed() const':
audio_device_pulse_linux.cc:(.text._ZNK6webrtc21AudioDeviceLinuxPulse10KeyPressedEv+0x35): undefined reference to `XQueryKeymap'
/usr/bin/ld: /home/foo/src/webrtc-checkout/src/out/m94/obj/libwebrtc.a(audio_device_pulse_linux.o): in function `webrtc::AudioDeviceLinuxPulse::Terminate() [clone .part.0]':
audio_device_pulse_linux.cc:(.text._ZN6webrtc21AudioDeviceLinuxPulse9TerminateEv.part.0+0x7d): undefined reference to `XCloseDisplay'
/usr/bin/ld: /home/foo/src/webrtc-checkout/src/out/m94/obj/libwebrtc.a(audio_device_pulse_linux.o): in function `webrtc::AudioDeviceLinuxPulse::Init()':
audio_device_pulse_linux.cc:(.text._ZN6webrtc21AudioDeviceLinuxPulse4InitEv+0x63): undefined reference to `XOpenDisplay'
/usr/bin/ld: /home/foo/src/webrtc-checkout/src/out/m94/obj/libwebrtc.a(message_pump_glib.o): in function `base::MessagePumpGlib::FdWatchController::StopWatchingFileDescriptor()':
message_pump_glib.cc:(.text._ZN4base15MessagePumpGlib17FdWatchController26StopWatchingFileDescriptorEv+0x1c): undefined reference to `g_source_destroy'
/usr/bin/ld: message_pump_glib.cc:(.text._ZN4base15MessagePumpGlib17FdWatchController26StopWatchingFileDescriptorEv+0x25): undefined reference to `g_source_unref'
/usr/bin/ld: /home/foo/src/webrtc-checkout/src/out/m94/obj/libwebrtc.a(message_pump_glib.o): in function `base::MessagePumpGlib::~MessagePumpGlib()':
message_pump_glib.cc:(.text._ZN4base15MessagePumpGlibD2Ev+0x20): undefined reference to `g_source_destroy'
/usr/bin/ld: message_pump_glib.cc:(.text._ZN4base15MessagePumpGlibD2Ev+0x2a): undefined reference to `g_source_unref'
/usr/bin/ld: message_pump_glib.cc:(.text._ZN4base15MessagePumpGlibD2Ev+0x76): undefined reference to `g_main_context_pop_thread_default'
/usr/bin/ld: message_pump_glib.cc:(.text._ZN4base15MessagePumpGlibD2Ev+0x80): undefined reference to `g_main_context_unref'
/usr/bin/ld: /home/foo/src/webrtc-checkout/src/out/m94/obj/libwebrtc.a(message_pump_glib.o): in function `base::MessagePumpGlib::Run(base::MessagePump::Delegate*)':
message_pump_glib.cc:(.text._ZN4base15MessagePumpGlib3RunEPNS_11MessagePump8DelegateE+0x6b): undefined reference to `g_main_context_iteration'
/usr/bin/ld: /home/foo/src/webrtc-checkout/src/out/m94/obj/libwebrtc.a(message_pump_glib.o): in function `base::MessagePumpGlib::MessagePumpGlib()':
message_pump_glib.cc:(.text._ZN4base15MessagePumpGlibC2Ev+0x70): undefined reference to `g_main_context_new'
/usr/bin/ld: message_pump_glib.cc:(.text._ZN4base15MessagePumpGlibC2Ev+0x7c): undefined reference to `g_main_context_push_thread_default'
/usr/bin/ld: message_pump_glib.cc:(.text._ZN4base15MessagePumpGlibC2Ev+0xb8): undefined reference to `g_source_new'
/usr/bin/ld: message_pump_glib.cc:(.text._ZN4base15MessagePumpGlibC2Ev+0xcd): undefined reference to `g_source_add_poll'
/usr/bin/ld: message_pump_glib.cc:(.text._ZN4base15MessagePumpGlibC2Ev+0xdb): undefined reference to `g_source_set_priority'
/usr/bin/ld: message_pump_glib.cc:(.text._ZN4base15MessagePumpGlibC2Ev+0xe9): undefined reference to `g_source_set_can_recurse'
/usr/bin/ld: message_pump_glib.cc:(.text._ZN4base15MessagePumpGlibC2Ev+0xf6): undefined reference to `g_source_attach'
/usr/bin/ld: message_pump_glib.cc:(.text._ZN4base15MessagePumpGlibC2Ev+0x109): undefined reference to `g_main_context_default'
/usr/bin/ld: /home/foo/src/webrtc-checkout/src/out/m94/obj/libwebrtc.a(message_pump_glib.o): in function `base::MessagePumpGlib::FdWatchController::InitOrUpdate(int, int, base::WatchableIOMessagePumpPosix::FdWatcher*)':
message_pump_glib.cc:(.text._ZN4base15MessagePumpGlib17FdWatchController12InitOrUpdateEiiPNS_27WatchableIOMessagePumpPosix9FdWatcherE+0x6b): undefined reference to `g_source_new'
/usr/bin/ld: message_pump_glib.cc:(.text._ZN4base15MessagePumpGlib17FdWatchController12InitOrUpdateEiiPNS_27WatchableIOMessagePumpPosix9FdWatcherE+0x7b): undefined reference to `g_source_add_poll'
/usr/bin/ld: message_pump_glib.cc:(.text._ZN4base15MessagePumpGlib17FdWatchController12InitOrUpdateEiiPNS_27WatchableIOMessagePumpPosix9FdWatcherE+0x89): undefined reference to `g_source_set_can_recurse'
/usr/bin/ld: message_pump_glib.cc:(.text._ZN4base15MessagePumpGlib17FdWatchController12InitOrUpdateEiiPNS_27WatchableIOMessagePumpPosix9FdWatcherE+0x98): undefined reference to `g_source_set_callback'
/usr/bin/ld: message_pump_glib.cc:(.text._ZN4base15MessagePumpGlib17FdWatchController12InitOrUpdateEiiPNS_27WatchableIOMessagePumpPosix9FdWatcherE+0xa6): undefined reference to `g_source_set_priority'
/usr/bin/ld: /home/foo/src/webrtc-checkout/src/out/m94/obj/libwebrtc.a(message_pump_glib.o): in function `base::MessagePumpGlib::FdWatchController::Attach(base::MessagePumpGlib*)':
message_pump_glib.cc:(.text._ZN4base15MessagePumpGlib17FdWatchController6AttachEPS0_+0x22): undefined reference to `g_source_attach'
/usr/bin/ld: /home/foo/src/webrtc-checkout/src/out/m94/obj/libwebrtc.a(message_pump_glib.o): in function `base::MessagePumpGlib::WatchFileDescriptor(int, bool, int, base::MessagePumpGlib::FdWatchController*, base::WatchableIOMessagePumpPosix::FdWatcher*)':
message_pump_glib.cc:(.text._ZN4base15MessagePumpGlib19WatchFileDescriptorEibiPNS0_17FdWatchControllerEPNS_27WatchableIOMessagePumpPosix9FdWatcherE+0x45): undefined reference to `g_source_attach'
collect2: error: ld returned 1 exit status
make[2]: *** [CMakeFiles/broadcaster.dir/build.make:124: broadcaster] Error 1
make[2]: Leaving directory '/home/foo/src/webrtc-checkout/mediasoup-broadcaster-demo/build'
make[1]: *** [CMakeFiles/Makefile2:453: CMakeFiles/broadcaster.dir/all] Error 2
make[1]: Leaving directory '/home/foo/src/webrtc-checkout/mediasoup-broadcaster-demo/build'
make: *** [Makefile:130: all] Error 2
make: Leaving directory '/home/foo/src/webrtc-checkout/mediasoup-broadcaster-demo/build'

I think this is about libwebrtc issue. So I tried to figure it out by myself. I spent almost 3 month to figure it out. But I can’t. I know that I should not post libwebrtc questions in this group. But I don’t know where to ask, So I make mind to ask your help.

I want to know your libwebrtc branches. And your compile code.

I am so sorry If I violate mediasoup group rule. If it makes trouble I will delete it by myself.

Thank you for reading it and understading my poor english

Hi,

You can take a look at GitHub - versatica/mediasoup-broadcaster-demo: mediasoup broadcaster demo (libmediasoupclient) which is a small demo project using mediasoup so you can properly build your example.