any1 / neatvnc

A liberally licensed VNC server library with a clean interface
ISC License
118 stars 29 forks source link

Fails to compile with musl #17

Closed lanodan closed 4 years ago

lanodan commented 4 years ago

Hello,

I tried compiling neatvnc on Gentoo-musl but it fails:

[1/12] clang -Ineatvnc@sha -I. -I../neatvnc-9999 -I../neatvnc-9999/include -I../neatvnc-9999/contrib/miniz -I/usr/include/pixman-1 -Xclang -fcolor-diagnostics -pipe -D_FILE_OFFSET_BITS=64 -std=gnu11 -D_GNU_SOURCE -fvisibility=
hidden -DNDEBUG -mavx -O2 -ggdb -march=core2 -mtune=nehalem -Wall -Wextra -fPIE -fPIC -fPIC -MD -MQ 'neatvnc@sha/src_stream.c.o' -MF 'neatvnc@sha/src_stream.c.o.d' -o 'neatvnc@sha/src_stream.c.o' -c ../neatvnc-9999/src/stream.
c
FAILED: neatvnc@sha/src_stream.c.o
clang -Ineatvnc@sha -I. -I../neatvnc-9999 -I../neatvnc-9999/include -I../neatvnc-9999/contrib/miniz -I/usr/include/pixman-1 -Xclang -fcolor-diagnostics -pipe -D_FILE_OFFSET_BITS=64 -std=gnu11 -D_GNU_SOURCE -fvisibility=hidden
-DNDEBUG -mavx -O2 -ggdb -march=core2 -mtune=nehalem -Wall -Wextra -fPIE -fPIC -fPIC -MD -MQ 'neatvnc@sha/src_stream.c.o' -MF 'neatvnc@sha/src_stream.c.o.d' -o 'neatvnc@sha/src_stream.c.o' -c ../neatvnc-9999/src/stream.c
In file included from ../neatvnc-9999/src/stream.c:32:
In file included from ../neatvnc-9999/include/stream.h:20:
../neatvnc-9999/include/sys/queue.h:38:10: fatal error: 'sys/cdefs.h' file not found
#include <sys/cdefs.h>
         ^~~~~~~~~~~~~
1 error generated.
[2/12] clang -Ineatvnc@sha -I. -I../neatvnc-9999 -I../neatvnc-9999/include -I../neatvnc-9999/contrib/miniz -I/usr/include/pixman-1 -Xclang -fcolor-diagnostics -pipe -D_FILE_OFFSET_BITS=64 -std=gnu11 -D_GNU_SOURCE -fvisibility=
hidden -DNDEBUG -mavx -O2 -ggdb -march=core2 -mtune=nehalem -Wall -Wextra -fPIE -fPIC -fPIC -MD -MQ 'neatvnc@sha/src_tight.c.o' -MF 'neatvnc@sha/src_tight.c.o.d' -o 'neatvnc@sha/src_tight.c.o' -c ../neatvnc-9999/src/tight.c
FAILED: neatvnc@sha/src_tight.c.o
clang -Ineatvnc@sha -I. -I../neatvnc-9999 -I../neatvnc-9999/include -I../neatvnc-9999/contrib/miniz -I/usr/include/pixman-1 -Xclang -fcolor-diagnostics -pipe -D_FILE_OFFSET_BITS=64 -std=gnu11 -D_GNU_SOURCE -fvisibility=hidden
-DNDEBUG -mavx -O2 -ggdb -march=core2 -mtune=nehalem -Wall -Wextra -fPIE -fPIC -fPIC -MD -MQ 'neatvnc@sha/src_tight.c.o' -MF 'neatvnc@sha/src_tight.c.o.d' -o 'neatvnc@sha/src_tight.c.o' -c ../neatvnc-9999/src/tight.c
In file included from ../neatvnc-9999/src/tight.c:6:
In file included from ../neatvnc-9999/include/common.h:24:
../neatvnc-9999/include/sys/queue.h:38:10: fatal error: 'sys/cdefs.h' file not found
#include <sys/cdefs.h>
         ^~~~~~~~~~~~~
1 error generated.

I also tried removing your copy of sys/queue.h and changed references to <sys/queue.h> but ended up with:

[1/12] clang -Ineatvnc@sha -I. -I../neatvnc-9999 -I../neatvnc-9999/include -I../neatvnc-9999/contrib/miniz -I/usr/include/pixman-1 -Xclang -fcolor-diagnostics -pipe -D_FILE_OFFSET_BITS=64 -std=gnu11 -D_GNU_SOURCE -fvisibility=
hidden -DNDEBUG -mavx -O2 -ggdb -march=core2 -mtune=nehalem -Wall -Wextra -fPIE -fPIC -fPIC -MD -MQ 'neatvnc@sha/src_stream.c.o' -MF 'neatvnc@sha/src_stream.c.o.d' -o 'neatvnc@sha/src_stream.c.o' -c ../neatvnc-9999/src/stream.
c
FAILED: neatvnc@sha/src_stream.c.o
clang -Ineatvnc@sha -I. -I../neatvnc-9999 -I../neatvnc-9999/include -I../neatvnc-9999/contrib/miniz -I/usr/include/pixman-1 -Xclang -fcolor-diagnostics -pipe -D_FILE_OFFSET_BITS=64 -std=gnu11 -D_GNU_SOURCE -fvisibility=hidden
-DNDEBUG -mavx -O2 -ggdb -march=core2 -mtune=nehalem -Wall -Wextra -fPIE -fPIC -fPIC -MD -MQ 'neatvnc@sha/src_stream.c.o' -MF 'neatvnc@sha/src_stream.c.o.d' -o 'neatvnc@sha/src_stream.c.o' -c ../neatvnc-9999/src/stream.c
../neatvnc-9999/src/stream.c:148:2: warning: implicit declaration of function 'TAILQ_FOREACH_SAFE' is invalid in C99 [-Wimplicit-function-declaration]
        TAILQ_FOREACH_SAFE(req, &self->send_queue, link, tmp) {
        ^
../neatvnc-9999/src/stream.c:148:55: error: expected ';' after expression
        TAILQ_FOREACH_SAFE(req, &self->send_queue, link, tmp) {
                                                             ^
                                                             ;
../neatvnc-9999/src/stream.c:163:4: error: 'break' statement not in loop or switch statement
                        break;
                        ^
../neatvnc-9999/src/stream.c:265:54: warning: unused parameter 'status' [-Wunused-parameter]
static void stream__on_event(uv_poll_t* uv_poll, int status, int events)
                                                     ^
2 warnings and 2 errors generated.

I think one portable way this could be fixed is by depending on libbsd when the OS isn't a BSD.

lanodan commented 4 years ago

Managed to fix it here by removing #include <sys/cdefs.h> from your include/sys/queue.h. Compiling is successful against glibc and musl.

any1 commented 4 years ago

Thank you for reporting. I will address the issue.