libwebrtc icon indicating copy to clipboard operation
libwebrtc copied to clipboard

Peerconnection_client example segmentation fault

Open david-bui opened this issue 8 years ago • 7 comments

Hello, I tried to run peerconnection_client example linked with libwebrtc.a but I end up with a segmentation fault. I am running on a Unix machine 16.04.1-Ubuntu x86_64.

After running your script, I run the attached CMakeLists.txt in a different directory :

(dev)⚡ % cmake ..     /storage/Cosmo/libwebrtc_aisouard/libwebrtc/WorkingDir/out
-- The C compiler identification is GNU 5.4.0
-- The CXX compiler identification is GNU 5.4.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found PkgConfig: /usr/bin/pkg-config (found version "0.29.1") 
-- Checking for module 'gtk+-3.0'
-- Found gtk+-3.0, version 3.20.8
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - not found
-- Check if compiler accepts -pthread
-- Check if compiler accepts -pthread - yes
-- Found Threads: TRUE  
-- Configuring done
-- Generating done
-- Build files have been written to: /storage/Cosmo/libwebrtc_aisouard/libwebrtc/WorkingDir/out

Then make :

(dev)⚡ % make                                  /storage/Cosmo/libwebrtc_aisouard/libwebrtc/WorkingDir/out
Scanning dependencies of target ex_lib
[ 14%] Building CXX object CMakeFiles/ex_lib.dir/storage/Cosmo/libwebrtc_aisouard/libwebrtc/out/webrtc/src/webrtc/examples/peerconnection/client/conductor.cc.o
[ 28%] Building CXX object CMakeFiles/ex_lib.dir/storage/Cosmo/libwebrtc_aisouard/libwebrtc/out/webrtc/src/webrtc/examples/peerconnection/client/defaults.cc.o
[ 42%] Building CXX object CMakeFiles/ex_lib.dir/storage/Cosmo/libwebrtc_aisouard/libwebrtc/out/webrtc/src/webrtc/examples/peerconnection/client/peer_connection_client.cc.o
[ 57%] Linking CXX static library libex_lib.a
[ 57%] Built target ex_lib
Scanning dependencies of target peerconnection_client
[ 71%] Building CXX object CMakeFiles/peerconnection_client.dir/storage/Cosmo/libwebrtc_aisouard/libwebrtc/out/webrtc/src/webrtc/examples/peerconnection/client/linux/main.cc.o
[ 85%] Building CXX object CMakeFiles/peerconnection_client.dir/storage/Cosmo/libwebrtc_aisouard/libwebrtc/out/webrtc/src/webrtc/examples/peerconnection/client/linux/main_wnd.cc.o
/storage/libwebrtc_aisouard/libwebrtc/out/webrtc/src/webrtc/examples/peerconnection/client/linux/main_wnd.cc: In member function ‘virtual void GtkMainWnd::SwitchToConnectUI()’:
/storage/Cosmo/libwebrtc_aisouard/libwebrtc/out/webrtc/src/webrtc/examples/peerconnection/client/linux/main_wnd.cc:248:23: warning: ‘GtkWidget* gtk_alignment_new(gfloat, gfloat, gfloat, gfloat)’ is deprecated [-Wdeprecated-declarations]
   GtkWidget* valign = gtk_alignment_new(0, 1, 0, 0);
                       ^
In file included from /usr/include/gtk-3.0/gtk/gtk.h:248:0,
                 from /storage/Cosmo/libwebrtc_aisouard/libwebrtc/out/webrtc/src/webrtc/examples/peerconnection/client/linux/main_wnd.cc:14:
/usr/include/gtk-3.0/gtk/deprecated/gtkalignment.h:79:12: note: declared here
 GtkWidget* gtk_alignment_new        (gfloat             xalign,
            ^

[More Gtk warnings]

[100%] Linking CXX executable peerconnection_client
[100%] Built target peerconnection_client

When I run the code and then I press Connect :

 (dev)⚡ % ./peerconnection_client     /storage/Cosmo/libwebrtc_aisouard/libwebrtc/WorkingDir/out
[1]    7813 segmentation fault (core dumped)  ./peerconnection_client

In gdb :

Thread 1 "peerconnection_" received signal SIGSEGV, Segmentation fault.
0x0000000000426e99 in sigslot::lock_blocksigslot::single_threaded::lock_block (this=0x7fffffffb450,
mtx=0x1329710) at /usr/local/include/webrtc/base/sigslot.h:257
257				m_mutex->lock();

Is it linked to Gtk deprecated functions ?

Thank you

CMakeLists.txt

david-bui avatar May 18 '17 06:05 david-bui

More background info:

  • we used your scripts
  • we took the example code that come shipped with libwebrtc out.
  • we compiled libwertc separately and installed it
  • we then tried to build the example code separately using the provided cmakelists, and linked against the installed version of libwebrtc.

it failed.

as a check, and to have a basis for comparison, we also compiled libwebrtc using the instructions at webrtc.org, switched to release-branch 57, and did the same thing as above, and it worked.

  1. can you reproduce the problem?
  2. any idea what we are doing wrong?

agouaillard avatar May 18 '17 16:05 agouaillard

I'm not sure about what's going on here, I needed to add these lines:

  ${ex_ROOT}/../../../base/asyncsocket.cc
  ${ex_ROOT}/../../../base/messagehandler.cc
  ${ex_ROOT}/../../../base/physicalsocketserver.cc

Please type the following line before running the process in gdb:

set follow-fork-mode child

Then send me the whole input, I'm building peerconnection_server in the meantime.

aisouard avatar May 18 '17 18:05 aisouard

I'm having this right now:

Thread 1 "peerconnection_" received signal SIGSEGV, Segmentation fault.
0x00007ffff5f2b58f in std::__detail::_List_node_base::_M_hook(std::__detail::_List_node_base*) () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
(gdb) bt
#0  0x00007ffff5f2b58f in std::__detail::_List_node_base::_M_hook(std::__detail::_List_node_base*) () at /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#1  0x0000000000428099 in void std::list<sigslot::_opaque_connection, std::allocator<sigslot::_opaque_connection> >::_M_insert<sigslot::_opaque_connection>(std::_List_iterator<sigslot::_opaque_connection>, sigslot::_opaque_connection&&) ()
#2  0x0000000000427751 in std::list<sigslot::_opaque_connection, std::allocator<sigslot::_opaque_connection> >::push_back(sigslot::_opaque_connection&&) ()
#3  0x0000000000426f77 in void sigslot::signal_with_thread_policy<sigslot::single_threaded, rtc::AsyncResolverInterface*>::connect<PeerConnectionClient>(PeerConnectionClient*, void (PeerConnectionClient::*)(rtc::AsyncResolverInterface*)) ()
#4  0x0000000000423543 in PeerConnectionClient::Connect(std::string const&, int, std::string const&) ()
#5  0x0000000000415906 in Conductor::StartLogin(std::string const&, int) ()
#6  0x000000000040e5b2 in GtkMainWnd::OnClicked(_GtkWidget*) ()

aisouard avatar May 18 '17 18:05 aisouard

By the way, you should use GTK2 to avoid deprecated warnings and strange behaviour.

aisouard avatar May 18 '17 18:05 aisouard

I'll try to replace the sample with peerconnection on my side tonight GMT+2

Le 18 mai 2017 18:17:07 GMT+02:00, alex gouaillard [email protected] a écrit :

More background info:

  • we used your scripts
  • we took the example code that come shipped with libwebrtc out.
  • we compiled libwertc separately and installed it
  • we then tried to build the example code separately using the provided cmakelists, and linked against the installed version of libwebrtc.

it failed.

as a check, and to have a basis for comparison, we also compiled libwebrtc using the instructions at webrtc.org, switched to release-branch 57, and did the same thing as above, and it worked.

  1. can you reproduce the problem?
  2. any idea what we are doing wrong?

-- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/aisouard/libwebrtc/issues/46#issuecomment-302459699

-- Envoyé de mon appareil Android avec Courriel K-9 Mail. Veuillez excuser ma brièveté.

aisouard avatar May 19 '17 06:05 aisouard

same error, i'm using gtk-2.0

Thread 1 "main" received signal SIGSEGV, Segmentation fault.
0x00000000004115b9 in sigslot::lock_block<sigslot::single_threaded>::lock_block (this=0x7fffffffbf70, 
    mtx=0x1210b30) at ../libwebrtc/include/webrtc/base/sigslot.h:257
257				m_mutex->lock();

ps: use ip address to avoid name resolver will skip the problem for temporary.

demobin8 avatar Jan 08 '18 03:01 demobin8

Hi,Is this problem solved?

rengaopan avatar Apr 25 '21 03:04 rengaopan