Build WebRTC libjingle_peerconnection_so.so with Libjingle / XMPP Support

716 views
Skip to first unread message

Kyle Cummings

unread,
May 8, 2015, 11:51:02 AM5/8/15
to discuss...@googlegroups.com
I have followed the build instructions defined in the android example app (AppRTCDemo) README (https://chromium.googlesource.com/external/webrtc/+/master/talk/examples/android/README), including setting the build flag "build_with_libjingle=1". When I run either "ninja -C out_android/Debug AppRTCDemo" (or the Release version), it compiles everything associated with libjingle. However, when it compiles libjingle_peerconnection_so.so, it seems to forget to include various libjingle static libraries. I can tell this, because when I include the libjingle_peerconnection_so.so file in my own project (that uses things like buzz::QN_MESSAGE and XmlElement objects) the build complains that those (and other things) are not defined. BUT every WebRTC object I have in my code IS defined, and the compiler does not complain. 

I have used nm -C and grep on the libjingle_peerconnection_so.so file, looking for the symbols, and there are NO results returned. However, the libjingle_peerconnection_so.ninja file clearly has the necessary libraries included (librtc_xmpp, etc.). 

For my project, I am using the ndk-build system with .mk files. I have tried ditching the .so file, and instead using EVERY static library in my .mk file, but that then introduces a bunch of other not defined errors that make less sense than using the .so file. 

What the heck am I doing wrong? Or is there something wrong with the build system?

Let me know if you need any more information.

Thanks

Kyle Cummings

unread,
May 8, 2015, 2:52:27 PM5/8/15
to discuss...@googlegroups.com
UPDATE:
Of course, when you visit something the next day, everything changes. Now when I run nm on the libjingle_peerconnection_so.so file, it shows that the functions / symbols are there. However, my build setup still claims that they are not defined, even though they clearly are.

I am also including the .mk file that I am using below.

LOCAL_PATH:= $(call my-dir)
include $
(CLEAR_VARS)
LOCAL_MODULE
:= libjingle_peerconnection_so
cmd
-strip :=
LOCAL_SRC_FILES
:= ../../ThirdPartyLibs/WebRTC/src/out_android/Debug/lib/libjingle_peerconnection_so.so
include $
(PREBUILT_SHARED_LIBRARY)

include $
(CLEAR_VARS)
LOCAL_ARM_MODE
:= arm
LOCAL_MODULE
:= kinoproject
LOCAL_MODULE_TAGS
:= optional
LOCAL_CPP_EXTENSION
:= .cpp \
 
.cc

LOCAL_SRC_FILES
:= \
 presencepushtask
.cc \
 
CallItem.cpp \
 
KinoVideo.cpp \
 
KinoXMPP.cpp \
 
KinoJNIMain.cpp

LIBJINGLE_CPPFLAGS
:= \
 
-DHAMMER_TIME=1 \
 
-DHAS_OPENSSL_1_0 \
 
-DHAVE_DTLS_SRTP \
 
-DGTEST_RELATIVE_PATH \
 
-DDISABLE_DYNAMIC_CAST \
 
-D_REENTRANT \
 
-DWEBRTC_POSIX \
 
-DOS_LINUX=OS_LINUX \
 
-DLINUX \
 
-DANDROID \
 
-DEXPAT_RELATIVE_PATH \
 
-DSRTP_RELATIVE_PATH \
 
-DXML_STATIC \
 
-DFEATURE_ENABLE_SSL \
 
-DHAVE_OPENSSL_SSL_H=1 \
 
-DFEATURE_ENABLE_VOICEMAIL \
 
-DFEATURE_ENABLE_PSTN \
 
-DHAVE_WEBRTC_VIDEO \
 
-DHAVE_WEBRTC_VOICE \
 
-DHAVE_SRTP \
 
-DLOGGING \
 
-DNO_SOUND_SYSTEM \
 
-DARCH_CPU_LITTLE_ENDIAN \
 
-DJSONCPP_RELATIVE_PATH \
 
-DWEBRTC_RELATIVE_PATH \
 
-D_DEBUG

LOCAL_CFLAGS
:= \
 $
(LIBJINGLE_CPPFLAGS) \
 
-O2 \
 
-std=c++11 \
 
-fexceptions

LOCAL_C_INCLUDES
:= \
 $
(LOCAL_PATH) \
 $
(LOCAL_PATH)/../../Libs \
 $
(LOCAL_PATH)/../../Libs/Kino \
 $
(LOCAL_PATH)/../../Libs/android-logging \
 $
(LOCAL_PATH)/../../ThirdPartyLibs/openssl/openssl/include \
 $
(LOCAL_PATH)/../../ThirdPartyLibs/WebRTC/src \
 $
(LOCAL_PATH)/../../ThirdPartyLibs/WebRTC/src/webrtc \
 $
(LOCAL_PATH)/../../ThirdPartyLibs/WebRTC/src/chromium/src/third_party/jsoncpp/source/include \
 $
(LOCAL_PATH)/../../ThirdPartyLibs/WebRTC/src/chromium/src/third_party/icu/source/common
 
LOCAL_SHARED_LIBRARIES
:= \
 libcrypto
-mod \
 libssl
-mod \
 libjingle_peerconnection_so

LOCAL_LDLIBS
:= \
 
-L$(NDK_PROJECT_PATH)/toolchain/sysroot/usr/lib \
 
-llog \
 
-lOpenSLES \
 
-lGLESv2 \
 
-lc \
 
-ljnigraphics \
 
-ldl
 
include $
(BUILD_SHARED_LIBRARY)

Kyle Cummings

unread,
May 8, 2015, 4:43:10 PM5/8/15
to discuss...@googlegroups.com
I have suppressed the undefined errors with
LOCAL_ALLOW_UNDEFINED_SYMBOLS := true

in the .mk file, and that completes the build and created the android .so files in
libs/armeabi-v7a/

When I nm those files, the symbols are found. However, when everything is loaded to the android device, the application crashes, saying that it cannot find (for example) the symbol
_ZN4buzz11QN_PRESENCEE

referenced in my library (myproject.so). The nm results:
nm libs/armeabi-v7a/libkinoproject.so | grep QN_PRESENCE
4983: U _ZN4buzz10QN_PRESENCEE
nm libs/armeabi-v7a/libjingle_peerconnection_so.so | grep QN_PRESENCE
100840:005f65f8 d _ZN4buzz11QN_PRESENCEE


On Friday, May 8, 2015 at 9:51:02 AM UTC-6, Kyle Cummings wrote:
Reply all
Reply to author
Forward
0 new messages