getifaddrs() fails
I am working on an iOS app, and I find getifaddrs() fails (errno 6). This is not supposed to fail, and what I think is happening is that my app is using libWebSocket's own getifaddrs(). I think libWebSocket only provides its own getifaddrs() for platforms that don't have their own (i.e. windows), so I wonder if the iOS lib can be recompiled without getifaddrs() ?
I see in ofxLibwebsockets/libs/libwebsockets/include/lws_config.h
/* Define to 1 if we have getifaddrs */
#define HAVE_GETIFADDRS
No problem! Should have a moment later tonight to recompile. If you want to give it a shot, there's fairly detailed instructions how to in the Readme.
Will post here if I get to it sooner!
Gave it try, couldn't easily get it to build.
CMake Error at CMakeLists.txt:7 (project):
The CMAKE_C_COMPILER:
gcc
is not a full path and was not found in the PATH.
Hey Oriol, can you try this one out? https://www.dropbox.com/s/ekap27nvxr9lte7/libwebsockets.a?dl=0
Should work, just want to test before pushing it up
the lib works the same, but getifaddrs() still fails (errno 6)... hard to tell what's going on
Yep I can confirm that getifaddrs() doesn't fail when I don't include ofxLibWebSockets in the project... So it must still be defined somewhere in there?
Hm! I did define the HAVE_GETIFADDRS, and can confirm the preprocessor's working. I don't know a ton about the function, so I'm not sure.
Here's what I did to compile, if you want to play with it:
- change line 30 and 31 in iOS.cmake to:
CMAKE_FORCE_C_COMPILER(/usr/bin/gcc GNU)
CMAKE_FORCE_CXX_COMPILER(/usr/bin/g++ GNU)
- manually pass in openSSL when making (not sure why, haven't had to do that in the past):
cmake -DLWS_OPENSSL_INCLUDE_DIRS=/usr/include/openssl -DLWS_OPENSSL_LIBRARIES=/usr/bin/openssl -DCMAKE_TOOLCHAIN_FILE=~/Dropbox/Code/OF/of_v0.X.X_github/addons/ofxLibwebsockets/extras/ios_libwebsockets/toolchain/iOS.cmake -GXcode ..
- Rest should work! I had some weird errors compiling SSL within Xcode after making, so ended up compiling in OF's version... weird, but it did work.
I will give it another shot when I get a sec.