I have this exact same problem building libwebrtc for Android. I just dumped each of the libwebrtc.a libraries (one for m74, one for v72) with nm; then searched on ‘__1’ and ‘__ndk1’.
__1 in v72 found 36 times
__ndk1 in v72 found 17678 times
__1 in m74 found 28057 times
__ndk1 in m74 found 0 times
So, this merely confirms what you saw. M73 is also broken for me.
I am having exactly the same problem as Bozhidar, with libwebrtc.a built for Android. When I use build-heads/m74, commit 884fb24, all the STL calls are in namespace std::__1, so when I link to my Android app, they are not found. In my environment the STL calls are in __ndk1 namespace; e.g., std::__ndk1::string. Our build.gradle has this:
externalNativeBuild {
cmake {
cppFlags "-std=c++14"
arguments "-DANDROID_STL=c++_shared"
}
}The gn gen call is plain vanilla: gn gen out/debug-001 --args='target_os="android" target_cpu="arm64"'. I tried using use_custom_libcxx=false – this had no effect.
Now, when I built with build-heads/72, the linker problem goes away. So yeah, it looks like something changed between 72 and m73. I tried m73, too – same problem as with m74.
I’ve built for Linux (built on Linux, as I do for the Android version), which works fine linking in Linux application. I’ve also built libwebrtc.a for iOS (on Mac OSX) – there I had kind of the reverse problem, as we use gnu STL (libstdc++, instead of clang). The solution was, I added use_custom_libcxx=false to the gn parameters, and Xcode was happy. This is not an option for the Android build of libwebrtc.a (nor should it be…)
In file included from ../../third_party/android_tools_mac/ndk/sources/android/support/include/math.h:32:
../../third_party/llvm-build/Release+Asserts/bin/../include/c++/v1/math.h:1330:93: error: no member named 'log2f' in the global namespace
inline _LIBCPP_INLINE_VISIBILITY float log2(float __lcpp_x) _NOEXCEPT {return ::log2f(__lcpp_x);}
Hi Björn,
To be honest, I didn't try my solution on m76.
>> But I will give it a second go, trying to see what your fix where compared to the original files for M74 and see if I can apply it for M78.
This sounds good. And if you figure out a new solution/patch you can share it here as well.
>> Still I would like to know if there is any official solution or statement from the Webrtc-team about how to use the libwebrtc.a with Android, after it breaking in M74.
Unfortunately, I have found any official statement regarding the solution. And I don't think Google would like us to consume the C++ APIs directly, especially the lower level ones. Because you'll have to expose them by yourself by configuring relevant files.
-Best Regards,Albert Gu
From: discuss-webrtc@googlegroups.com <discuss-webrtc@googlegroups.com> on behalf of Björn St <bj...@ingate.com>
Sent: Wednesday, September 18, 2019 3:43 PM
To: discuss-webrtc <discuss-webrtc@googlegroups.com>
Subject: [discuss-webrtc] Re: Android libc++ namespace change__1 in m74
Hi Albert--
Thank you for your response and for posting your solution earlier.
I did try it on M76, by replacing the files with your files. But I got that a lot of variables where missing, I added them manually in the Build.gn file but in the end the "gn gen" couldn't run without errors.
But I will give it a second go, trying to see what your fix where compared to the original files for M74 and see if I can apply it for M78.
Still I would like to know if there is any official solution or statement from the Webrtc-team about how to use the libwebrtc.a with Android, after it breaking in M74.
Best RegardBjörn
Den onsdag 18 september 2019 kl. 09:09:34 UTC+2 skrev Albert Gu:Hi Björn,
Did you get chance to try the solution I posted above. If I remember correct, this issue was introduced in m73 and I fixed this issue in upgrading WebRTC to m74.
Regards,Albert Gu
On Wednesday, September 18, 2019 at 2:48:50 PM UTC+8, Björn St wrote:Is there any update on this blocking issue? I also have my own c++ project where I link to libwebrtc.a.
It has worked previously but after trying to update to M76 and now M78 I get the same linking error as described.
Is it supposed to be like this?
If I want to link against the libwebrtc.a what is the correct solution, trying to get Webrtc to build the namespace with “__ndk1” or getting my project to use “__1”?
Please assist me!
---
You received this message because you are subscribed to a topic in the Google Groups "discuss-webrtc" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/discuss-webrtc/o-zDdrq09yk/unsubscribe.
To unsubscribe from this group and all its topics, send an email to discuss-webrtc+unsubscribe@googlegroups.com.