dhcp-3.0.1rc13 does not build on NetBSD

Andreas Gustafsson gson at nominum.com
Fri Feb 20 17:35:27 UTC 2004


dhcp-3.0.1rc13 does not build on NetBSD-current (i386). There are two
issues:

1. Makefile.conf specifies the compiler flag -Wconversion, causing
warnings to be printed about code in NetBSD system headers.  This
causes compilation to fail since -Werror is also specified:

   cc -g  -I/home/gson/dhcp-3.0.1rc13  -I/home/gson/dhcp-3.0.1rc13/includes -Wall -Wstrict-prototypes -Wno-unused -Wno-comment  -Wno-uninitialized -Werror  -Wimplicit-function-declaration -Wpointer-arith -Wcast-qual  -Wcast-align -Wwrite-strings -Wconversion -Wmissing-prototypes  -Wmissing-declarations -Wnested-externs  -pipe    -c bpf.c
   bpf.c: In function `if_register_receive':
   bpf.c:323: warning: passing arg 1 of `__byte_swap_word_variable' with different width due to prototype
   *** Error code 1

The -Wconversion option is bogus; it prints warnings about code that
is perfectly valid ANSI C.  Also note that ISC DHCP does not specify
it for any OS other than NetBSD, and even goes to the trouble of
splitting the support for NetBSD into a "netbsd" and "netbsd-nocast"
platform as an incomplete workaround for the problems it causes.
A far better solution is to simply not use it at all.

2. omapip/test.c calls strcmp() without including <string.h>.

Patches are enclosed.
-- 
Andreas Gustafsson, gson at nominum.com

Index: Makefile.conf
===================================================================
diff -u -r1.2 Makefile.conf
--- Makefile.conf	2003/11/17 23:51:44	1.2
+++ Makefile.conf	2004/02/20 17:05:12
@@ -224,28 +224,11 @@
 #COPTS  = -Wall -Wstrict-prototypes -Wno-unused -Wno-comment \
 #	  -Wno-uninitialized -Werror \
 #	  -Wimplicit-function-declaration -Wpointer-arith -Wcast-qual \
-#	  -Wcast-align -Wwrite-strings -Wconversion -Wmissing-prototypes \
-#	  -Wmissing-declarations -Wnested-externs \
-#	  -pipe $(BINDDEF) $(CC_OPTIONS)
-#SCRIPT=netbsd
-##MKDEP=makedepend
-##--netbsd--
-
-## NetBSD nocast
-## Some versions of the arm32 gcc have a problem in cast conversions.
-## The Alpha definitely has a problem - if you pass '6' where a size_t
-## is expected, you get a warning.   So on these architectures, we do
-## not ask for that sort of warning.
-##--netbsd-nocast--
-#CF = cf/netbsd.h
-#COPTS  = -Wall -Wstrict-prototypes -Wno-unused -Wno-comment \
-#	  -Wno-uninitialized -Werror \
-#	  -Wimplicit-function-declaration -Wpointer-arith -Wcast-qual \
 #	  -Wwrite-strings -Wmissing-prototypes \
 #	  -Wmissing-declarations -Wnested-externs \
 #	  -pipe $(BINDDEF) $(CC_OPTIONS)
 #SCRIPT=netbsd
-##--netbsd-nocast--
+##--netbsd--
 
 ## Ultrix
 ##--ultrix--
Index: configure
===================================================================
diff -u -r1.3 configure
--- configure	2002/05/31 06:48:38	1.3
+++ configure	2004/02/20 17:05:12
@@ -114,14 +114,7 @@
 	  fi;;
       esac;;
     NetBSD)
-      hw=`uname -m`
-      case $hw in
-	arm32) sysname=netbsd-nocast;;
-	alpha) sysname=netbsd-nocast;;
-	sparc) sysname=netbsd-nocast;;
-	sparc64) sysname=netbsd-nocast;;
-	*) sysname=netbsd;;
-      esac;;
+      sysname=netbsd;;
     OpenBSD)
       sysname=openbsd;;
     FreeBSD)
Index: omapip/test.c
===================================================================
diff -u -r1.1.1.1 test.c
--- omapip/test.c	2002/02/14 21:57:09	1.1.1.1
+++ omapip/test.c	2004/02/20 17:05:13
@@ -45,6 +45,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <stdarg.h>
+#include <string.h>
 #include <isc-dhcp/result.h>
 #include <sys/time.h>
 #include <omapip/omapip.h>


More information about the dhcp-hackers mailing list