Linking webrtc release to my program fail.

591 views
Skip to first unread message

SeTriones

unread,
Dec 6, 2016, 3:18:54 PM12/6/16
to discuss-webrtc
Hello all,
I've compile a new webrtc release with the newest master branch on a x64 Ubuntu 14.04 machine.
I generated the build using gn gen out/Default --args='is_debug=false' following the offical build document.
The compile process seems to be all right, resuling in a lot .a and o. in out/Default.

I collected all the .a files from out/Default., using ar -x to extract all the object files, and ar all the extracted object files as one .a. (e.g. libwebrtc_full.a)

When I link the libwebrtc_full.a to my program on another x64 Ubuntu 14.04 machine, ld report the following errors which seem to be the same type:
Can anyone tell me a proper way to use the release libs?

../../webrtc/modules/audio_device/linux/audio_device_pulse_linux.cc:(.text._ZN6webrtc21AudioDeviceLinuxPulseC2Ei+0x36): undefined reference to `webrtc::EventWrapper::Create()'
../../webrtc/modules/audio_device/linux/audio_device_pulse_linux.cc:(.text._ZN6webrtc21AudioDeviceLinuxPulseC2Ei+0x3f): undefined reference to `webrtc::EventWrapper::Create()'
../../webrtc/modules/audio_device/linux/audio_device_pulse_linux.cc:(.text._ZN6webrtc21AudioDeviceLinuxPulseC2Ei+0x48): undefined reference to `webrtc::EventWrapper::Create()'
../../webrtc/modules/audio_device/linux/audio_device_pulse_linux.cc:(.text._ZN6webrtc21AudioDeviceLinuxPulseC2Ei+0x51): undefined reference to `webrtc::EventWrapper::Create()'
/home/chenbin/package/lib/libwebrtc_full.a(audio_device_pulse_linux.o): In function `webrtc::AudioDeviceLinuxPulse::Init()':
../../webrtc/modules/audio_device/linux/audio_device_pulse_linux.cc:(.text._ZN6webrtc21AudioDeviceLinuxPulse4InitEv+0x4c): undefined reference to `rtc::LogMessage::min_sev_'
../../webrtc/modules/audio_device/linux/audio_device_pulse_linux.cc:(.text._ZN6webrtc21AudioDeviceLinuxPulse4InitEv+0x7d): undefined reference to `rtc::LogMessage::LogMessage(char const*, int, rtc::LoggingSeverity, rtc::LogErrorContext, int, char const*)'
../../webrtc/modules/audio_device/linux/audio_device_pulse_linux.cc:(.text._ZN6webrtc21AudioDeviceLinuxPulse4InitEv+0x99): undefined reference to `rtc::LogMessage::~LogMessage()'
../../webrtc/modules/audio_device/linux/audio_device_pulse_linux.cc:(.text._ZN6webrtc21AudioDeviceLinuxPulse4InitEv+0x154): undefined reference to `rtc::LogMessage::min_sev_'
../../webrtc/modules/audio_device/linux/audio_device_pulse_linux.cc:(.text._ZN6webrtc21AudioDeviceLinuxPulse4InitEv+0x188): undefined reference to `rtc::LogMessage::LogMessage(char const*, int, rtc::LoggingSeverity, rtc::LogErrorContext, int, char const*)'
../../webrtc/modules/audio_device/linux/audio_device_pulse_linux.cc:(.text._ZN6webrtc21AudioDeviceLinuxPulse4InitEv+0x1a4): undefined reference to `rtc::LogMessage::~LogMessage()'
/home/chenbin/package/lib/libwebrtc_full.a(audio_device_alsa_linux.o): In function `webrtc::AudioDeviceLinuxALSA::Init()':
../../webrtc/modules/audio_device/linux/audio_device_alsa_linux.cc:(.text._ZN6webrtc20AudioDeviceLinuxALSA4InitEv+0x54): undefined reference to `rtc::LogMessage::min_sev_'
../../webrtc/modules/audio_device/linux/audio_device_alsa_linux.cc:(.text._ZN6webrtc20AudioDeviceLinuxALSA4InitEv+0x85): undefined reference to `rtc::LogMessage::LogMessage(char const*, int, rtc::LoggingSeverity, rtc::LogErrorContext, int, char const*)'
../../webrtc/modules/audio_device/linux/audio_device_alsa_linux.cc:(.text._ZN6webrtc20AudioDeviceLinuxALSA4InitEv+0xa1): undefined reference to `rtc::LogMessage::~LogMessage()'
../../webrtc/modules/audio_device/linux/audio_device_alsa_linux.cc:(.text._ZN6webrtc20AudioDeviceLinuxALSA4InitEv+0xc5): undefined reference to `rtc::LogMessage::min_sev_'
../../webrtc/modules/audio_device/linux/audio_device_alsa_linux.cc:(.text._ZN6webrtc20AudioDeviceLinuxALSA4InitEv+0xff): undefined reference to `rtc::LogMessage::LogMessage(char const*, int, rtc::LoggingSeverity, rtc::LogErrorContext, int, char const*)'
../../webrtc/modules/audio_device/linux/audio_device_alsa_linux.cc:(.text._ZN6webrtc20AudioDeviceLinuxALSA4InitEv+0x11b): undefined reference to `rtc::LogMessage::~LogMessage()'
main.o: In function `main':
main.cpp:(.text+0x5d4): undefined reference to `rtc::AutoThread::AutoThread()'
main.cpp:(.text+0x653): undefined reference to `rtc::AutoThread::AutoThread()'
main.cpp:(.text+0x7d3): undefined reference to `rtc::Thread::Start(rtc::Runnable*)'
main.cpp:(.text+0x7e7): undefined reference to `rtc::Thread::Start(rtc::Runnable*)'
main.o: In function `std::string cricket::VectorToString<webrtc::RtpExtension>(std::vector<webrtc::RtpExtension, std::allocator<webrtc::RtpExtension> > const&)':
main.cpp:(.text+0x183d): undefined reference to `webrtc::RtpExtension::ToString() const'
Renderer.o: In function `std::string cricket::VectorToString<webrtc::RtpExtension>(std::vector<webrtc::RtpExtension, std::allocator<webrtc::RtpExtension> > const&)':
Renderer.cpp:(.text+0x8f9): undefined reference to `webrtc::RtpExtension::ToString() const'
WebrtcPeer.o: In function `std::string cricket::VectorToString<webrtc::RtpExtension>(std::vector<webrtc::RtpExtension, std::allocator<webrtc::RtpExtension> > const&)':
WebrtcPeer.cpp:(.text+0x791c): undefined reference to `webrtc::RtpExtension::ToString() const'
/home/chenbin/package/lib/libwebrtc_full.a(codec.o): In function `cricket::VideoCodec::ValidateCodecFormat() const':
../../webrtc/media/base/codec.cc:(.text._ZNK7cricket10VideoCodec19ValidateCodecFormatEv+0x21): undefined reference to `rtc::LogMessage::min_sev_'
../../webrtc/media/base/codec.cc:(.text._ZNK7cricket10VideoCodec19ValidateCodecFormatEv+0x59): undefined reference to `rtc::LogMessage::LogMessage(char const*, int, rtc::LoggingSeverity, rtc::LogErrorContext, int, char const*)'
../../webrtc/media/base/codec.cc:(.text._ZNK7cricket10VideoCodec19ValidateCodecFormatEv+0xae): undefined reference to `rtc::LogMessage::~LogMessage()'
../../webrtc/media/base/codec.cc:(.text._ZNK7cricket10VideoCodec19ValidateCodecFormatEv+0x1f1): undefined reference to `rtc::LogMessage::min_sev_'
../../webrtc/media/base/codec.cc:(.text._ZNK7cricket10VideoCodec19ValidateCodecFormatEv+0x226): undefined reference to `rtc::LogMessage::LogMessage(char const*, int, rtc::LoggingSeverity, rtc::LogErrorContext, int, char const*)'

janu...@gmail.com

unread,
Mar 10, 2017, 2:38:50 AM3/10/17
to discuss-webrtc
Any workaround?  I have the same problem. 

在 2016年12月7日星期三 UTC+8上午4:18:54,SeTriones写道:

Henrik Kjellander

unread,
Mar 21, 2017, 2:57:29 AM3/21/17
to discuss-webrtc
Please don't use 'ar' to bundle your own library - instead you should use the built-in available libraries.
If you build the "webrtc" target and you'll end up with libwebrtc.a which is a fat library that contains everything except metrics and field trial implementations, which you'll also need.

To build all of this:
gn gen out/Release --args='is_debug=false'
ninja -C out/Release webrtc field_trial_default metrics_default

Then use these static libraries to link with:
out/Release/obj/webrtc/libwebrtc.a
out/Release/obj/webrtc/system_wrappers/libfield_trial_default.a
out/Release/obj/webrtc/system_wrappers/libmetrics_default.a

Let me know if that works for you.


--

---
You received this message because you are subscribed to the Google Groups "discuss-webrtc" group.
To unsubscribe from this group and stop receiving emails from it, send an email to discuss-webrtc+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/discuss-webrtc/95ba7ce9-e39c-4bd5-97ec-b2b9d2bb7dc6%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

naseeb panghal

unread,
Dec 5, 2017, 3:32:00 AM12/5/17
to discuss-webrtc
I am using out/Default libwebrtc.a library and still get these kind of errors.
Somewhere i read i should use arguments --args="use_custom_libcxx=false use_custom_libcxx_for_host=false" and then build. I have tried that and getting the same error.

~
Naseeb Panghal
To unsubscribe from this group and stop receiving emails from it, send an email to discuss-webrt...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages