Page 1 of 1

Can't compile latest 4.0.8 on Macos 10.9

Posted: Sat Aug 23, 2014 10:48 am
by julient
Hello

I try to compile nagios 4.0.8 on Mac (10.9.4) with macports and it fails like this

Code: Select all

:info:build make[2]: Entering directory `/opt/local/var/macports/build/_Users_user_ports_net_nagios/nagios/work/nagios-4.0.8/lib'
:info:build /usr/bin/clang -Wall -pipe -Os -Os -arch x86_64 -arch x86_64 -I/opt/local/include -DHAVE_CONFIG_H -c runcmd.c -o runcmd.o
:info:build /usr/bin/clang -Wall -pipe -Os -Os -arch x86_64 -arch x86_64 -I/opt/local/include -DHAVE_CONFIG_H -c nsutils.c -o nsutils.o
:info:build runcmd.c:590:50: error: expression is not assignable
:info:build         if (asprintf(&env_string, "%s=%s", name, value) = -1) return -1; 
:info:build             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^
:info:build runcmd.c:592:9: warning: equality comparison result unused [-Wunused-comparison]
:info:build                 errno == ENOMEM;
:info:build                 ~~~~~~^~~~~~~~~
:info:build runcmd.c:592:9: note: use '=' to turn this equality comparison into an assignment
:info:build                 errno == ENOMEM;
:info:build                       ^~  
:info:build                       =   
:info:build 1 warning and 1 error generated.
:info:build make[2]: *** [runcmd.o] Error 1
pointers to solve that?

Thanks

Re: Can't compile latest 4.0.8 on Macos 10.9

Posted: Mon Aug 25, 2014 9:30 am
by emislivec
This is a mistake on my part. I had undefined HAVE_SETENV to force that code path in earlier development, but obviously not when/after adding in the error checking. I've just committed a fix so this should be resolved for the future.

To get this to build you could try the current master from GitHub that has this fixed: https://github.com/NagiosEnterprises/na ... 89a8c6.zip

Otherwise edit lib/runcmd.c:590 to:

Code: Select all

	if (asprintf(&env_string, "%s=%s", name, value) == -1) return -1;
lib/runcmd.c:592:

Code: Select all

		errno = ENOMEM;
The changes needed will look like this: https://github.com/NagiosEnterprises/na ... ca3b89a8c6

Re: Can't compile latest 4.0.8 on Macos 10.9

Posted: Thu Aug 28, 2014 9:10 pm
by julient
Thanks emislivec.
No problem. Everyone shoots his-self sometimes, just don't kill you ;-)

Re: Can't compile latest 4.0.8 on Macos 10.9

Posted: Fri Aug 29, 2014 9:45 am
by tmcdonald
julient, are you able to compile 4.0.8 successfully now?