angt / glorytun

Multipath UDP tunnel
BSD 2-Clause "Simplified" License
683 stars 105 forks source link

glorytun master/stable does not compile on OpenBSD 6.6 #62

Closed vifino closed 4 years ago

vifino commented 4 years ago

Hey. Seems like this software does not compile on OpenBSD.

Setup: (Might not be complete)

host# pkg_add git gmake libsodium

host$ git clone https://github.com/angt/glorytun --recursive --branch stable
host$ cd glorytun
host$ export CPPFLAGS="-I/usr/local/include" LDFLAGS="-L/usr/local/lib"

GNU Make attempt:

host$ gmake
glorytun
In file included from src/bench.c:1:
src/common.h:65:30: warning: declaration of 'struct sockaddr' will not be visible outside of this function [-Wvisibility]
void     gt_set_port (struct sockaddr *, uint16_t);
                             ^
src/common.h:66:30: warning: declaration of 'struct sockaddr' will not be visible outside of this function [-Wvisibility]
uint16_t gt_get_port (struct sockaddr *);
                             ^
src/common.h:67:46: warning: declaration of 'struct sockaddr' will not be visible outside of this function [-Wvisibility]
int      gt_toaddr   (char *, size_t, struct sockaddr *);
                                             ^
3 warnings generated.
In file included from src/set.c:1:
src/common.h:65:30: warning: declaration of 'struct sockaddr' will not be visible outside of this function [-Wvisibility]
void     gt_set_port (struct sockaddr *, uint16_t);
                             ^
src/common.h:66:30: warning: declaration of 'struct sockaddr' will not be visible outside of this function [-Wvisibility]
uint16_t gt_get_port (struct sockaddr *);
                             ^
src/common.h:67:46: warning: declaration of 'struct sockaddr' will not be visible outside of this function [-Wvisibility]
int      gt_toaddr   (char *, size_t, struct sockaddr *);
                                             ^
3 warnings generated.
In file included from src/keygen.c:1:
src/common.h:65:30: warning: declaration of 'struct sockaddr' will not be visible outside of this function [-Wvisibility]
void     gt_set_port (struct sockaddr *, uint16_t);
                             ^
src/common.h:66:30: warning: declaration of 'struct sockaddr' will not be visible outside of this function [-Wvisibility]
uint16_t gt_get_port (struct sockaddr *);
                             ^
src/common.h:67:46: warning: declaration of 'struct sockaddr' will not be visible outside of this function [-Wvisibility]
int      gt_toaddr   (char *, size_t, struct sockaddr *);
                                             ^
3 warnings generated.
In file included from src/main.c:1:
src/common.h:65:30: warning: declaration of 'struct sockaddr' will not be visible outside of this function [-Wvisibility]
void     gt_set_port (struct sockaddr *, uint16_t);
                             ^
src/common.h:66:30: warning: declaration of 'struct sockaddr' will not be visible outside of this function [-Wvisibility]
uint16_t gt_get_port (struct sockaddr *);
                             ^
src/common.h:67:46: warning: declaration of 'struct sockaddr' will not be visible outside of this function [-Wvisibility]
int      gt_toaddr   (char *, size_t, struct sockaddr *);
                                             ^
3 warnings generated.
In file included from src/bind.c:1:
src/common.h:65:30: warning: declaration of 'struct sockaddr' will not be visible outside of this function [-Wvisibility]
void     gt_set_port (struct sockaddr *, uint16_t);
                             ^
src/common.h:66:30: warning: declaration of 'struct sockaddr' will not be visible outside of this function [-Wvisibility]
uint16_t gt_get_port (struct sockaddr *);
                             ^
src/common.h:67:46: warning: declaration of 'struct sockaddr' will not be visible outside of this function [-Wvisibility]
int      gt_toaddr   (char *, size_t, struct sockaddr *);
                                             ^
src/bind.c:136:17: warning: incompatible pointer types passing 'struct sockaddr *' to parameter of type 'struct sockaddr *' [-Wincompatible-pointer-types]
    gt_set_port((struct sockaddr *)&bind_addr, bind_port);
                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/common.h:65:40: note: passing argument to parameter here
void     gt_set_port (struct sockaddr *, uint16_t);
                                       ^
src/bind.c:137:17: warning: incompatible pointer types passing 'struct sockaddr *' to parameter of type 'struct sockaddr *' [-Wincompatible-pointer-types]
    gt_set_port((struct sockaddr *)&peer_addr, peer_port);
                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/common.h:65:40: note: passing argument to parameter here
void     gt_set_port (struct sockaddr *, uint16_t);
                                       ^
5 warnings generated.
In file included from src/path.c:1:
src/common.h:65:30: warning: declaration of 'struct sockaddr' will not be visible outside of this function [-Wvisibility]
void     gt_set_port (struct sockaddr *, uint16_t);
                             ^
src/common.h:66:30: warning: declaration of 'struct sockaddr' will not be visible outside of this function [-Wvisibility]
uint16_t gt_get_port (struct sockaddr *);
                             ^
src/common.h:67:46: warning: declaration of 'struct sockaddr' will not be visible outside of this function [-Wvisibility]
int      gt_toaddr   (char *, size_t, struct sockaddr *);
                                             ^
src/path.c:19:13: warning: incompatible pointer types passing 'struct sockaddr *' to parameter of type 'struct sockaddr *' [-Wincompatible-pointer-types]
            (struct sockaddr *)&path->local_addr);
            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/common.h:67:56: note: passing argument to parameter here
int      gt_toaddr   (char *, size_t, struct sockaddr *);
                                                       ^
src/path.c:21:13: warning: incompatible pointer types passing 'struct sockaddr *' to parameter of type 'struct sockaddr *' [-Wincompatible-pointer-types]
            (struct sockaddr *)&path->r_addr);
            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/common.h:67:56: note: passing argument to parameter here
int      gt_toaddr   (char *, size_t, struct sockaddr *);
                                                       ^
src/path.c:23:13: warning: incompatible pointer types passing 'struct sockaddr *' to parameter of type 'struct sockaddr *' [-Wincompatible-pointer-types]
            (struct sockaddr *)&path->addr);
            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/common.h:67:56: note: passing argument to parameter here
int      gt_toaddr   (char *, size_t, struct sockaddr *);
                                                       ^
src/path.c:63:21: warning: incompatible pointer types passing 'struct sockaddr *' to parameter of type 'struct sockaddr *' [-Wincompatible-pointer-types]
        gt_get_port((struct sockaddr *)&path->local_addr),
                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/common.h:66:40: note: passing argument to parameter here
uint16_t gt_get_port (struct sockaddr *);
                                       ^
src/path.c:65:21: warning: incompatible pointer types passing 'struct sockaddr *' to parameter of type 'struct sockaddr *' [-Wincompatible-pointer-types]
        gt_get_port((struct sockaddr *)&path->r_addr),
                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/common.h:66:40: note: passing argument to parameter here
uint16_t gt_get_port (struct sockaddr *);
                                       ^
src/path.c:67:21: warning: incompatible pointer types passing 'struct sockaddr *' to parameter of type 'struct sockaddr *' [-Wincompatible-pointer-types]
        gt_get_port((struct sockaddr *)&path->addr),
                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/common.h:66:40: note: passing argument to parameter here
uint16_t gt_get_port (struct sockaddr *);
                                       ^
src/path.c:90:27: error: incomplete definition of type 'struct sockaddr_in'
        return ((memcmp(&A->sin_addr, &B->sin_addr, sizeof(A->sin_addr))));
                         ~^
src/path.c:88:16: note: forward declaration of 'struct sockaddr_in'
        struct sockaddr_in *A = (struct sockaddr_in *)a;
               ^
src/path.c:90:41: error: incomplete definition of type 'struct sockaddr_in'
        return ((memcmp(&A->sin_addr, &B->sin_addr, sizeof(A->sin_addr))));
                                       ~^
src/path.c:88:16: note: forward declaration of 'struct sockaddr_in'
        struct sockaddr_in *A = (struct sockaddr_in *)a;
               ^
src/path.c:90:61: error: incomplete definition of type 'struct sockaddr_in'
        return ((memcmp(&A->sin_addr, &B->sin_addr, sizeof(A->sin_addr))));
                                                           ~^
src/path.c:88:16: note: forward declaration of 'struct sockaddr_in'
        struct sockaddr_in *A = (struct sockaddr_in *)a;
               ^
src/path.c:96:27: error: incomplete definition of type 'struct sockaddr_in6'
        return ((memcmp(&A->sin6_addr, &B->sin6_addr, sizeof(A->sin6_addr))));
                         ~^
src/path.c:94:16: note: forward declaration of 'struct sockaddr_in6'
        struct sockaddr_in6 *A = (struct sockaddr_in6 *)a;
               ^
src/path.c:96:42: error: incomplete definition of type 'struct sockaddr_in6'
        return ((memcmp(&A->sin6_addr, &B->sin6_addr, sizeof(A->sin6_addr))));
                                        ~^
src/path.c:94:16: note: forward declaration of 'struct sockaddr_in6'
        struct sockaddr_in6 *A = (struct sockaddr_in6 *)a;
               ^
src/path.c:96:63: error: incomplete definition of type 'struct sockaddr_in6'
        return ((memcmp(&A->sin6_addr, &B->sin6_addr, sizeof(A->sin6_addr))));
                                                             ~^
src/path.c:94:16: note: forward declaration of 'struct sockaddr_in6'
        struct sockaddr_in6 *A = (struct sockaddr_in6 *)a;
               ^
9 warnings and 6 errors generated.
In file included from src/ctl.c:1:
src/common.h:65:30: warning: declaration of 'struct sockaddr' will not be visible outside of this function [-Wvisibility]
void     gt_set_port (struct sockaddr *, uint16_t);
                             ^
src/common.h:66:30: warning: declaration of 'struct sockaddr' will not be visible outside of this function [-Wvisibility]
uint16_t gt_get_port (struct sockaddr *);
                             ^
src/common.h:67:46: warning: declaration of 'struct sockaddr' will not be visible outside of this function [-Wvisibility]
int      gt_toaddr   (char *, size_t, struct sockaddr *);
                                             ^
3 warnings generated.
In file included from src/iface.c:1:
src/common.h:65:30: warning: declaration of 'struct sockaddr' will not be visible outside of this function [-Wvisibility]
void     gt_set_port (struct sockaddr *, uint16_t);
                             ^
src/common.h:66:30: warning: declaration of 'struct sockaddr' will not be visible outside of this function [-Wvisibility]
uint16_t gt_get_port (struct sockaddr *);
                             ^
src/common.h:67:46: warning: declaration of 'struct sockaddr' will not be visible outside of this function [-Wvisibility]
int      gt_toaddr   (char *, size_t, struct sockaddr *);
                                             ^
3 warnings generated.
In file included from src/common.c:1:
src/common.h:65:30: warning: declaration of 'struct sockaddr' will not be visible outside of this function [-Wvisibility]
void     gt_set_port (struct sockaddr *, uint16_t);
                             ^
src/common.h:66:30: warning: declaration of 'struct sockaddr' will not be visible outside of this function [-Wvisibility]
uint16_t gt_get_port (struct sockaddr *);
                             ^
src/common.h:67:46: warning: declaration of 'struct sockaddr' will not be visible outside of this function [-Wvisibility]
int      gt_toaddr   (char *, size_t, struct sockaddr *);
                                             ^
src/common.c:74:20: warning: declaration of 'struct sockaddr' will not be visible outside of this function [-Wvisibility]
gt_set_port(struct sockaddr *sa, uint16_t port)
                   ^
src/common.c:74:1: error: conflicting types for 'gt_set_port'
gt_set_port(struct sockaddr *sa, uint16_t port)
^
src/common.h:65:10: note: previous declaration is here
void     gt_set_port (struct sockaddr *, uint16_t);
         ^
src/common.c:76:15: error: incomplete definition of type 'struct sockaddr'
    switch (sa->sa_family) {
            ~~^
src/common.c:74:20: note: forward declaration of 'struct sockaddr'
gt_set_port(struct sockaddr *sa, uint16_t port)
                   ^
src/common.c:78:35: error: incomplete definition of type 'struct sockaddr_in'
        ((struct sockaddr_in *)sa)->sin_port = htons(port);
        ~~~~~~~~~~~~~~~~~~~~~~~~~~^
src/common.c:78:18: note: forward declaration of 'struct sockaddr_in'
        ((struct sockaddr_in *)sa)->sin_port = htons(port);
                 ^
src/common.c:81:36: error: incomplete definition of type 'struct sockaddr_in6'
        ((struct sockaddr_in6 *)sa)->sin6_port = htons(port);
        ~~~~~~~~~~~~~~~~~~~~~~~~~~~^
src/common.c:81:18: note: forward declaration of 'struct sockaddr_in6'
        ((struct sockaddr_in6 *)sa)->sin6_port = htons(port);
                 ^
src/common.c:87:20: warning: declaration of 'struct sockaddr' will not be visible outside of this function [-Wvisibility]
gt_get_port(struct sockaddr *sa)
                   ^
src/common.c:87:1: error: conflicting types for 'gt_get_port'
gt_get_port(struct sockaddr *sa)
^
src/common.h:66:10: note: previous declaration is here
uint16_t gt_get_port (struct sockaddr *);
         ^
src/common.c:89:15: error: incomplete definition of type 'struct sockaddr'
    switch (sa->sa_family) {
            ~~^
src/common.c:87:20: note: forward declaration of 'struct sockaddr'
gt_get_port(struct sockaddr *sa)
                   ^
src/common.c:91:48: error: incomplete definition of type 'struct sockaddr_in'
        return ntohs(((struct sockaddr_in *)sa)->sin_port);
                     ~~~~~~~~~~~~~~~~~~~~~~~~~~^
/usr/include/sys/endian.h:97:28: note: expanded from macro 'ntohs'
#define ntohs(x)        __htobe16(x)
                                  ^
/usr/include/sys/_endian.h:87:36: note: expanded from macro '__swap16'
        (__uint16_t)(__builtin_constant_p(x) ? __swap16gen(x) : __swap16md(x))
                                          ^
src/common.c:91:31: note: forward declaration of 'struct sockaddr_in'
        return ntohs(((struct sockaddr_in *)sa)->sin_port);
                              ^
src/common.c:91:48: error: incomplete definition of type 'struct sockaddr_in'
        return ntohs(((struct sockaddr_in *)sa)->sin_port);
                     ~~~~~~~~~~~~~~~~~~~~~~~~~~^
/usr/include/sys/endian.h:97:28: note: expanded from macro 'ntohs'
#define ntohs(x)        __htobe16(x)
                                  ^
/usr/include/sys/_endian.h:87:53: note: expanded from macro '__swap16'
        (__uint16_t)(__builtin_constant_p(x) ? __swap16gen(x) : __swap16md(x))
                                                           ^
/usr/include/sys/_endian.h:49:32: note: expanded from macro '__swap16gen'
    (__uint16_t)(((__uint16_t)(x) & 0xffU) << 8 | ((__uint16_t)(x) & 0xff00U) >> 8)
                               ^
src/common.c:91:31: note: forward declaration of 'struct sockaddr_in'
        return ntohs(((struct sockaddr_in *)sa)->sin_port);
                              ^
src/common.c:91:48: error: incomplete definition of type 'struct sockaddr_in'
        return ntohs(((struct sockaddr_in *)sa)->sin_port);
                     ~~~~~~~~~~~~~~~~~~~~~~~~~~^
/usr/include/sys/endian.h:97:28: note: expanded from macro 'ntohs'
#define ntohs(x)        __htobe16(x)
                                  ^
/usr/include/sys/_endian.h:87:53: note: expanded from macro '__swap16'
        (__uint16_t)(__builtin_constant_p(x) ? __swap16gen(x) : __swap16md(x))
                                                           ^
/usr/include/sys/_endian.h:49:65: note: expanded from macro '__swap16gen'
    (__uint16_t)(((__uint16_t)(x) & 0xffU) << 8 | ((__uint16_t)(x) & 0xff00U) >> 8)
                                                                ^
src/common.c:91:31: note: forward declaration of 'struct sockaddr_in'
        return ntohs(((struct sockaddr_in *)sa)->sin_port);
                              ^
src/common.c:91:48: error: incomplete definition of type 'struct sockaddr_in'
        return ntohs(((struct sockaddr_in *)sa)->sin_port);
                     ~~~~~~~~~~~~~~~~~~~~~~~~~~^
/usr/include/sys/endian.h:97:28: note: expanded from macro 'ntohs'
#define ntohs(x)        __htobe16(x)
                                  ^
/usr/include/sys/_endian.h:87:69: note: expanded from macro '__swap16'
        (__uint16_t)(__builtin_constant_p(x) ? __swap16gen(x) : __swap16md(x))
                                                                           ^
src/common.c:91:31: note: forward declaration of 'struct sockaddr_in'
        return ntohs(((struct sockaddr_in *)sa)->sin_port);
                              ^
src/common.c:93:49: error: incomplete definition of type 'struct sockaddr_in6'
        return ntohs(((struct sockaddr_in6 *)sa)->sin6_port);
                     ~~~~~~~~~~~~~~~~~~~~~~~~~~~^
/usr/include/sys/endian.h:97:28: note: expanded from macro 'ntohs'
#define ntohs(x)        __htobe16(x)
                                  ^
/usr/include/sys/_endian.h:87:36: note: expanded from macro '__swap16'
        (__uint16_t)(__builtin_constant_p(x) ? __swap16gen(x) : __swap16md(x))
                                          ^
src/common.c:93:31: note: forward declaration of 'struct sockaddr_in6'
        return ntohs(((struct sockaddr_in6 *)sa)->sin6_port);
                              ^
src/common.c:93:49: error: incomplete definition of type 'struct sockaddr_in6'
        return ntohs(((struct sockaddr_in6 *)sa)->sin6_port);
                     ~~~~~~~~~~~~~~~~~~~~~~~~~~~^
/usr/include/sys/endian.h:97:28: note: expanded from macro 'ntohs'
#define ntohs(x)        __htobe16(x)
                                  ^
/usr/include/sys/_endian.h:87:53: note: expanded from macro '__swap16'
        (__uint16_t)(__builtin_constant_p(x) ? __swap16gen(x) : __swap16md(x))
                                                           ^
/usr/include/sys/_endian.h:49:32: note: expanded from macro '__swap16gen'
    (__uint16_t)(((__uint16_t)(x) & 0xffU) << 8 | ((__uint16_t)(x) & 0xff00U) >> 8)
                               ^
src/common.c:93:31: note: forward declaration of 'struct sockaddr_in6'
        return ntohs(((struct sockaddr_in6 *)sa)->sin6_port);
                              ^
src/common.c:93:49: error: incomplete definition of type 'struct sockaddr_in6'
        return ntohs(((struct sockaddr_in6 *)sa)->sin6_port);
                     ~~~~~~~~~~~~~~~~~~~~~~~~~~~^
/usr/include/sys/endian.h:97:28: note: expanded from macro 'ntohs'
#define ntohs(x)        __htobe16(x)
                                  ^
/usr/include/sys/_endian.h:87:53: note: expanded from macro '__swap16'
        (__uint16_t)(__builtin_constant_p(x) ? __swap16gen(x) : __swap16md(x))
                                                           ^
/usr/include/sys/_endian.h:49:65: note: expanded from macro '__swap16gen'
    (__uint16_t)(((__uint16_t)(x) & 0xffU) << 8 | ((__uint16_t)(x) & 0xff00U) >> 8)
                                                                ^
src/common.c:93:31: note: forward declaration of 'struct sockaddr_in6'
        return ntohs(((struct sockaddr_in6 *)sa)->sin6_port);
                              ^
src/common.c:93:49: error: incomplete definition of type 'struct sockaddr_in6'
        return ntohs(((struct sockaddr_in6 *)sa)->sin6_port);
                     ~~~~~~~~~~~~~~~~~~~~~~~~~~~^
/usr/include/sys/endian.h:97:28: note: expanded from macro 'ntohs'
#define ntohs(x)        __htobe16(x)
                                  ^
/usr/include/sys/_endian.h:87:69: note: expanded from macro '__swap16'
        (__uint16_t)(__builtin_constant_p(x) ? __swap16gen(x) : __swap16md(x))
                                                                           ^
src/common.c:93:31: note: forward declaration of 'struct sockaddr_in6'
        return ntohs(((struct sockaddr_in6 *)sa)->sin6_port);
                              ^
src/common.c:100:42: warning: declaration of 'struct sockaddr' will not be visible outside of this function [-Wvisibility]
gt_toaddr(char *str, size_t size, struct sockaddr *sa)
                                         ^
src/common.c:100:1: error: conflicting types for 'gt_toaddr'
gt_toaddr(char *str, size_t size, struct sockaddr *sa)
^
src/common.h:67:10: note: previous declaration is here
int      gt_toaddr   (char *, size_t, struct sockaddr *);
         ^
src/common.c:105:15: error: incomplete definition of type 'struct sockaddr'
    switch (sa->sa_family) {
            ~~^
src/common.c:100:42: note: forward declaration of 'struct sockaddr'
gt_toaddr(char *str, size_t size, struct sockaddr *sa)
                                         ^
src/common.c:108:44: error: incomplete definition of type 'struct sockaddr_in'
                &((struct sockaddr_in *)sa)->sin_addr, str, (socklen_t)size);
                 ~~~~~~~~~~~~~~~~~~~~~~~~~~^
src/common.c:108:27: note: forward declaration of 'struct sockaddr_in'
                &((struct sockaddr_in *)sa)->sin_addr, str, (socklen_t)size);
                          ^
src/common.c:107:28: error: use of undeclared identifier 'AF_INET'
        return -!inet_ntop(AF_INET,
                           ^
src/common.c:111:45: error: incomplete definition of type 'struct sockaddr_in6'
                &((struct sockaddr_in6 *)sa)->sin6_addr, str, (socklen_t)size);
                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~^
src/common.c:111:27: note: forward declaration of 'struct sockaddr_in6'
                &((struct sockaddr_in6 *)sa)->sin6_addr, str, (socklen_t)size);
                          ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
6 warnings and 20 errors generated.
In file included from src/show.c:1:
src/common.h:65:30: warning: declaration of 'struct sockaddr' will not be visible outside of this function [-Wvisibility]
void     gt_set_port (struct sockaddr *, uint16_t);
                             ^
src/common.h:66:30: warning: declaration of 'struct sockaddr' will not be visible outside of this function [-Wvisibility]
uint16_t gt_get_port (struct sockaddr *);
                             ^
src/common.h:67:46: warning: declaration of 'struct sockaddr' will not be visible outside of this function [-Wvisibility]
int      gt_toaddr   (char *, size_t, struct sockaddr *);
                                             ^
src/show.c:22:35: warning: incompatible pointer types passing 'struct sockaddr *' to parameter of type 'struct sockaddr *' [-Wincompatible-pointer-types]
    gt_toaddr(addr, sizeof(addr), (struct sockaddr *)ss);
                                  ^~~~~~~~~~~~~~~~~~~~~
src/common.h:67:56: note: passing argument to parameter here
int      gt_toaddr   (char *, size_t, struct sockaddr *);
                                                       ^
src/show.c:32:24: warning: incompatible pointer types passing 'struct sockaddr *' to parameter of type 'struct sockaddr *' [-Wincompatible-pointer-types]
           gt_get_port((struct sockaddr *)ss));
                       ^~~~~~~~~~~~~~~~~~~~~
src/common.h:66:40: note: passing argument to parameter here
uint16_t gt_get_port (struct sockaddr *);
                                       ^
src/show.c:67:15: warning: incompatible pointer types passing 'struct sockaddr *' to parameter of type 'struct sockaddr *' [-Wincompatible-pointer-types]
              (struct sockaddr *)&res.status.bind);
              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/common.h:67:56: note: passing argument to parameter here
int      gt_toaddr   (char *, size_t, struct sockaddr *);
                                                       ^
src/show.c:70:28: warning: incompatible pointer types passing 'struct sockaddr *' to parameter of type 'struct sockaddr *' [-Wincompatible-pointer-types]
                           (struct sockaddr *)&res.status.peer);
                           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/common.h:67:56: note: passing argument to parameter here
int      gt_toaddr   (char *, size_t, struct sockaddr *);
                                                       ^
src/show.c:89:28: warning: incompatible pointer types passing 'struct sockaddr *' to parameter of type 'struct sockaddr *' [-Wincompatible-pointer-types]
               gt_get_port((struct sockaddr *)&res.status.bind),
                           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/common.h:66:40: note: passing argument to parameter here
uint16_t gt_get_port (struct sockaddr *);
                                       ^
src/show.c:109:28: warning: incompatible pointer types passing 'struct sockaddr *' to parameter of type 'struct sockaddr *' [-Wincompatible-pointer-types]
               gt_get_port((struct sockaddr *)&res.status.bind),
                           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/common.h:66:40: note: passing argument to parameter here
uint16_t gt_get_port (struct sockaddr *);
                                       ^
src/show.c:111:28: warning: incompatible pointer types passing 'struct sockaddr *' to parameter of type 'struct sockaddr *' [-Wincompatible-pointer-types]
               gt_get_port((struct sockaddr *)&res.status.peer),
                           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/common.h:66:40: note: passing argument to parameter here
uint16_t gt_get_port (struct sockaddr *);
                                       ^
10 warnings generated.
In file included from src/tun.c:1:
src/common.h:65:30: warning: declaration of 'struct sockaddr' will not be visible outside of this function [-Wvisibility]
void     gt_set_port (struct sockaddr *, uint16_t);
                             ^
src/common.h:66:30: warning: declaration of 'struct sockaddr' will not be visible outside of this function [-Wvisibility]
uint16_t gt_get_port (struct sockaddr *);
                             ^
src/common.h:67:46: warning: declaration of 'struct sockaddr' will not be visible outside of this function [-Wvisibility]
int      gt_toaddr   (char *, size_t, struct sockaddr *);
                                             ^
src/tun.c:141:17: error: use of undeclared identifier 'tmp'
    return open(tmp, O_RDWR);
                ^
3 warnings and 1 error generated.
gmake: *** [Makefile:23: glorytun] Error 1

Meson/Ninja attempt:

host$ meson build
The Meson build system
Version: 0.51.2
Source dir: /home/vifino/src/glorytun-stable
Build dir: /home/vifino/src/glorytun-stable/build
Build type: native build
Project name: glorytun
Project version: 0.3.1
Appending LDFLAGS from environment: '-L/usr/local/lib'
Appending CPPFLAGS from environment: '-I/usr/local/include'
Appending LDFLAGS from environment: '-L/usr/local/lib'
Appending CPPFLAGS from environment: '-I/usr/local/include'
C compiler for the host machine: cc (clang 8.0.1 "OpenBSD clang version 8.0.1 (tags/RELEASE_801/final) (based on LLVM 8.0.1)")
Build machine cpu family: x86_64
Build machine cpu: x86_64
Found pkg-config: /usr/bin/pkg-config (0.29.1)
Run-time dependency libsodium found: YES 1.0.18
Did not find CMake 'cmake'
Found CMake: NO
Run-time dependency systemd found: NO (tried pkgconfig and cmake)
Build targets in project: 1
Found ninja-1.9.0 at /usr/local/bin/ninja
host$ cd build
host$ ninja
[1/15] Compiling C object 'glorytun@exe/src_common.c.o'.
FAILED: glorytun@exe/src_common.c.o
cc -Iglorytun@exe -I. -I.. -I/usr/local/include -Xclang -fcolor-diagnostics -pipe -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -std=gnu99 -O2 -g '-DPACKAGE_VERSION="0.3.1"' '-DPACKAGE_NAME="glorytun"' -MD -MQ 'glorytun@exe/src_common.c.o' -MF 'glorytun@exe/src_common.c.o.d' -o 'glorytun@exe/src_common.c.o' -c ../src/common.c
In file included from ../src/common.c:1:
../src/common.h:65:30: warning: declaration of 'struct sockaddr' will not be visible outside of this function [-Wvisibility]
void     gt_set_port (struct sockaddr *, uint16_t);
                             ^
../src/common.h:66:30: warning: declaration of 'struct sockaddr' will not be visible outside of this function [-Wvisibility]
uint16_t gt_get_port (struct sockaddr *);
                             ^
../src/common.h:67:46: warning: declaration of 'struct sockaddr' will not be visible outside of this function [-Wvisibility]
int      gt_toaddr   (char *, size_t, struct sockaddr *);
                                             ^
../src/common.c:74:20: warning: declaration of 'struct sockaddr' will not be visible outside of this function [-Wvisibility]
gt_set_port(struct sockaddr *sa, uint16_t port)
                   ^
../src/common.c:74:1: error: conflicting types for 'gt_set_port'
gt_set_port(struct sockaddr *sa, uint16_t port)
^
../src/common.h:65:10: note: previous declaration is here
void     gt_set_port (struct sockaddr *, uint16_t);
         ^
../src/common.c:76:15: error: incomplete definition of type 'struct sockaddr'
    switch (sa->sa_family) {
            ~~^
../src/common.c:74:20: note: forward declaration of 'struct sockaddr'
gt_set_port(struct sockaddr *sa, uint16_t port)
                   ^
../src/common.c:78:35: error: incomplete definition of type 'struct sockaddr_in'
        ((struct sockaddr_in *)sa)->sin_port = htons(port);
        ~~~~~~~~~~~~~~~~~~~~~~~~~~^
../src/common.c:78:18: note: forward declaration of 'struct sockaddr_in'
        ((struct sockaddr_in *)sa)->sin_port = htons(port);
                 ^
../src/common.c:81:36: error: incomplete definition of type 'struct sockaddr_in6'
        ((struct sockaddr_in6 *)sa)->sin6_port = htons(port);
        ~~~~~~~~~~~~~~~~~~~~~~~~~~~^
../src/common.c:81:18: note: forward declaration of 'struct sockaddr_in6'
        ((struct sockaddr_in6 *)sa)->sin6_port = htons(port);
                 ^
../src/common.c:87:20: warning: declaration of 'struct sockaddr' will not be visible outside of this function [-Wvisibility]
gt_get_port(struct sockaddr *sa)
                   ^
../src/common.c:87:1: error: conflicting types for 'gt_get_port'
gt_get_port(struct sockaddr *sa)
^
../src/common.h:66:10: note: previous declaration is here
uint16_t gt_get_port (struct sockaddr *);
         ^
../src/common.c:89:15: error: incomplete definition of type 'struct sockaddr'
    switch (sa->sa_family) {
            ~~^
../src/common.c:87:20: note: forward declaration of 'struct sockaddr'
gt_get_port(struct sockaddr *sa)
                   ^
../src/common.c:91:48: error: incomplete definition of type 'struct sockaddr_in'
        return ntohs(((struct sockaddr_in *)sa)->sin_port);
                     ~~~~~~~~~~~~~~~~~~~~~~~~~~^
/usr/include/sys/endian.h:97:28: note: expanded from macro 'ntohs'
#define ntohs(x)        __htobe16(x)
                                  ^
/usr/include/sys/_endian.h:87:36: note: expanded from macro '__swap16'
        (__uint16_t)(__builtin_constant_p(x) ? __swap16gen(x) : __swap16md(x))
                                          ^
../src/common.c:91:31: note: forward declaration of 'struct sockaddr_in'
        return ntohs(((struct sockaddr_in *)sa)->sin_port);
                              ^
../src/common.c:91:48: error: incomplete definition of type 'struct sockaddr_in'
        return ntohs(((struct sockaddr_in *)sa)->sin_port);
                     ~~~~~~~~~~~~~~~~~~~~~~~~~~^
/usr/include/sys/endian.h:97:28: note: expanded from macro 'ntohs'
#define ntohs(x)        __htobe16(x)
                                  ^
/usr/include/sys/_endian.h:87:53: note: expanded from macro '__swap16'
        (__uint16_t)(__builtin_constant_p(x) ? __swap16gen(x) : __swap16md(x))
                                                           ^
/usr/include/sys/_endian.h:49:32: note: expanded from macro '__swap16gen'
    (__uint16_t)(((__uint16_t)(x) & 0xffU) << 8 | ((__uint16_t)(x) & 0xff00U) >> 8)
                               ^
../src/common.c:91:31: note: forward declaration of 'struct sockaddr_in'
        return ntohs(((struct sockaddr_in *)sa)->sin_port);
                              ^
../src/common.c:91:48: error: incomplete definition of type 'struct sockaddr_in'
        return ntohs(((struct sockaddr_in *)sa)->sin_port);
                     ~~~~~~~~~~~~~~~~~~~~~~~~~~^
/usr/include/sys/endian.h:97:28: note: expanded from macro 'ntohs'
#define ntohs(x)        __htobe16(x)
                                  ^
/usr/include/sys/_endian.h:87:53: note: expanded from macro '__swap16'
        (__uint16_t)(__builtin_constant_p(x) ? __swap16gen(x) : __swap16md(x))
                                                           ^
/usr/include/sys/_endian.h:49:65: note: expanded from macro '__swap16gen'
    (__uint16_t)(((__uint16_t)(x) & 0xffU) << 8 | ((__uint16_t)(x) & 0xff00U) >> 8)
                                                                ^
../src/common.c:91:31: note: forward declaration of 'struct sockaddr_in'
        return ntohs(((struct sockaddr_in *)sa)->sin_port);
                              ^
../src/common.c:91:48: error: incomplete definition of type 'struct sockaddr_in'
        return ntohs(((struct sockaddr_in *)sa)->sin_port);
                     ~~~~~~~~~~~~~~~~~~~~~~~~~~^
/usr/include/sys/endian.h:97:28: note: expanded from macro 'ntohs'
#define ntohs(x)        __htobe16(x)
                                  ^
/usr/include/sys/_endian.h:87:69: note: expanded from macro '__swap16'
        (__uint16_t)(__builtin_constant_p(x) ? __swap16gen(x) : __swap16md(x))
                                                                           ^
../src/common.c:91:31: note: forward declaration of 'struct sockaddr_in'
        return ntohs(((struct sockaddr_in *)sa)->sin_port);
                              ^
../src/common.c:93:49: error: incomplete definition of type 'struct sockaddr_in6'
        return ntohs(((struct sockaddr_in6 *)sa)->sin6_port);
                     ~~~~~~~~~~~~~~~~~~~~~~~~~~~^
/usr/include/sys/endian.h:97:28: note: expanded from macro 'ntohs'
#define ntohs(x)        __htobe16(x)
                                  ^
/usr/include/sys/_endian.h:87:36: note: expanded from macro '__swap16'
        (__uint16_t)(__builtin_constant_p(x) ? __swap16gen(x) : __swap16md(x))
                                          ^
../src/common.c:93:31: note: forward declaration of 'struct sockaddr_in6'
        return ntohs(((struct sockaddr_in6 *)sa)->sin6_port);
                              ^
../src/common.c:93:49: error: incomplete definition of type 'struct sockaddr_in6'
        return ntohs(((struct sockaddr_in6 *)sa)->sin6_port);
                     ~~~~~~~~~~~~~~~~~~~~~~~~~~~^
/usr/include/sys/endian.h:97:28: note: expanded from macro 'ntohs'
#define ntohs(x)        __htobe16(x)
                                  ^
/usr/include/sys/_endian.h:87:53: note: expanded from macro '__swap16'
        (__uint16_t)(__builtin_constant_p(x) ? __swap16gen(x) : __swap16md(x))
                                                           ^
/usr/include/sys/_endian.h:49:32: note: expanded from macro '__swap16gen'
    (__uint16_t)(((__uint16_t)(x) & 0xffU) << 8 | ((__uint16_t)(x) & 0xff00U) >> 8)
                               ^
../src/common.c:93:31: note: forward declaration of 'struct sockaddr_in6'
        return ntohs(((struct sockaddr_in6 *)sa)->sin6_port);
                              ^
../src/common.c:93:49: error: incomplete definition of type 'struct sockaddr_in6'
        return ntohs(((struct sockaddr_in6 *)sa)->sin6_port);
                     ~~~~~~~~~~~~~~~~~~~~~~~~~~~^
/usr/include/sys/endian.h:97:28: note: expanded from macro 'ntohs'
#define ntohs(x)        __htobe16(x)
                                  ^
/usr/include/sys/_endian.h:87:53: note: expanded from macro '__swap16'
        (__uint16_t)(__builtin_constant_p(x) ? __swap16gen(x) : __swap16md(x))
                                                           ^
/usr/include/sys/_endian.h:49:65: note: expanded from macro '__swap16gen'
    (__uint16_t)(((__uint16_t)(x) & 0xffU) << 8 | ((__uint16_t)(x) & 0xff00U) >> 8)
                                                                ^
../src/common.c:93:31: note: forward declaration of 'struct sockaddr_in6'
        return ntohs(((struct sockaddr_in6 *)sa)->sin6_port);
                              ^
../src/common.c:93:49: error: incomplete definition of type 'struct sockaddr_in6'
        return ntohs(((struct sockaddr_in6 *)sa)->sin6_port);
                     ~~~~~~~~~~~~~~~~~~~~~~~~~~~^
/usr/include/sys/endian.h:97:28: note: expanded from macro 'ntohs'
#define ntohs(x)        __htobe16(x)
                                  ^
/usr/include/sys/_endian.h:87:69: note: expanded from macro '__swap16'
        (__uint16_t)(__builtin_constant_p(x) ? __swap16gen(x) : __swap16md(x))
                                                                           ^
../src/common.c:93:31: note: forward declaration of 'struct sockaddr_in6'
        return ntohs(((struct sockaddr_in6 *)sa)->sin6_port);
                              ^
../src/common.c:100:42: warning: declaration of 'struct sockaddr' will not be visible outside of this function [-Wvisibility]
gt_toaddr(char *str, size_t size, struct sockaddr *sa)
                                         ^
../src/common.c:100:1: error: conflicting types for 'gt_toaddr'
gt_toaddr(char *str, size_t size, struct sockaddr *sa)
^
../src/common.h:67:10: note: previous declaration is here
int      gt_toaddr   (char *, size_t, struct sockaddr *);
         ^
../src/common.c:105:15: error: incomplete definition of type 'struct sockaddr'
    switch (sa->sa_family) {
            ~~^
../src/common.c:100:42: note: forward declaration of 'struct sockaddr'
gt_toaddr(char *str, size_t size, struct sockaddr *sa)
                                         ^
../src/common.c:108:44: error: incomplete definition of type 'struct sockaddr_in'
                &((struct sockaddr_in *)sa)->sin_addr, str, (socklen_t)size);
                 ~~~~~~~~~~~~~~~~~~~~~~~~~~^
../src/common.c:108:27: note: forward declaration of 'struct sockaddr_in'
                &((struct sockaddr_in *)sa)->sin_addr, str, (socklen_t)size);
                          ^
../src/common.c:107:28: error: use of undeclared identifier 'AF_INET'
        return -!inet_ntop(AF_INET,
                           ^
../src/common.c:111:45: error: incomplete definition of type 'struct sockaddr_in6'
                &((struct sockaddr_in6 *)sa)->sin6_addr, str, (socklen_t)size);
                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~^
../src/common.c:111:27: note: forward declaration of 'struct sockaddr_in6'
                &((struct sockaddr_in6 *)sa)->sin6_addr, str, (socklen_t)size);
                          ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
6 warnings and 20 errors generated.
[2/15] Compiling C object 'glorytun@exe/src_tun.c.o'.
FAILED: glorytun@exe/src_tun.c.o
cc -Iglorytun@exe -I. -I.. -I/usr/local/include -Xclang -fcolor-diagnostics -pipe -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -std=gnu99 -O2 -g '-DPACKAGE_VERSION="0.3.1"' '-DPACKAGE_NAME="glorytun"' -MD -MQ 'glorytun@exe/src_tun.c.o' -MF 'glorytun@exe/src_tun.c.o.d' -o 'glorytun@exe/src_tun.c.o' -c ../src/tun.c
In file included from ../src/tun.c:1:
../src/common.h:65:30: warning: declaration of 'struct sockaddr' will not be visible outside of this function [-Wvisibility]
void     gt_set_port (struct sockaddr *, uint16_t);
                             ^
../src/common.h:66:30: warning: declaration of 'struct sockaddr' will not be visible outside of this function [-Wvisibility]
uint16_t gt_get_port (struct sockaddr *);
                             ^
../src/common.h:67:46: warning: declaration of 'struct sockaddr' will not be visible outside of this function [-Wvisibility]
int      gt_toaddr   (char *, size_t, struct sockaddr *);
                                             ^
../src/tun.c:141:17: error: use of undeclared identifier 'tmp'
    return open(tmp, O_RDWR);
                ^
3 warnings and 1 error generated.
[3/15] Compiling C object 'glorytun@exe/src_main.c.o'.
In file included from ../src/main.c:1:
../src/common.h:65:30: warning: declaration of 'struct sockaddr' will not be visible outside of this function [-Wvisibility]
void     gt_set_port (struct sockaddr *, uint16_t);
                             ^
../src/common.h:66:30: warning: declaration of 'struct sockaddr' will not be visible outside of this function [-Wvisibility]
uint16_t gt_get_port (struct sockaddr *);
                             ^
../src/common.h:67:46: warning: declaration of 'struct sockaddr' will not be visible outside of this function [-Wvisibility]
int      gt_toaddr   (char *, size_t, struct sockaddr *);
                                             ^
3 warnings generated.
ninja: build stopped: subcommand failed.

Hopefully this is helpful.

angt commented 4 years ago

Oh, I didn't test OpenBSD recently.. I'll fix that soon!

angt commented 4 years ago

The master branch should work now with

gmake CPPFLAGS="-I/usr/local/include" LDFLAGS="-L/usr/local/lib"
angt commented 4 years ago

Thanks for reporting this issue :)

vifino commented 4 years ago

Thank you so much! Compiled without a hitch. Considering this, I'm sure it'll work perfectly.

vifino commented 4 years ago

Umm... I was mistaken. Let me open a new issue.

angt commented 4 years ago

That was to good to be true.. Do not hesitate :)