Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[OpenBSD] Compilation error due to forward declarations #241

Closed
epsilon-0 opened this issue Mar 29, 2019 · 2 comments
Closed

[OpenBSD] Compilation error due to forward declarations #241

epsilon-0 opened this issue Mar 29, 2019 · 2 comments

Comments

@epsilon-0
Copy link

I am trying to compile the latest release on openbsd but there seem to be some problem in the inadyn-cache generation

Making all in src
  CC       inadyn-cache.o
  CC       inadyn-http.o
  CC       inadyn-plugin.o
In file included from cache.c:34:
/usr/include/resolv.h:137:14: error: array has incomplete element type 'struct sockaddr_in'
                nsaddr_list[MAXNS];     /* address of name server */
                           ^
/usr/include/resolv.h:136:9: note: forward declaration of 'struct sockaddr_in'
        struct sockaddr_in
               ^
/usr/include/resolv.h:147:18: error: field has incomplete type 'struct in_addr'
                struct in_addr  addr;
                                ^
/usr/include/resolv.h:147:10: note: forward declaration of 'struct in_addr'
                struct in_addr  addr;
                       ^
/usr/include/resolv.h:164:19: error: field has incomplete type 'struct in_addr'
                        struct in_addr ina;
                                       ^
/usr/include/resolv.h:147:10: note: forward declaration of 'struct in_addr'
                struct in_addr  addr;
                       ^
/usr/include/resolv.h:165:20: error: field has incomplete type 'struct in6_addr'
                        struct in6_addr in6a;
                                        ^
/usr/include/resolv.h:165:11: note: forward declaration of 'struct in6_addr'
                        struct in6_addr in6a;
                               ^
cache.c:157:41: warning: 'strncmp' call operates on objects of type 'const char' while the size is based on a different type 'const char *' [-Wsizeof-pointer-memaccess]
                        if (!strncmp(name, except[i], sizeof(name))) {
                                     ~~~~                    ^~~~
cache.c:157:41: note: did you mean to provide an explicit length?
                        if (!strncmp(name, except[i], sizeof(name))) {
                                                             ^~~~
1 warning and 4 errors generated.
*** Error 1 in target 'inadyn-cache.o'
*** Error 1 in src (Makefile:623 'inadyn-cache.o': @echo "  CC      " inadyn-cache.o;cc -DHAVE_CONFIG_H -I. -I../include  -I../include -DSYS...)
*** Error 1 in /root/git/inadyn-2.5 (Makefile:495 'all-recursive')

I am not sure how to proceed in this current scenario, any help would be appreciated.

Thanks a lot!

@troglobit
Copy link
Owner

Good report, thanks! I'll look into testing on (an up-to-date) OpenBSD system.

Your actual problem might be resolved (no pun intended) if you include "netinet/in.h" as the first #include statement in cache.c, before including resolv.h.

@troglobit
Copy link
Owner

Just pushed a fix for this, tested on OpenBSD 6.1, hope it works for you too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants