-
Notifications
You must be signed in to change notification settings - Fork 95
Support ifaddrs on Android API level >= 24 #1329
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
e4607d8
to
db1f0a0
Compare
It would appear that the tool chain for the CI is targeting an API version that is < 24, so I have added conditional logic to detect the case where the header exists but isn't available due to targeting the wrong API version. It does mean that the CI will not be building the |
currently the minimum Android version for this project is Android 7.0 https://github.com/baresip/baresip/wiki/Supported-platforms This version can be adjusted up/down depending on the users Are you able to also update the CI job with your suggestion version, |
The linked page is a bit confusing, the table says Android 5.0+ but the detailed list says 7.0? If it is actually 7.0, yes, I can try update the CI to the equivalent SDK API level (which actually is the required API 24). In which case, should I leave the conditional in if all supported Android versions (i.e. 7.0 or greater) have I'm not sure what you mean by adding running of retest. Do you just want me to run retest on x86 against this change or do you want me to do something on Android? |
here is part of the Android CI job:
it would be great if you can update the CI to match the version that you suggested. I dont think you need to put too much effort into that it works on all Android versions. An optional step if you have time could be to add execution of |
9e8b407
to
d68d291
Compare
many thanks for updating the CI. Let us ask @juha-h for tips and advice. He has an Android application using baresip+libre. |
This is how I learn about available networks in my Android app:
So perhaps this PR is not related to my app. |
@juha-h I agree. Yours is the existing way by manually adding interfaces to Baresip via hooks from the Java API. It is the more advanced integration method, and is not related to this MR. This MR enables the simple way Baresip does itself on other platforms by enumerating interfaces to work on Android too when there is only IPv6. The advanced way is still available and arguably gives better performance, but requires deeper integration with Android in Java, whereas this works out of the box from C. Are you using C11 threads targetting API >= 30? For me, if I HAVE_THREADS is enabled as it is automatically by cmake when targetting API >= 30 Baresip fails to start due to the rss_set incompatibility between what this library expects and what Bionic implements. @alfredh I think everything else is only related to |
@weili-jiang I have in CMakeLists.txt:
My app targets |
@juha-h I am also using with HAVE_PTHREAD (pthread.h), but that's not what I was talking about. The issue is with HAVE_THREADS which is different - C11 threads.h. I have to disable HAVE_THREADS so that it uses pthread instead, same as you. Why are you manually needing to specify HAVE_PTHREAD BTW? Is your re cmake build (using re-config.cmake) not autodetecting the pthreads.h etc from the NDK? In my case it autodetects both threads.h and pthread.h but doesn't realise the first is not compatible. |
@weili-jiang I don't remember why I have added
|
@weili-jiang I tried without
I don't know why re build does not find pthread or if it matters. |
@juha-h are you building
Also check if |
81f200c
to
964fd58
Compare
@weili-jiang Yes, I'm building libre and libbaresip myself https://github.com/juha-h/libbaresip-android. Yes, I see this in re build log:
And yes, there is posix.c in the build log:
So I'm really confused when build does not find
and still |
26c1f5e
to
7dd0691
Compare
The test I just added for |
this looks very nice, thanks! Could you please split up the PR into logical parts so that it does not become so big ? Also after some thinking I think it is best to use minimum level of 21 |
@alfredh Just to be clear, how many separate PRs?
Agreed? |
7dd0691
to
4ed70a8
Compare
Baresip's default networking currently doesn't work well on Android when IPv6-only due to inability to enumerate network interfaces. This appears to be because
ifaddrs
support is currently disabled. There are APIs to manually add interfaces but this is cumbersome to use.Android added
ifaddrs
support in API level 24 (Android 7) which was ages ago:https://android.googlesource.com/platform/bionic/+/master/libc/include/ifaddrs.h#81
I have enabled it and tested that with this change, Baresip can successfully use
getifaddrs
on a non-rooted Android 13 phone to enumerate IPv6-only interfaces without any manual steps.