Skip to content

[BUG] FreeBSD build fails using arpa/inet.h #191

@fzipi

Description

@fzipi

Prerequisites

Description

FreeBSD fails to compile using only arpa/inet.h for networking. There are some needed declarations in netinet/in.h.

Steps to Reproduce

  1. Boot FreeBSD at least 11.3
  2. Install gcc9, libtool, etc.
  3. configure and build
Making all in src
/bin/sh ../libtool  --tag=CXX   --mode=compile /usr/local/bin/g++9 -DHAVE_CONFIG_H -I. -I../../src -I..  -I../ -I../../src/httpserver/ -I/usr/ports/databases/proxysql/work/.build/deps/src/libmicrohttpd_ext/src/include -DENABLE_POLL -O3 -fPIC -Wall  -std=c++11 -DHTTPSERVER_COMPILATION -D_REENTRANT  -O2 -MT libhttpserver_la-webserver.lo -MD -MP -MF .deps/libhttpserver_la-webserver.Tpo -c -o libhttpserver_la-webserver.lo `test -f 'webserver.cpp' || echo '../../src/'`webserver.cpp
libtool: compile:  /usr/local/bin/g++9 -DHAVE_CONFIG_H -I. -I../../src -I.. -I../ -I../../src/httpserver/ -I/usr/ports/databases/proxysql/work/.build/deps/src/libmicrohttpd_ext/src/include -DENABLE_POLL -O3 -fPIC -Wall -std=c++11 -DHTTPSERVER_COMPILATION -D_REENTRANT -O2 -MT libhttpserver_la-webserver.lo -MD -MP -MF .deps/libhttpserver_la-webserver.Tpo -c ../../src/webserver.cpp -o libhttpserver_la-webserver.o
In file included from ../../src/webserver.cpp:38:
/usr/include/netinet/ip.h:69:17: error: field 'ip_src' has incomplete type 'in_addr'
   69 |  struct in_addr ip_src,ip_dst; /* source and dest address */
      |                 ^~~~~~
/usr/include/netinet/ip.h:69:9: note: forward declaration of 'struct in_addr'
   69 |  struct in_addr ip_src,ip_dst; /* source and dest address */
      |         ^~~~~~~
/usr/include/netinet/ip.h:69:24: error: field 'ip_dst' has incomplete type 'in_addr'
   69 |  struct in_addr ip_src,ip_dst; /* source and dest address */
      |                        ^~~~~~
/usr/include/netinet/ip.h:69:9: note: forward declaration of 'struct in_addr'
   69 |  struct in_addr ip_src,ip_dst; /* source and dest address */
      |         ^~~~~~~
/usr/include/netinet/ip.h:186:19: error: field 'ipt_addr' has incomplete type 'in_addr'
  186 |    struct in_addr ipt_addr;
      |                   ^~~~~~~~
/usr/include/netinet/ip.h:69:9: note: forward declaration of 'struct in_addr'
   69 |  struct in_addr ip_src,ip_dst; /* source and dest address */
      |         ^~~~~~~
/usr/include/netinet/ip.h:221:17: error: field 'ippseudo_src' has incomplete type 'in_addr'
  221 |  struct in_addr ippseudo_src; /* source internet address */
      |                 ^~~~~~~~~~~~
/usr/include/netinet/ip.h:69:9: note: forward declaration of 'struct in_addr'
   69 |  struct in_addr ip_src,ip_dst; /* source and dest address */
      |         ^~~~~~~
/usr/include/netinet/ip.h:222:17: error: field 'ippseudo_dst' has incomplete type 'in_addr'
  222 |  struct in_addr ippseudo_dst; /* destination internet address */
      |                 ^~~~~~~~~~~~
/usr/include/netinet/ip.h:69:9: note: forward declaration of 'struct in_addr'
   69 |  struct in_addr ip_src,ip_dst; /* source and dest address */
      |         ^~~~~~~
../../src/webserver.cpp: In static member function 'static int httpserver::webserver::answer_to_connection(void*, MHD_Connection*, const char*, const char*, const char*, const char*, size_t*, void**)':
../../src/webserver.cpp:772:42: error: 'IPPROTO_TCP' was not declared in this scope
  772 |         setsockopt(conninfo->connect_fd, IPPROTO_TCP, TCP_NODELAY, (char *) &yes, sizeof(int));
      |                                          ^~~~~~~~~~~
*** Error code 1

Stop.

Expected behavior: [What you expect to happen]

Correct build.

Actual behavior: [What actually happens]

Reproduces how often: [What percentage of the time does it reproduce?]

Always.

Versions

  • freebsd-version: 11.3-RELEASE
  • libhttpserver version - libhttpserver-master_20191121.zip
  • libmicrohttpd version - libmicrohttpd-0.9.68.tar.gz

If you have problems during build:

  • gcc9
  • autoconf 2.69, automake 1.16

Additional Information

Seems like arpa/inet.h is not enough in this case.

Will post patch with inclusion which solves this one.

Metadata

Metadata

Assignees

Labels

bugConfirmed bugs or reports that are very likely to be bugs.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions