libimobiledevice-glue icon indicating copy to clipboard operation
libimobiledevice-glue copied to clipboard

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

Open coderjing opened this issue 1 year ago • 2 comments

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?

coderjing avatar Aug 12 '24 04:08 coderjing

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 avatar Oct 09 '24 00:10 nikias

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

nikias avatar Oct 09 '24 00:10 nikias

@coderjing have you had a chance to test my patch?

nikias avatar May 16 '25 09:05 nikias