seasocks
seasocks copied to clipboard
error: 'clientBufferSize' on compilation
/Users/dendisuhubdy/dev/seasocks/src/main/c/./seasocks/Server.h:120:12: error: 'clientBufferSize' overrides a member function but is not marked 'override' [-Werror,-Winconsistent-missing-override]
size_t clientBufferSize() const { return _clientBufferSize; }
^
/Users/dendisuhubdy/dev/seasocks/src/main/c/./seasocks/ServerImpl.h:54:20: note: overridden virtual function is here
virtual size_t clientBufferSize() const = 0;
^
/Users/dendisuhubdy/dev/seasocks/src/main/c/Connection.cpp:301:47: error: use of undeclared identifier 'MSG_NOSIGNAL'
auto sendResult = ::send(_fd, data, size, MSG_NOSIGNAL);
^
/Users/dendisuhubdy/dev/seasocks/src/main/c/Connection.cpp:584:32: error: use of undeclared identifier '__bswap_64'
uint64_t lengthBytes = __bswap_64(messageLength);
What version of seasocks and compiler are you using?
I have pushed some fixes (PR #54).
@dendisuhubdy can you re-test: I've merged @offa 's changes and so hopefully this is fixed. Thanks!
Retesting
Build succeed on Ubuntu 14.04. 👍
Doesn't build on Mac OS X Sierra 10.12, byteswap header not found. I tried to change it to OSByteorder.h but it still didn't work.
#elif defined(__APPLE__)
#include <libkern/OSByteOrder.h>
#define bswap_16 OSSwapInt16
#define bswap_32 OSSwapInt32
#define bswap_64 OSSwapInt64
#ifdef __linux__
#include <byteswap.h>
#elif defined(__OpenBSD__)
#include <sys/endian.h>
#define bswap_16 __swap16
#define bswap_32 __swap32
#define bswap_64 __swap64
#else
#include <sys/endian.h>
#define bswap_16 bswap16
#define bswap_32 bswap32
#define bswap_64 bswap64
#endif
@dendisuhubdy does OS X have sys/endian.h?
Yes it does but somehow it's not in the right directory (https://github.com/micropython/micropython/issues/2143).
I see two solutions here:
- Use
hton()instead – that's what's done here, am I correct? Should work on all platforms - Implement a custom swap (template) function; should be both: efficient and portable
Hmm, there's no version of hton*() which supports uint64_t. That's bad …
Hello,
I have the same issue as @dendisuhubdy has when I try to compile on macOS 10.12.3. For the first issue with __bswap_64 putting the below code will fix it for me:
#if defined(__APPLE__)
#include <libkern/OSByteOrder.h>
#define __bswap_16 OSSwapInt16
#define __bswap_32 OSSwapInt32
#define __bswap_64 OSSwapInt64
#else
#include <byteswap.h>
#endif
Now the build is failing due to the following error:
[ 16%] Building CXX object src/main/c/CMakeFiles/seasocks_obj.dir/Server.cpp.o
/Users/mdu/Dev/GitHub/seasocks/src/main/c/Server.cpp:38:10: fatal error: 'sys/epoll.h'
file not found
#include <sys/epoll.h>
^
1 error generated.
Regarding the 'sys/epoll.h' header it looks like this one is not available on BSD systems (http://stackoverflow.com/questions/13856413/does-os-x-not-support-epoll-function).
Thanks for the report. If MacOS doesn't support epoll, then it will be a tough port to get it on MacOS. I'd happily take patches to make it work with kqueue, but I have no Mac machines to test on myself.
Instead of porting to kqueue, it could be ported to libev, libev, libuv or similar. Even though porting is still necessary to get Macos working.
That's a good idea, but seasocks tries not to have any external dependencies. Does MacOS have select et al?
I guess poll() is available since it's a POSIX function.