Can't compile latest 4.0.8 on Macos 10.9

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
julient
Posts: 3
Joined: Thu May 15, 2014 9:40 am

Can't compile latest 4.0.8 on Macos 10.9

Post 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
emislivec
Posts: 52
Joined: Tue Feb 25, 2014 10:06 am

Re: Can't compile latest 4.0.8 on Macos 10.9

Post 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
julient
Posts: 3
Joined: Thu May 15, 2014 9:40 am

Re: Can't compile latest 4.0.8 on Macos 10.9

Post by julient »

Thanks emislivec.
No problem. Everyone shoots his-self sometimes, just don't kill you ;-)
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: Can't compile latest 4.0.8 on Macos 10.9

Post by tmcdonald »

julient, are you able to compile 4.0.8 successfully now?
Former Nagios employee
Locked