openca / libpki

Easy-to-use high-level library for PKI-enabled applications
Other
50 stars 34 forks source link

sys/socket.h is not included on FreeBSD #31

Closed akhmatov-s closed 1 year ago

akhmatov-s commented 6 years ago

Hello. I'm trying to run libpki and ocspd on FreeBSD (and adding the software to portstree) Build fails with errors:

../../libpki/net/sock.h:41:25: error: use of undeclared identifier 'SOCK_STREAM'
        PKI_NET_SOCK_STREAM             = SOCK_STREAM,

The cause is <sys/socket.h> is not included from src/libpki/net/sock.h I can't understand the logic behind this code:

#ifdef HAVE_SYS_SOCKET_H
# include <sys/select.h>
#else
# include <sys/types.h>
# include <sys/socket.h>
#endif

Why aren't we including <sys/socket.h> when HAVE_SYS_SOCKET_H is defined?

It works on Linux because <sys/socket.h> is included in <netinet/in.h>. On FreeBSD it should be included explicitly. The build works for me when I move # include <sys/socket.h> above "else", but I'm not sure if it's the right way to make it work on all platforms. Could someone give some insight on the problem?

opencrypto commented 1 year ago

Already included in current master branch.