Linker can't find CreatePeerConnectionFactory after M77 update

892 views
Skip to first unread message

Joel Sutherland

unread,
Oct 3, 2019, 11:03:55 AM10/3/19
to discuss-webrtc
I'm using this constructor:

#include <api/create_peerconnection_factory.h>

...............

        m_PeerConnectionFactory = webrtc::CreatePeerConnectionFactory(

            m_NetworkThread.get(),                      // network thread - needs to be with CreateWithSocketServer

            m_WorkerThread.get(),                       // worker thread

            m_SignalingThread.get(),                    // signaling thread

            nullptr,                         // Audio device module

            webrtc::CreateBuiltinAudioEncoderFactory(),

            webrtc::CreateBuiltinAudioDecoderFactory(),

            CreateTupleVideoEncoderFactory(),

            webrtc::CreateBuiltinVideoDecoderFactory(),

            nullptr,                                    // audio mixer

            nullptr                                     // audio processor

      );


This was working fine until we updated to M77 (last update was in March). Now in the linking phase of the app I get this error:

Undefined symbols for architecture x86_64:
  "webrtc::CreatePeerConnectionFactory(rtc::Thread*, rtc::Thread*, rtc::Thread*, rtc::scoped_refptr<webrtc::AudioDeviceModule>, rtc::scoped_refptr<webrtc::AudioEncoderFactory>, rtc::scoped_refptr<webrtc::AudioDecoderFactory>, std::__1::unique_ptr<webrtc::VideoEncoderFactory, std::__1::default_delete<webrtc::VideoEncoderFactory> >, std::__1::unique_ptr<webrtc::VideoDecoderFactory, std::__1::default_delete<webrtc::VideoDecoderFactory> >, rtc::scoped_refptr<webrtc::AudioMixer>, rtc::scoped_refptr<webrtc::AudioProcessing>)", referenced from:
      tn::PeerFactoryContext::PeerFactoryContext() in libTupleKit.a(PeerFactoryContext.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

It looks like that form of the constructor is not being found, but it appears to be consistent with the current version and hasn't changed since the previous version we were on.

Any ideas what's going on?

Thanks!

Peter Bloomfield

unread,
Oct 9, 2019, 11:27:59 AM10/9/19
to discuss-webrtc
I've just updated my WebRTC code and I'm seeing the same issue.

Niels Moller

unread,
Oct 9, 2019, 11:56:25 AM10/9/19
to discuss...@googlegroups.com
It might be another case of incompatible C++ libraries. The abi of C++ standard library facilities differ between library implementations, in particular, between the libraries bundled with gcc and the one bundled with clang.

If you build webrtc using C++ headers belonging to one C++ standard library, then you *must* use the same header files and corresponding library files when compiling and linking your application. (As far as I understand, it may work fine to mix object files compiled by different C++ compilers, provided that the same library implementation is used for *all* C++ compilation units, using appropriate compiler command line flags).

--

---
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-webrt...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/discuss-webrtc/d5f482ed-6613-42db-9a8c-ab9c7a3352eb%40googlegroups.com.

Joel Sutherland

unread,
Oct 9, 2019, 1:53:05 PM10/9/19
to discuss...@googlegroups.com
I'm currently using this build command (unchanged from the previous version where it worked):

gn gen out/Debug --args='target_os="mac" target_cpu="x64" use_rtti=true libcxx_abi_unstable=false is_debug=true' --ide=xcode


I'm not sure which compiler it's being used by gn/ninja, and confirmed that we're using Apple LLVM version 10.0.0 (clang-1000.11.45.5) in XCode. Is there some way to check the compiler which is being used to build webrtc? I'm pretty sure it's clang, but perhaps an incompatible version? Ideally I'd like to tell it to use the XCode version.

Joel Sutherland


You received this message because you are subscribed to a topic in the Google Groups "discuss-webrtc" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/discuss-webrtc/wYrjr-LAkmg/unsubscribe.
To unsubscribe from this group and all its topics, send an email to discuss-webrt...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/discuss-webrtc/CAAO0x156b4o3XDvCyiXU-YCO4o6Sq8aHN%3DbXZKgskzBqxn-Z_w%40mail.gmail.com.

Mirko Bonadei

unread,
Oct 9, 2019, 4:20:43 PM10/9/19
to discuss-webrtc


On Wednesday, October 9, 2019 at 7:53:05 PM UTC+2, Joel Sutherland wrote:
I'm currently using this build command (unchanged from the previous version where it worked):

gn gen out/Debug --args='target_os="mac" target_cpu="x64" use_rtti=true libcxx_abi_unstable=false is_debug=true' --ide=xcode


I'm not sure which compiler it's being used by gn/ninja, and confirmed that we're using Apple LLVM version 10.0.0 (clang-1000.11.45.5) in XCode. Is there some way to check the compiler which is being used to build webrtc? I'm pretty sure it's clang, but perhaps an incompatible version? Ideally I'd like to tell it to use the XCode version.

Joel Sutherland


On Wed, Oct 9, 2019 at 11:56 AM Niels Moller wrote:
It might be another case of incompatible C++ libraries. The abi of C++ standard library facilities differ between library implementations, in particular, between the libraries bundled with gcc and the one bundled with clang.

If you build webrtc using C++ headers belonging to one C++ standard library, then you *must* use the same header files and corresponding library files when compiling and linking your application. (As far as I understand, it may work fine to mix object files compiled by different C++ compilers, provided that the same library implementation is used for *all* C++ compilation units, using appropriate compiler command line flags).

Nikolay Baklicharov

unread,
Oct 9, 2019, 4:28:50 PM10/9/19
to discuss-webrtc
It does fix it, the same is achieved also by including 'api/create_peerconnection_factory.lib' but then a new linker error arises about "webrtc::CreateDefaultTaskQueueFactory". I'm so tired of these breaking changes on each release...

Joel Sutherland

unread,
Oct 9, 2019, 4:59:13 PM10/9/19
to discuss...@googlegroups.com
Confirmed that the patch you linked works for me as well. Thanks Mirko!

Joel Sutherland


--

---
You received this message because you are subscribed to a topic in the Google Groups "discuss-webrtc" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/discuss-webrtc/wYrjr-LAkmg/unsubscribe.
To unsubscribe from this group and all its topics, send an email to discuss-webrt...@googlegroups.com.

Kiran

unread,
Oct 9, 2019, 7:14:52 PM10/9/19
to discuss-webrtc
I had to use:

ninja -C out/m78 create_peerconnection_factory default_task_queue_factory rtc_task_queue_gcd task_queue

followed by:

rsync -avh --prune-empty-dirs --exclude="out" --include="*/" --include="*.h" --exclude="*" ./* ../include/

cp -p out/m78/obj/libwebrtc.a ../lib/

cp -p /out/m78/obj/api/create_peerconnection_factory/create_peerconnection_factory.o \
out/m78/obj/api/task_queue/default_task_queue_factory/default_task_queue_factory_gcd.o \
out/m78/obj/api/task_queue/task_queue/task_queue_base.o \
out/m78/obj/rtc_base/rtc_task_queue/task_queue.o \
out/m78/obj/rtc_base/rtc_task_queue_gcd/task_queue_gcd.o \
../lib/

cd ../lib
ar -r libwebrtc.a *.o
rm *.o

Patrik Höglund

unread,
Oct 10, 2019, 4:21:13 AM10/10/19
to discuss-webrtc
Ok, so we're not building the webrtc static lib on the bots somewhere? That's kind of ridiculous and we should fix it. Mirko, can we write a dummy main or something to ensure libwebrtc.a includes everything it needs? Maybe make one of the examples that gets built depend on the webrtc target.

/ P

--

---
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-webrt...@googlegroups.com.

Mirko Bonadei

unread,
Oct 10, 2019, 5:51:45 AM10/10/19
to discuss-webrtc
Ok https://webrtc-review.googlesource.com/c/src/+/148073 is now landed.

Patrik, I have created https://bugs.chromium.org/p/webrtc/issues/detail?id=11027, nisse's idea is to actually build and run some tests that links against the static library.


On Thursday, October 10, 2019 at 10:21:13 AM UTC+2, Patrik Höglund wrote:
Ok, so we're not building the webrtc static lib on the bots somewhere? That's kind of ridiculous and we should fix it. Mirko, can we write a dummy main or something to ensure libwebrtc.a includes everything it needs? Maybe make one of the examples that gets built depend on the webrtc target.

/ P

Patrik Höglund

unread,
Oct 18, 2019, 4:21:44 AM10/18/19
to discuss-webrtc
Followup: there is now a "test" which will break if for instance CreatePeerConnectionFactory disappears from libwebrtc.a. 

Please have a look and see if your favorite symbols are in there. If not, feel free to send patches that adds them to the test. The test cases don't have to pass (in fact, it's fine if it crashes), so can just add whatever you want and ensure it's called from main() somewhere.

/ P

--

---
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-webrt...@googlegroups.com.

Nikolay Baklicharov

unread,
Oct 18, 2019, 5:02:21 AM10/18/19
to discuss-webrtc
I think it would be best to make the peerconnection_client/server examples to link directly with libwebrtc for best results.
To unsubscribe from this group and stop receiving emails from it, send an email to discuss...@googlegroups.com.

Berthold

unread,
Oct 21, 2019, 5:39:54 AM10/21/19
to discuss-webrtc
Hello, 
after our project has decided to us Visual Studio 2019, has I got problems to compile webrtc m74 with vs2019. I've switched to webrtc m77 with vs2019 and the compile problems are disappeared. But I have also the same Linker Errors as described above.
By using the webrtc m74 I need only in the Linker Additional Dependencies the :  webrtc.lib .

The following changes solved my problem. Working with windows 10, vs2019.

VS 2019 project 
------------------------------------------------------------------------------------------------------------------------------------------------------
Configuration :   DebugUnicode  und ReleaseUnicode
Client Property Pages
  Configuration Properties
    C/C++

      Preprocessor Definitions   WEBRTC_INCLUDE_INTERNAL_AUDIO_DEVICE

    Linker
      Input
        Aditional Dependencies
        webrtc.lib
        create_peerconnection_factory.lib
        default_queue_factory.lib
        rtc_task_queue_win.lib

      General
        Additional Library Directories
..\..\..\global\webrtc\m77.x\out\Debug_x86\obj
..\..\..\global\webrtc\m77.x\out\Debug_x86\obj\api
..\..\..\global\webrtc\m77.x\out\Debug_x86\obj\api\task_queue
..\..\..\global\webrtc\m77.x\out\Debug_x86\obj\rtc_base
also done for   Release_x86
-----------------------------------------------------------------------------------------------------
  if (rtc_include_internal_audio_device) {
    defines += [ "WEBRTC_INCLUDE_INTERNAL_AUDIO_DEVICE" ]
------------------------------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------
Linker can not find Symbols of Taskqueuefactory 
-- Start
--------------------------------------------------------------------------
...\src\api\task_queue\BUILD.gn
...\src\rtc_base\BUILD.gn
-----------------------------------------------------------------------------------------------------
...\src\api\task_queue\BUILD.gn
--- 50
rtc_source_set("default_task_queue_factory") {
replace
rtc_static_library("default_task_queue_factory") {
-----------------------------------------------------------------------------------------------------
...\src\rtc_base\BUILD.gn
--- 517
if (is_win) {
  rtc_source_set("rtc_task_queue_win") {
replace
  rtc_static_library("rtc_task_queue_win") {
----------------------------------------------------------------------------
Linker can not find Symbols of Taskqueuefactory 
-- Ende
---------------------------------------------------------------------------

Mirko Bonadei

unread,
Oct 21, 2019, 10:36:03 AM10/21/19
to discuss-webrtc
It is possible https://webrtc.googlesource.com/src/+/86d053c2db6ed25e4854c307d563999298dda2e5 made some of the changes (rtc_source_set vs rtc_static_library) not needed anymore.
Reply all
Reply to author
Forward
0 new messages