Closed eguendelman closed 9 years ago
Eran, I'm not sure I can help you, WebRTC is meant to be built using the scripts and not the NDK. Can't you just link the built libraries in your project? Can't they be mixed together after they are actually built?
Thanks. I did (hopefully) solve this issue in the end.
Again the issue was that I needed to use both WebRTC and boost in my project, and the former is built (by default) with llvm-libc++, while the latter is built with gnustl. And mixing them together caused problems.
So what I ended up doing is creating a thin, C-style wrapper around the functions I needed from WebRTC. I built this wrapper into a shared library (.so), by statically linking to a long list of WebRTC .a files, and also making sure to link with libc++_static to be consistent with the WebRTC compilation. Then I used this .so with the rest of my boost-dependent project by compiling with crystax instead of the stock NDK and linking with gnustl. I saw "hopefully solved" because it does produce some warning related to the fact that my code mixes two types of runtimes, but so far it seems to work okay despite these warnings...
glad to hear you overcame the issue
I caught this problem too. So I have to build all third party lib to c++_static which cost me a lot of time.
Thanks for the solution ,that was a great help.
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 (withAndroid.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.Specifically 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...
Before 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.foo.cpp
Application.mk:
Android.mk:
This 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 usec++_static
in order to be consistent with the way the WebRTC libraries were built?But 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?Any help would be appreciated.
Eran.