Bug 838

Summary: 1.5.10 can't be build on Solaris
Product: unbound Reporter: Yuri <yvoinov>
Component: serverAssignee: unbound team <unbound-team>
Severity: blocker CC: cathya, wouter, yvoinov
Priority: P5    
Version: unspecified   
Hardware: x86_64   
OS: other   
Attachments: Patch require to rollback to successfully build

Description Yuri 2016-09-28 22:52:28 CEST
Created attachment 359 [details]
Patch require to rollback to successfully build

./configure --prefix=/usr/local
--with-username=unbound --with-ssl=/usr/local --with-libevent=/usr/local
--with-libexpat=/opt/csw --without-pthreads --with-solaris-threads
--enable-tfo-client --with-pidfile=/tmp/unbound.pid 'CFLAGS=-O3 -m64
-lmtmalloc' 'CPPFLAGS=-I/usr/local/include/openssl -I/opt/csw/include'
'LDFLAGS=-m64 -L/usr/local/lib -L/opt/csw/lib/64'

and GCC 4.9.2 I have output:

./libtool --tag=CC --mode=compile gcc -I. -I/usr/local/include/openssl
-I/opt/csw/include -I/usr/local/include -I/usr/local/include
-I/opt/csw/include -O3 -m64 -lmtmalloc -std=c99 -D_REENTRANT  -o
unbound-checkconf.lo -c `cat .source`
libtool: compile:  gcc -I. -I/usr/local/include/openssl
-I/opt/csw/include -I/usr/local/include -I/usr/local/include
-I/opt/csw/include -O3 -m64 -lmtmalloc -std=c99 -D_REENTRANT -c
smallapp/unbound-checkconf.c  -fPIC -DPIC -o .libs/unbound-checkconf.o
smallapp/unbound-checkconf.c: In function 'checkconf':
smallapp/unbound-checkconf.c:489:13: error: 'PATH_MAX' undeclared (first
use in this function)
  char oldwd[PATH_MAX];
smallapp/unbound-checkconf.c:489:13: note: each undeclared identifier is
reported only once for each function it appears in
gmake: *** [Makefile:268: unbound-checkconf.lo] Error 1

When I've rolled back attached patch, builds successfully.
Comment 1 Wouter Wijngaards 2016-09-29 09:01:15 CEST
Hi Yuri,

PATH_MAX comes from limits.h, I can build a workaround that'll work better.
This patch fixes it (without rolling back the one you post):

Index: smallapp/unbound-checkconf.c
--- smallapp/unbound-checkconf.c	(revision 3867)
+++ smallapp/unbound-checkconf.c	(working copy)
@@ -486,7 +486,7 @@
 static void
 checkconf(const char* cfgfile, const char* opt, int final)
-	char oldwd[PATH_MAX];
+	char oldwd[4096];
 	struct config_file* cfg = config_create();
 		fatal_exit("out of memory");

Best regards, Wouter
Comment 2 Yuri 2016-09-30 12:55:54 CEST
Yes, this solves problem.

Does this fix will add to current release?
Comment 3 Wouter Wijngaards 2016-09-30 13:28:38 CEST
Hi Yuri,

The fix is in the code repository, and also in the (future-) next release of the software.

Best regards, Wouter