Opened 14 years ago

Closed 14 years ago

#17 closed Bug / Defect (fixed)

build failure on OpenBSD 4.7 IFF_MULTICAST

Reported by: krzee king Owned by: fkr
Priority: major Milestone: beta 2.2
Component: Building / Compiling Version: OpenVPN 2.1.0 / 2.1.1 (Community Ed)
Severity: Not set (select this one, unless your'e a OpenVPN developer) Keywords: openbsd
Cc: fkr

Description

gcc -DHAVE_CONFIG_H -I. -I. -g -O2 -MT tun.o -MD -MP -MF .deps/tun.Tpo -c -o tun.o tun.c
tun.c: In function `open_tun':
tun.c:1608: error: `IFF_MULTICAST' undeclared (first use in this function)
tun.c:1608: error: (Each undeclared identifier is reported only once
tun.c:1608: error: for each function it appears in.)
* Error code 1

Stop in /root/openvpn-2.1.1 (line 92 of /usr/share/mk/sys.mk).
* Error code 1

Stop in /root/openvpn-2.1.1 (line 630 of Makefile).
* Error code 1

Stop in /root/openvpn-2.1.1 (line 376 of Makefile).

Attachments (2)

configure-ac.patch (482 bytes) - added by Gert Döring 14 years ago.
patch for configure.ac to fix <net/if.h> issue on NetBSD
patch2.txt (1.9 KB) - added by Gert Döring 14 years ago.
second patch to configure.ac - contains the first patch as well, apply to pristine sources

Download all attachments as: .zip

Change History (10)

comment:1 Changed 14 years ago by Samuli Seppänen

Owner: set to fkr
Status: newassigned

comment:2 Changed 14 years ago by David Sommerseth

Severity: FRP - Phase 1unset

comment:3 Changed 14 years ago by Gert Döring

Hi,

this is also seen on (some versions of) NetBSD. The problem is that configure decides "there is no <net/if.h>" (#undef HAVE_NET_IF_H in config.h) and thus <net/if.h> is not included - and this is the header file that defines IFF_MULTICAST, both on NetBSD and OpenBSD.

config.log for NetBSD 3.1 regarding <net/if.h> looks like this:

configure:6919: checking for net/if.h
configure:6943: gcc -c -g -O2 -I../openvpn-git conftest.c >&5
In file included from /usr/include/net/if.h:86,

from conftest.c:80:

/usr/include/net/pfil.h:79: error: parse error before "u_long"
/usr/include/net/pfil.h:81: error: parse error before '}' token
/usr/include/net/pfil.h:85: error: parse error before '}' token
/usr/include/net/pfil.h:99: error: parse error before "u_long"
/usr/include/net/pfil.h: In function `pfil_hook_get':
/usr/include/net/pfil.h:106: error: dereferencing pointer to incomplete type
/usr/include/net/pfil.h:108: error: dereferencing pointer to incomplete type
/usr/include/net/pfil.h:110: error: dereferencing pointer to incomplete type
/usr/include/net/pfil.h:112: error: dereferencing pointer to incomplete type
In file included from conftest.c:80:
/usr/include/net/if.h: At top level:
/usr/include/net/if.h:278: error: field `if_pfil' has incomplete type
configure:6950: $? = 1
configure: failed program was:
| /* confdefs.h. */
| #define PACKAGE_NAME "OpenVPN"
| #define PACKAGE_VERSION "2.1.1b"
| #define PACKAGE_STRING "OpenVPN 2.1.1b"
| #define PACKAGE_BUGREPORT "openvpn-users@…"
| #define PACKAGE "openvpn"
| #define VERSION "2.1.1b"
| #define IFCONFIG_PATH "/sbin/ifconfig"
| #define IPROUTE_PATH "ip"
| #define ROUTE_PATH "/sbin/route"
| #define TARGET_ALIAS "sparc64-unknown-netbsd3.1."
| #define TARGET_NETBSD 1
| #define STDC_HEADERS 1
| #define HAVE_SYS_TYPES_H 1
| #define HAVE_SYS_STAT_H 1
| #define HAVE_STDLIB_H 1
| #define HAVE_STRING_H 1
| #define HAVE_MEMORY_H 1
| #define HAVE_STRINGS_H 1
| #define HAVE_INTTYPES_H 1
| #define HAVE_STDINT_H 1
| #define HAVE_UNISTD_H 1
| #define EXTENSIONS 1
| #define _ALL_SOURCE 1
| #define _GNU_SOURCE 1
| #define _POSIX_PTHREAD_SEMANTICS 1
| #define _TANDEM_SOURCE 1
| #define STDC_HEADERS 1
| #define TIME_WITH_SYS_TIME 1
| #define HAVE_CPP_VARARG_MACRO_ISO 1
| #define HAVE_CPP_VARARG_MACRO_GCC 1
| #define EMPTY_ARRAY_SIZE 0
| #define HAVE_FCNTL_H 1
| #define HAVE_STDLIB_H 1
| #define HAVE_STDARG_H 1
| #define HAVE_STDIO_H 1
| #define HAVE_STRING_H 1
| #define HAVE_STRINGS_H 1
| #define HAVE_CTYPE_H 1
| #define HAVE_ERRNO_H 1
| #define HAVE_SYS_WAIT_H 1
| #define HAVE_SYS_TIME_H 1
| #define HAVE_SYS_SOCKET_H 1
| #define HAVE_SYS_UN_H 1
| #define HAVE_SYS_IOCTL_H 1
| #define HAVE_SYS_STAT_H 1
| #define HAVE_SYS_MMAN_H 1
| #define HAVE_SYS_MMAN_H 1
| #define HAVE_FCNTL_H 1
| #define HAVE_SYS_FILE_H 1
| #define HAVE_STDLIB_H 1
| #define HAVE_STDINT_H 1
| #define HAVE_STDARG_H 1
| #define HAVE_UNISTD_H 1
| #define HAVE_SIGNAL_H 1
| #define HAVE_STDIO_H 1
| #define HAVE_STRING_H 1
| #define HAVE_STRINGS_H 1
| #define HAVE_CTYPE_H 1
| #define HAVE_ERRNO_H 1
| #define HAVE_SYSLOG_H 1
| #define HAVE_PWD_H 1
| #define HAVE_GRP_H 1
| #define HAVE_NET_IF_TUN_H 1
| #define HAVE_SYS_SOCKIO_H 1
| #define HAVE_NETINET_IN_H 1
| #define HAVE_NETINET_IN_SYSTM_H 1
| #define HAVE_NETINET_TCP_H 1
| #define HAVE_ARPA_INET_H 1
| #define HAVE_NETDB_H 1
| #define HAVE_SYS_UIO_H 1
| #define HAVE_SYS_POLL_H 1
| #define HAVE_ERR_H 1
| /* end confdefs.h. */
| #ifdef HAVE_SYS_SOCKET_H
| # include <sys/socket.h>
| #endif
|
|
| #include <net/if.h>
configure:6967: result: no
configure:6984: checking for netinet/ip.h
configure:7014: gcc -c -g -O2 -I../openvpn-git conftest.c >&5
...

u_long is defined in <sys/types.h>, so a test file consisting only of

#include <sys/types.h>
#include <net/if.h>

compiles fine.

I have no idea what's needed to make configure put "sys/types.h" there in the <net/if.h> check, but I can test patches on NetBSD 3 and 5.

Changed 14 years ago by Gert Döring

Attachment: configure-ac.patch added

patch for configure.ac to fix <net/if.h> issue on NetBSD

comment:4 Changed 14 years ago by Gert Döring

attached patch fixes issue for NetBSD.

Please test whether it also fixes OpenBSD (patch, run autoreconf, re-run configure).

comment:5 Changed 14 years ago by David Sommerseth

Milestone: beta 2.2

comment:6 Changed 14 years ago by Gert Döring

a patch that fixes this (swap inclusion order of <sys/socket.h> and <sys/types.h>, on top of my previous patch) has been sent to the openvpn-devel list.

With the second patch, configure/make works for me on NetBSD 3.1/Sparc64 and OpenBSD 4.7/i386.

Changed 14 years ago by Gert Döring

Attachment: patch2.txt added

second patch to configure.ac - contains the first patch as well, apply to pristine sources

comment:7 Changed 14 years ago by krzee king

patch2 ack'ed on OpenBSD 4.7 i386

comment:8 Changed 14 years ago by David Sommerseth

Resolution: fixed
Status: assignedclosed

Applied to the bugfix2.1 branch

commit 422e5e751e73de8a17760acf2f15f61ea4f0394e
Author: Gert Doering <gert@…>
Date: Sat Jul 10 11:24:41 2010 +0200

Fix <net/if.h> compile time problems on OpenBSD for good


Previous fix (commit eb973e055bc249948) fixed NetBSD but not OpenBSD
(include <sys/socket.h> *after* <sys/types.h>)


Signed-off-by: Gert Doering <gert@…>
Acked-by: krzee <jeff@…>
Signed-off-by: David Sommerseth <dazo@…>

commit eb973e055bc249948351cacf1aa045d878ed041d
Author: Gert Doering <gert@…>
Date: Fri Jul 9 10:24:46 2010 +0200

Fix compile problems on NetBSD and OpenBSD


Configure will not find <net/if.h> due to missing <sys/types.h> in the test program,
and thus, tun.c will fail to compile with missing symbol IFF_MULTICAST.


Signed-off-by: Gert Doering <gert@…>
Acked-by: krzee <jeff@…>
Signed-off-by: David Sommerseth <dazo@…>

Note: See TracTickets for help on using tickets.