libimobiledevice / libimobiledevice-glue

A library with common code used by libraries and tools around the libimobiledevice project
GNU Lesser General Public License v2.1
95 stars 74 forks source link

socket.c:879:2: error: No reference implementation for getifaddrs available for this platform. #45

Open coderjing opened 3 months ago

coderjing commented 3 months ago

err: Making all in src CC glue.lo CC socket.lo socket.c:879:2: error: No reference implementation for getifaddrs available for this platform. 879 | #error No reference implementation for getifaddrs available for this platform. | ^ socket.c:887:6: error: call to undeclared function 'getifaddrs'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration] 887 | if (getifaddrs(&ifaddr) != -1) { | ^ socket.c:936:3: error: call to undeclared function 'freeifaddrs'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration] 936 | freeifaddrs(ifaddr); | ^ socket.c:955:6: error: call to undeclared function 'getifaddrs'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration] 955 | if (getifaddrs(&ifaddr) == -1) { | ^ socket.c:1026:2: error: call to undeclared function 'freeifaddrs'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration] 1026 | freeifaddrs(ifaddr); | ^ 5 errors generated.

I am communicating between the Android car device and the iOS device through USB. USB is abstracted as TCP, and functions such as socket and address lookup should be used. This method is not implemented in the Android NDK, do I need to implement it myself?

nikias commented 1 month ago

I guess so. It doesn't seem to be a readily-available function on Android. I have found this: https://github.com/morristech/android-ifaddrs Maybe you can add the code somehow.

nikias commented 1 month ago

You can try this patch: https://gist.github.com/nikias/1db4a854cac748bfccc2257f19443b4b