ultravideo / uvgRTP

An open-source library for RTP/SRTP media delivery
BSD 2-Clause "Simplified" License
325 stars 92 forks source link

[Android] Library fails to compile (at least for old SDK level 21) #216

Closed jstefanelli closed 6 months ago

jstefanelli commented 7 months ago

Hi, I've encountered a problem trying to include uvgRTP into my android app. It's been super simple, except for one compilation issue:

uvgrtp/src/hostname.cc:54:9: error: use of undeclared identifier 'getlogin_r'
    if (getlogin_r(username, NAME_MAXLEN) != 0) {

I've fixed it with this commit. Am I doing something wrong in the Cmake configuration? Or is something like what I've done the correct way to handle this?

FYI, I am targeting the minimum SDK level as 21 (Android 5.0) to support some very old devices that we still use.

jrsnen commented 7 months ago

Hi,

We currently don't test for android, but this seems like an android version specific issue. CMake should handle this type of problems without additional configuration, so the problem is probably in the underlying libraries in the specific Android version.

If this type of solution works on all android devices, I wouldn't mind if it is changed. That being said, it would be good to figure out which version requires and only target those. Also, if you want to do a PR, please use #elif instead of making a new #if.

Best Regards, Joni

tampsa commented 6 months ago

Fixed by merging pull request in commit 59351b3