aerospike / aerospike-client-c

Aerospike C Client
Other
98 stars 103 forks source link

Fix error: unknown type name 'fd_set' on Alpine #78

Closed n0madic closed 6 years ago

n0madic commented 6 years ago

When you compile on the Alpine, you get errors

src/include/aerospike/as_poll.h:30:2: error: unknown type name 'fd_set'
  fd_set* set;
  ^~~~~~
src/include/aerospike/as_poll.h: In function 'as_poll_socket':
src/include/aerospike/as_poll.h:67:2: warning: implicit declaration of function 'FD_SET' [-Wimplicit-function-declaration]
  FD_SET(fd % FD_SETSIZE, &poll->set[fd / FD_SETSIZE]);
  ^~~~~~
src/include/aerospike/as_poll.h:67:14: error: 'FD_SETSIZE' undeclared (first use in this function)
  FD_SET(fd % FD_SETSIZE, &poll->set[fd / FD_SETSIZE]);
              ^~~~~~~~~~
src/include/aerospike/as_poll.h:67:14: note: each undeclared identifier is reported only once for each function it appears in
src/include/aerospike/as_poll.h:69:17: error: storage size of 'tv' isn't known
  struct timeval tv;
                 ^~
src/include/aerospike/as_poll.h:83:8: warning: implicit declaration of function 'select' [-Wimplicit-function-declaration]
   rv = select(fd + 1, poll->set /*readfd*/, 0 /*writefd*/, 0/*oobfd*/, tvp);
        ^~~~~~
src/include/aerospike/as_poll.h:93:8: warning: implicit declaration of function 'FD_ISSET' [-Wimplicit-function-declaration]
  if (! FD_ISSET(fd % FD_SETSIZE, &poll->set[fd / FD_SETSIZE])) {
        ^~~~~~~~
src/include/aerospike/as_poll.h:69:17: warning: unused variable 'tv' [-Wunused-variable]
  struct timeval tv;
                 ^~
make: *** [project/rules.mk:55: target/Linux-x86_64/obj/aerospike/as_socket.o] Error 1

To reproduce the error:

docker run --rm -it alpine

apk add --no-cache \
        build-base bash git linux-headers \
        libuv libuv-dev \
        openssl openssl-dev \
        lua5.1 lua5.1-dev

git clone https://github.com/aerospike/aerospike-client-c && \
    cd aerospike-client-c && \
    git submodule update --init && \
    make
BrianNichols commented 6 years ago

We will add sys/select.h include for non-windows platforms in as_poll.h in the next C client release.

BrianNichols commented 6 years ago

C client 4.3.6 should fix the compilation on Alpine.

https://www.aerospike.com/download/client/c/4.3.6/