{"action":"created","issue":{"url":"https://api.github.com/repos/pristineio/webrtc-build-scripts/issues/117","repository_url":"https://api.github.com/repos/pristineio/webrtc-build-scripts","labels_url":"https://api.github.com/repos/pristineio/webrtc-build-scripts/issues/117/labels{/name}","comments_url":"https://api.github.com/repos/pristineio/webrtc-build-scripts/issues/117/comments","events_url":"https://api.github.com/repos/pristineio/webrtc-build-scripts/issues/117/events","html_url":"https://github.com/pristineio/webrtc-build-scripts/issues/117","id":97211642,"number":117,"title":"Need help compiling an Android plugin (.so) which uses WebRTC","user":{"login":"eguendelman","id":9495480,"avatar_url":"https://avatars.githubusercontent.com/u/9495480?v=3","gravatar_id":"","url":"https://api.github.com/users/eguendelman","html_url":"https://github.com/eguendelman","followers_url":"https://api.github.com/users/eguendelman/followers","following_url":"https://api.github.com/users/eguendelman/following{/other_user}","gists_url":"https://api.github.com/users/eguendelman/gists{/gist_id}","starred_url":"https://api.github.com/users/eguendelman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eguendelman/subscriptions","organizations_url":"https://api.github.com/users/eguendelman/orgs","repos_url":"https://api.github.com/users/eguendelman/repos","events_url":"https://api.github.com/users/eguendelman/events{/privacy}","received_events_url":"https://api.github.com/users/eguendelman/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":5,"created_at":"2015-07-25T09:21:40Z","updated_at":"2016-11-10T12:26:08Z","closed_at":"2015-08-07T14:49:27Z","body":"I've successfully built the Android WebRTC libraries using the scripts in this repository.  Now what I really want to do is compile an Android C++ library (.so) which uses WebRTC together with a bunch of other code for my use.  I want to use the typical `ndk-build` system (with `Android.mk`, `Application.mk`) to create this plugin.  My main struggle has generally been knowing which C++ runtime (`APP_STL`) to choose, and maybe someone can help me with this.\n\nSpecifically my Android library will not only use WebRTC, but also the boost libraries as well as other third party libraries.  So I need to find a way that all of them can be linked together with consistent C++ runtime...\n\nBefore dealing with the hard case of mixing WebRTC with boost, I wanted to verify that I know how to build an Android library which _only_ links to WebRTC.  So I created the dummy cpp file, `foo.cpp`, seen below, and eventually determined the right .mk files that allow it to build with ndk-build.\n\nfoo.cpp\n\n``` c++\n#include \"webrtc/base/thread.h\"\nextern \"C\" void foo() { rtc::Thread *thread = new rtc::Thread; }\n```\n\nApplication.mk:\n\n```\nNDK_TOOLCHAIN := arm-linux-androideabi-4.9\nAPP_ABI := armeabi-v7a\nAPP_STL := c++_static\n```\n\nAndroid.mk:\n\n```\nLOCAL_PATH := $(call my-dir)\nWEBRTC_ROOT = /home/vagrant/mybuild/webrtc/src\nWEBRTC_LIB_ROOT = $(WEBRTC_ROOT)/out_android_armeabi-v7a/Release/obj\n\ninclude $(CLEAR_VARS)  \nLOCAL_CFLAGS    := -DNDEBUG -DWEBRTC_POSIX -DWEBRTC_LINUX -DWEBRTC_ANDROID -std=gnu++11\nLOCAL_LDLIBS    :=  -llog -L$(WEBRTC_LIB_ROOT)/webrtc/base \\\n                   -lrtc_base -lrtc_base_approved \\\n                   -L$(NDK_ROOT)/sources/cxx-stl/llvm-libc++/libs/armeabi-v7a \\\n                   -lc++_static\n\nLOCAL_MODULE    := foo\nLOCAL_SRC_FILES := ../foo.cpp\nLOCAL_C_INCLUDES:= $(WEBRTC_ROOT)\ninclude $(BUILD_SHARED_LIBRARY)\n```\n\nThis is the combination that seemed to work for me.  Other choices of `APP_STL` seemed to fail...  Does that seem right?  Do I have to use `c++_static` in order to be consistent with the way the WebRTC libraries were built?\n\nBut now I'm struggling with mixing it with boost.  Until now I've been dealing with boost by building using CrystaX NDK which seemed to have simpler support for boost.  When I've done this in the past, I've generally set `APP_STL:=gnustl_static`, which seems like it may be inconsistent with the way we built WebRTC...  Does that mean I will need to configure WebRTC to build with CrystaX too? Does anyone know of a simpler solution to add the boost libraries to the mix?\n\nAny help would be appreciated.\n\nEran.\n"},"comment":{"url":"https://api.github.com/repos/pristineio/webrtc-build-scripts/issues/comments/259677464","html_url":"https://github.com/pristineio/webrtc-build-scripts/issues/117#issuecomment-259677464","issue_url":"https://api.github.com/repos/pristineio/webrtc-build-scripts/issues/117","id":259677464,"user":{"login":"aagmangour","id":9460101,"avatar_url":"https://avatars.githubusercontent.com/u/9460101?v=3","gravatar_id":"","url":"https://api.github.com/users/aagmangour","html_url":"https://github.com/aagmangour","followers_url":"https://api.github.com/users/aagmangour/followers","following_url":"https://api.github.com/users/aagmangour/following{/other_user}","gists_url":"https://api.github.com/users/aagmangour/gists{/gist_id}","starred_url":"https://api.github.com/users/aagmangour/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aagmangour/subscriptions","organizations_url":"https://api.github.com/users/aagmangour/orgs","repos_url":"https://api.github.com/users/aagmangour/repos","events_url":"https://api.github.com/users/aagmangour/events{/privacy}","received_events_url":"https://api.github.com/users/aagmangour/received_events","type":"User","site_admin":false},"created_at":"2016-11-10T12:26:08Z","updated_at":"2016-11-10T12:26:08Z","body":"Thanks for the solution ,that was a great help."}}
{"actor":{"display_login":"aagmangour"}}