Nagios/CVS HEAD compilation issues on Solaris (strsep patch)

Joe Rhett jrhett at isite.net
Sat Nov 22 22:48:43 CET 2003


Nagios/CVS HEAD already has a configure script, so I ran that and it 
completed fine. But compilation fails, complaining about symbols that
are part of Nagios.

gcc -g -O2 -I/opt/imagelib/include -DHAVE_CONFIG_H -DNSCORE -o nagios nagios.c broker.o nebmods.o checks.o config.o commands.o events.o flapping.o logging.o notifications.o sehandlers.o utils.o retention-base.o xretention-base.o comments-base.o xcomments-base.o objects-base.o xobjects-base.o statusdata-base.o xstatusdata-base.o perfdata-base.o xperfdata-base.o downtime-base.o xdowntime-base.o    -L/opt/imagelib/lib  -lm -lnsl -lsocket -lpthread -ldl 
Undefined                       first referenced
 symbol                             in file
strsep                              xretention-base.o
nanosleep                           events.o
ld: fatal: Symbol referencing errors. No output written to nagios
collect2: ld returned 1 exit status

First, in every file except for the x?ddefaults.c files you replaced 
strsep() with my_strsep().  This patch brings these two together:

*** xdata/xrddefault.c_orig     Sat Nov 22 13:36:18 2003
--- xdata/xrddefault.c  Sat Nov 22 13:36:56 2003
***************
*** 633,639 ****
                                                else if(!strcmp(var,"state_history")){
                                                        temp_ptr=val;
                                                        for(x=0;x<MAX_STATE_HISTORY_ENTRIES;x++)
!                                                               temp_host->state_history[x]=atoi(strsep(&temp_ptr,","));
                                                        temp_host->state_history_index=0;
                                                        }
                                                }
--- 633,639 ----
                                                else if(!strcmp(var,"state_history")){
                                                        temp_ptr=val;
                                                        for(x=0;x<MAX_STATE_HISTORY_ENTRIES;x++)
!                                                               temp_host->state_history[x]=atoi(my_strsep(&temp_ptr,","));
                                                        temp_host->state_history_index=0;
                                                        }
                                                }
***************
*** 796,802 ****
                                                else if(!strcmp(var,"state_history")){
                                                        temp_ptr=val;
                                                        for(x=0;x<MAX_STATE_HISTORY_ENTRIES;x++)
!                                                               temp_service->state_history[x]=atoi(strsep(&temp_ptr,","));
                                                        temp_service->state_history_index=0;
                                                        }
                                                }
--- 796,802 ----
                                                else if(!strcmp(var,"state_history")){
                                                        temp_ptr=val;
                                                        for(x=0;x<MAX_STATE_HISTORY_ENTRIES;x++)
!                                                               temp_service->state_history[x]=atoi(my_strsep(&temp_ptr,","));
                                                        temp_service->state_history_index=0;
                                                        }
                                                }

*** xdata/xsddefault.c_orig     Sat Nov 22 13:36:31 2003
--- xdata/xsddefault.c  Sat Nov 22 13:37:06 2003
***************
*** 650,656 ****
                                        else if(!strcmp(var,"state_history")){
                                                temp_ptr=val;
                                                for(x=0;x<MAX_STATE_HISTORY_ENTRIES;x++)
!                                                       temp_hoststatus->state_history[x]=atoi(strsep(&temp_ptr,","));
                                                temp_hoststatus->state_history_index=0;
                                                }
                                        */
--- 650,656 ----
                                        else if(!strcmp(var,"state_history")){
                                                temp_ptr=val;
                                                for(x=0;x<MAX_STATE_HISTORY_ENTRIES;x++)
!                                                       temp_hoststatus->state_history[x]=atoi(my_strsep(&temp_ptr,","));
                                                temp_hoststatus->state_history_index=0;
                                                }
                                        */
***************
*** 743,749 ****
                                        else if(!strcmp(var,"state_history")){
                                                temp_ptr=val;
                                                for(x=0;x<MAX_STATE_HISTORY_ENTRIES;x++)
!                                                       temp_servicestatus->state_history[x]=atoi(strsep(&temp_ptr,","));
                                                temp_servicestatus->state_history_index=0;
                                                }
                                        */
--- 743,749 ----
                                        else if(!strcmp(var,"state_history")){
                                                temp_ptr=val;
                                                for(x=0;x<MAX_STATE_HISTORY_ENTRIES;x++)
!                                                       temp_servicestatus->state_history[x]=atoi(my_strsep(&temp_ptr,","));
                                                temp_servicestatus->state_history_index=0;
                                                }
                                        */



To get nanosleep on Solaris, so you have to link with -lposix4.
This should be tested for by autoconf



-- 
Joe Rhett                                                      Chief Geek
JRhett at Isite.Net                                      Isite Services, Inc.


-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
Does SourceForge.net help you be more productive?  Does it
help you create better code?  SHARE THE LOVE, and help us help
YOU!  Click Here: http://sourceforge.net/donate/




More information about the Developers mailing list