Webrts native with Qt

258 views
Skip to first unread message

Pavel

unread,
Jul 8, 2020, 5:36:10 PM7/8/20
to discuss-webrtc
Hi, i'm trying to build peerconnection_client in Qt envirment. I use precompiled libwebrtc binary from this repo https://github.com/shiguredo-webrtc-build/webrtc-build
I successfully compile example with this in my *.pro file


DEFINES
+= WEBRTC_POSIX
DEFINES
+= WEBRTC_LINUX

QMAKE_CXXFLAGS
+= -std=c++14
QMAKE_CXXFLAGS
+= -stdlib=libc++

# Qt not to define the moc keywords signals, slots, and emit,
CONFIG
+= no_keywords

DEFINES
+= QT_DEPRECATED_WARNINGS
INCLUDEPATH
+=/webrtc/include/
INCLUDEPATH
+=/webrtc/include/third_party/abseil-cpp/
INCLUDEPATH
+=/webrtc/include/third_party/jsoncpp/generated/
INCLUDEPATH
+=/webrtc/include/third_party/jsoncpp/source/include
INCLUDEPATH
+=/webrtc/include/third_party/libyuv/include

LIBS
+= //webrtc/lib/libwebrtc.a
LIBS
+= -pthread
LIBS
+= -ldl
LIBS
+= -lX11

unix
: CONFIG += link_pkgconfig
unix
: PKGCONFIG += gtk+-2.0

SOURCES
+= \
        conductor
.cpp \
        defaults
.cpp \
        main_wnd
.cpp \
        main_wnd_base
.cpp \
        peer_connection_client
.cpp \
        main
.cpp

HEADERS
+= \
        conductor
.h \
        defaults
.h \
        flag_defs
.h \
        main_wnd
.h \
        main_wnd_base
.h \
        peer_connection_client
.h
       

This translates in this in compilation process

clang++ -c -pipe -std=c++14 -stdlib=libc++ -g -pthread -Wall -Wextra -D_REENTRANT -fPIC -DWEBRTC_POSIX -DWEBRTC_LINUX -DQT_DEPRECATED_WARNINGS -DQT_QML_DEBUG -DQT_NO_KEYWORDS -DQT_GUI_LIB -DQT_CORE_LIB -I../nativeTest -I. -I/webrtc/include -I/webrtc/include/third_party/abseil-cpp -I/webrtc/include/third_party/jsoncpp/generated -I/webrtc/include/third_party/jsoncpp/source/include -I/webrtc/include/third_party/libyuv/include -isystem /usr/include/gtk-2.0 -I/usr/lib/x86_64-linux-gnu/gtk-2.0/include -isystem /usr/include/gio-unix-2.0 -isystem /usr/include/cairo -isystem /usr/include/pango-1.0 -isystem /usr/include/atk-1.0 -isystem /usr/include/pixman-1 -isystem /usr/include/gdk-pixbuf-2.0 -isystem /usr/include/libpng16 -isystem /usr/include/harfbuzz -isystem /usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -isystem /usr/include/freetype2 -I/opt/Qt/5.14.2/gcc_64/include -I/opt/Qt/5.14.2/gcc_64/include/QtGui -I/opt/Qt/5.14.2/gcc_64/include/QtCore -I. -isystem /usr/include/libdrm -I/opt/Qt/5.14.2/gcc_64/mkspecs/linux-clang -o conductor.o ../nativeTest/conductor.cpp

...

clang
++ -ccc-gcc-name g++ -Wl,-rpath,/opt/Qt/5.14.2/gcc_64/lib -o nativeTest conductor.o defaults.o main_wnd.o main_wnd_base.o peer_connection_client.o main.o   /webrtc/lib/libwebrtc.a -pthread -ldl -lX11 -lgtk-x11-2.0 -lgdk-x11-2.0 -lpangocairo-1.0 -latk-1.0 -lcairo -lgdk_pixbuf-2.0 -lgio-2.0 -lpangoft2-1.0 -lpango-1.0 -lgobject-2.0 -lglib-2.0 -lfontconfig -lfreetype /opt/Qt/5.14.2/gcc_64/lib/libQt5Gui.so /opt/Qt/5.14.2/gcc_64/lib/libQt5Core.so -lGL -lpthread  

But it immediately crash with segfault. Running In debug mode I find out what value in std::strings are corrupted, for example:

executing this line
std::string const server = absl::GetFlag(FLAGS_server);
 should return "localhost\0" but I get this string: "ocalhost\000\000\000\000\000\000\000\000\000\000\000\000\000\000\t\000\000\000\000\000\000\000\000�����\177\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"

Same happens for all std::strings in app.
Also in debug mode this message shown "can't find linker symbol for virtual table for `PeerConnectionClient' value"

Is this problem related for the fact that libwebrtc built with libc++ and Qt build libstdc++? Or I miss some in compiler flag or environment?
I'm using clang version 6.0.0-1ubuntu2 (tags/RELEASE_600/final) with GNU gdb (Ubuntu 8.1-0ubuntu3.2) 8.1.0.20180409-git on xubuntu 18.04


Reply all
Reply to author
Forward
0 new messages