Error compiling Socket.cpp: 'setsockopt' was not declared in this scope


#1

Hi all, I’m new in this forum and with HiFi so I hope you guide me if I make mistakes while posting.

I’m trying to compile High Fidelity for android. I have followed - or at least I think so - the general instructions and also the android specific ones. I have successfully created build files using cmake

cmake -v -DUSE_ANDROID_TOOLCHAIN=true -DANDROID_QT_CMAKE_PREFIX_PATH=$QT_CMAKE_PREFIX_PATH …

Then I have tried to build the project using make all and after some progress I am getting this error:

…/hifi/libraries/networking/src/udt/Socket.cpp: In member function ‘void udt::Socket::bind(const QHostAddress&, quint16)’:
…/hifi/libraries/networking/src/udt/Socket.cpp:53:66: error: ‘setsockopt’ was not declared in this scope
setsockopt(sd, IPPROTO_IP, IP_MTU_DISCOVER, &val, sizeof(val));
^
make[2]: *** [libraries/networking/CMakeFiles/networking.dir/src/udt/Socket.cpp.o] Error 1
make[1]: *** [libraries/networking/CMakeFiles/networking.dir/all] Error 2

Some more info:
I’m using Qt/5.5/android_armv7/lib/cmake
cmake version is 3.3.2
My environment is mac os x 10.11.1

Let me know if any other data is required.

Thanks in advance!


#2

Anybody working with android? Any clue?
Thanks!


#3

… without regards to android, have you tried adding this:

#include <sys/socket.h>

somewhere near the top of Socket.cpp? (thinking this might at least get you past the undeclared symbol issue)


#4

Hi @humbletim, thank you very much for your response.

I’m checking that sys/socket.h is not included neither in Socket.cpp nor Socket.h.

I ask myself if I should modify sources or it should compile as it is cloned from repository as I could for OS X. My suspect is a dependency issue but It would be great if somebody could confirm me that he can build it right for Android…