linking against other libwebrtc binaries errors out on missing symbols
I have a build where it builds libwebrtc from the chromium tree from scratch, but it seems to be missing symbols that snowflake needs. My guess is that the symbols change often in libwebrtc given there is no release ever, so the go-webrtc build needs to be pinned against a very specific version of libwebrtc.
Here's the build where I run go-webrtc's ./build.sh script: https://gitlab.com/eighthave/snowflake/-/jobs/112538917
$ go get ./...
# github.com/keroserene/go-webrtc
/tmp/go-build263677836/b053/_x008.o: In function `CGO_DeserializeSDP':
/go/src/github.com/keroserene/go-webrtc/peerconnection.cc:379: undefined reference to `webrtc::JsepSessionDescription::JsepSessionDescription(std::string const&)'
/go/src/github.com/keroserene/go-webrtc/peerconnection.cc:382: undefined reference to `webrtc::SdpDeserialize(std::string const&, webrtc::JsepSessionDescription*, webrtc::SdpParseError*)'
/tmp/go-build263677836/b053/_x008.o: In function `CGO_AddIceCandidate':
/go/src/github.com/keroserene/go-webrtc/peerconnection.cc:421: undefined reference to `webrtc::CreateIceCandidate(std::string const&, int, std::string const&, webrtc::SdpParseError*)'
/tmp/go-build263677836/b053/_x008.o: In function `Peer::Initialize()':
/go/src/github.com/keroserene/go-webrtc/peerconnection.cc:57: undefined reference to `rtc::Thread::SetName(std::string const&, void const*)'
/go/src/github.com/keroserene/go-webrtc/peerconnection.cc:58: undefined reference to `rtc::Thread::SetName(std::string const&, void const*)'
/tmp/go-build263677836/b053/_x008.o: In function `rtc::ArrayView<bool, -4711l>::ArrayView<bool>(bool*, unsigned long)':
/go/src/github.com/keroserene/go-webrtc/./include/api/array_view.h:157: undefined reference to `rtc::FatalMessage::FatalMessage(char const*, int, std::string*)'
/tmp/go-build263677836/b053/_x008.o: In function `rtc::ArrayView<int, -4711l>::ArrayView<int>(int*, unsigned long)':
/go/src/github.com/keroserene/go-webrtc/./include/api/array_view.h:157: undefined reference to `rtc::FatalMessage::FatalMessage(char const*, int, std::string*)'
Then I ran a build against the official google libwebrtc binaries for Android, and that is missing many more symbols: https://gitlab.com/eighthave/snowflake/-/jobs/112339118
# github.com/keroserene/go-webrtc
peerconnection.cc:379: error: undefined reference to 'webrtc::JsepSessionDescription::JsepSessionDescription(std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> > const&)'
peerconnection.cc:382: error: undefined reference to 'webrtc::SdpDeserialize(std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> > const&, webrtc::JsepSessionDescription*, webrtc::SdpParseError*)'
peerconnection.cc:420: error: undefined reference to 'webrtc::CreateIceCandidate(std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> > const&, int, std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> > const&, webrtc::SdpParseError*)'
peerconnection.cc:55: error: undefined reference to 'rtc::Thread::Thread()'
peerconnection.cc:56: error: undefined reference to 'rtc::Thread::Thread()'
peerconnection.cc:57: error: undefined reference to 'rtc::Thread::SetName(std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> > const&, void const*)'
peerconnection.cc:58: error: undefined reference to 'rtc::Thread::SetName(std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> > const&, void const*)'
peerconnection.cc:59: error: undefined reference to 'rtc::Thread::Start(rtc::Runnable*)'
peerconnection.cc:60: error: undefined reference to 'rtc::Thread::Start(rtc::Runnable*)'
peerconnection.cc:62: error: undefined reference to 'FakeAudioCaptureModule::Create()'
peerconnection.cc:67: error: undefined reference to 'webrtc::CreateBuiltinAudioEncoderFactory()'
peerconnection.cc:68: error: undefined reference to 'webrtc::CreateBuiltinAudioDecoderFactory()'
/go/pkg/gomobile/ndk-toolchains/arm/bin/../lib/gcc/arm-linux-androideabi/4.9.x/../../../../include/c++/4.9.x/string:0: error: undefined reference to 'webrtc::MediaConstraintsInterface::kEnableDtlsSrtp'
/go/pkg/gomobile/ndk-toolchains/arm/bin/../lib/gcc/arm-linux-androideabi/4.9.x/../../../../include/c++/4.9.x/string:0: error: undefined reference to 'webrtc::MediaConstraintsInterface::kEnableDtlsSrtp'
./include/api/peerconnectioninterface.h:1289: error: undefined reference to 'webrtc::CreatePeerConnectionFactory(rtc::Thread*, rtc::Thread*, rtc::Thread*, webrtc::AudioDeviceModule*, rtc::scoped_refptr<webrtc::AudioEncoderFactory>, rtc::scoped_refptr<webrtc::AudioDecoderFactory>, cricket::WebRtcVideoEncoderFactory*, cricket::WebRtcVideoDecoderFactory*)'
./include/rtc_base/copyonwritebuffer.h:49: error: undefined reference to 'rtc::CopyOnWriteBuffer::CopyOnWriteBuffer(unsigned int, unsigned int)'
./include/api/datachannelinterface.h:65: error: undefined reference to 'rtc::CopyOnWriteBuffer::CopyOnWriteBuffer(rtc::CopyOnWriteBuffer const&)'
./include/api/datachannelinterface.h:63: error: undefined reference to 'rtc::CopyOnWriteBuffer::~CopyOnWriteBuffer()'
datachannel.cc:20: error: undefined reference to 'rtc::CopyOnWriteBuffer::~CopyOnWriteBuffer()'
./include/rtc_base/copyonwritebuffer.h:53: error: undefined reference to 'rtc::CopyOnWriteBuffer::~CopyOnWriteBuffer()'
./include/api/datachannelinterface.h:63: error: undefined reference to 'rtc::CopyOnWriteBuffer::~CopyOnWriteBuffer()'
datachannel.cc:20: error: undefined reference to 'rtc::CopyOnWriteBuffer::~CopyOnWriteBuffer()'
./include/rtc_base/copyonwritebuffer.h:49: error: undefined reference to 'rtc::CopyOnWriteBuffer::CopyOnWriteBuffer(unsigned int, unsigned int)'
./include/api/datachannelinterface.h:65: error: undefined reference to 'rtc::CopyOnWriteBuffer::CopyOnWriteBuffer(rtc::CopyOnWriteBuffer const&)'
./include/rtc_base/copyonwritebuffer.h:53: error: undefined reference to 'rtc::CopyOnWriteBuffer::~CopyOnWriteBuffer()'
./include/rtc_base/buffer.h:126: error: undefined reference to 'rtc::FatalMessage::FatalMessage(char const*, int)'
./include/rtc_base/buffer.h:126: error: undefined reference to 'rtc::FatalMessage::~FatalMessage()'
./include/rtc_base/buffer.h:126: error: undefined reference to 'rtc::FatalMessage::~FatalMessage()'
./include/rtc_base/buffer.h:126: error: undefined reference to 'rtc::FatalMessage::~FatalMessage()'
./include/rtc_base/copyonwritebuffer.h:94: error: undefined reference to 'rtc::FatalMessage::FatalMessage(char const*, int)'
./include/rtc_base/copyonwritebuffer.h:94: error: undefined reference to 'rtc::FatalMessage::~FatalMessage()'
./include/rtc_base/buffer.h:141: error: undefined reference to 'rtc::FatalMessage::FatalMessage(char const*, int)'
./include/rtc_base/copyonwritebuffer.h:102: error: undefined reference to 'rtc::FatalMessage::FatalMessage(char const*, int)'
clang70++: error: linker command failed with exit code 1 (use -v to see invocation)
gomobile: go build -v -buildmode=c-shared -o=/tmp/gomobile-work-129978917/android/src/main/jniLibs/armeabi-v7a/libgojni.so gobind failed: exit status 2