seasocks icon indicating copy to clipboard operation
seasocks copied to clipboard

error: 'clientBufferSize' on compilation

Open dendisuhubdy opened this issue 8 years ago • 14 comments

/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);

dendisuhubdy avatar Feb 01 '17 23:02 dendisuhubdy

What version of seasocks and compiler are you using?

offa avatar Feb 02 '17 18:02 offa

I have pushed some fixes (PR #54).

offa avatar Feb 02 '17 19:02 offa

@dendisuhubdy can you re-test: I've merged @offa 's changes and so hopefully this is fixed. Thanks!

mattgodbolt avatar Feb 04 '17 14:02 mattgodbolt

Retesting

dendisuhubdy avatar Feb 04 '17 14:02 dendisuhubdy

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 avatar Feb 04 '17 15:02 dendisuhubdy

@dendisuhubdy does OS X have sys/endian.h?

offa avatar Feb 04 '17 23:02 offa

Yes it does but somehow it's not in the right directory (https://github.com/micropython/micropython/issues/2143).

dendisuhubdy avatar Feb 05 '17 00:02 dendisuhubdy

I see two solutions here:

  1. Use hton() instead – that's what's done here, am I correct? Should work on all platforms
  2. Implement a custom swap (template) function; should be both: efficient and portable

offa avatar Feb 06 '17 18:02 offa

Hmm, there's no version of hton*() which supports uint64_t. That's bad …

offa avatar Feb 07 '17 19:02 offa

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).

mdeaconu avatar Feb 25 '17 22:02 mdeaconu

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.

mattgodbolt avatar Feb 25 '17 22:02 mattgodbolt

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.

offa avatar Feb 27 '17 16:02 offa

That's a good idea, but seasocks tries not to have any external dependencies. Does MacOS have select et al?

mattgodbolt avatar Feb 27 '17 16:02 mattgodbolt

I guess poll() is available since it's a POSIX function.

offa avatar Feb 27 '17 17:02 offa