BIND build problems on NetBSD 9
There are three BIND 9.16.3 compilation issues on NetBSD 9 with Clang 9.0.1:
--- parser.o ---
clang -include /home/newman/bind-9.16.3/config.h -I/home/newman/bind-9.16.3 -I../.. -I. -I/home/newman/bind-9.16.3/lib/dns/include -I../../lib/dns/include -I/home/newman/bind-9.16.3/lib/isc/include -I../../lib/isc -I../../lib/isc/include -I../../lib/isc/unix/include -I../../lib/isc/pthreads/include -I/home/newman/bind-9.16.3/lib/isccfg/include -I../../lib/isccfg/include -DISC_MEM_DEFAULTFILL=1 -DISC_LIST_CHECKINIT=1 -fno-omit-frame-pointer -fno-optimize-sibling-calls -O1 -g -Wall -Wextra -pthread -I/usr/pkg/include -fPIC -W -Wall -Wmissing-prototypes -Wcast-qual -Wwrite-strings -Wformat -Wpointer-arith -Wno-missing-field-initializers -fno-strict-aliasing -Wshadow -Werror -c parser.c
--- parser.o ---
parser.c:1286:6: error: array subscript is of type 'char' [-Werror,-Wchar-subscripts]
if (toupper(TOKEN_STRING(pctx)[0]) == 'P') {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/sys/ctype_inline.h:60:46: note: expanded from macro 'toupper'
#define toupper(c) ((int)((_toupper_tab_ + 1)[(c)]))
^~~~
clang -include /home/newman/bind-9.16.3/config.h -I/home/newman/bind-9.16.3 -I../.. -I./include -I./unix/include -I. -I/home/newman/bind-9.16.3/lib/ns/include -I../../lib/ns/include -I/home/newman/bind-9.16.3/lib/dns/include -I../../lib/dns/include -I/home/newman/bind-9.16.3/lib/bind9/include -I../../lib/bind9/include -I/home/newman/bind-9.16.3/lib/isccfg/include -I../../lib/isccfg/include -I/home/newman/bind-9.16.3/lib/isccc/include -I../../lib/isccc/include -I/home/newman/bind-9.16.3/lib/isc/include -I../../lib/isc -I../../lib/isc/include -I../../lib/isc/unix/include -I../../lib/isc/pthreads/include -I../../contrib/dlz/drivers/include -I/usr/pkg/include/json-c -I/usr/pkg/include/libxml2 -DCONTRIB_DLZ -DDLZ_FILESYSTEM -DISC_MEM_DEFAULTFILL=1 -DISC_LIST_CHECKINIT=1 -fno-omit-frame-pointer -fno-optimize-sibling-calls -O1 -g -Wall -Wextra -pthread -I/usr/pkg/include -fPIC -W -Wall -Wmissing-prototypes -Wcast-qual -Wwrite-strings -Wformat -Wpointer-arith -Wno-missing-field-initializers -fno-strict-aliasing -Wshadow -Werror -DVERSION=\"9.16.3\" -DPRODUCT=\""BIND"\" -DDESCRIPTION=\""(Stable Release)"\" -DSRCID=\"5ea41c1\" -DCONFIGARGS="\"'--disable-maintainer-mode' '--enable-developer' '--disable-static' '--with-cmocka' '--with-libxml2' '--with-json-c' '--without-make-clean' '--with-python=python3.7' '--disable-backtrace' '--disable-symtable' 'CC=clang' 'CFLAGS=-fno-omit-frame-pointer -fno-optimize-sibling-calls -O1 -g -Wall -Wextra'\"" -DBUILDER="\"make\"" -DNAMED_LOCALSTATEDIR=\"/usr/local/var\" -DNAMED_SYSCONFDIR=\"/usr/local/etc\" -c ./main.c
./main.c:358:8: error: array subscript is of type 'char' [-Werror,-Wchar-subscripts]
if (isalnum(*src) || *src == ',' || *src == '-' ||
^~~~~~~~~~~~~
/usr/include/sys/ctype_inline.h:48:44: note: expanded from macro 'isalnum'
#define isalnum(c) ((int)((_ctype_tab_ + 1)[(c)] & (_CTYPE_A|_CTYPE_D)))
^~~~
./main.c:362:15: error: array subscript is of type 'char' [-Werror,-Wchar-subscripts]
} else if (isprint(*src)) {
^~~~~~~~~~~~~
/usr/include/sys/ctype_inline.h:54:44: note: expanded from macro 'isprint'
#define isprint(c) ((int)((_ctype_tab_ + 1)[(c)] & _CTYPE_R))
^~~~
I fixed this by adding (unsigned char)
before the parameter of failing macros:
toupper((unsigned char)TOKEN_STRING(pctx)[0]
isalnum((unsigned char)*src)
isprint((unsigned char)*src))
There's also a gen.c
linking problem:
clang -fno-omit-frame-pointer -fno-optimize-sibling-calls -O1 -g -Wall -Wextra -pthread -I/usr/pkg/include -fPIC -I../../lib/isc/include -Wl,-E -o gen ./gen.c -L/usr/pkg/lib -luv -lkvm -lrt -lpthread
make include/dns/enumtype.h
./gen -s . -t > include/dns/enumtype.h || { rm -f include/dns/enumtype.h ; exit 1; }
./gen: Shared object "libuv.so.1" not found
*** [include/dns/enumtype.h] Error code 1
I workedaround it with LD_LIBRARY_PATH=/usr/pkg/lib make
, haven't look for a proper fix.