Compile issues on older system

Andreas Ericsson ae at op5.se
Tue Feb 15 08:28:07 CET 2005


kmoogle wrote:
> Things were looking great until..
> 
> cgi.o xstatusdata-cgi.o -lgd -lttf -lpng -ljpeg -lz -lm
> gcc -g -O2 -DHAVE_CONFIG_H -DNSCGI  -o histogram.cgi histogram.c
> getcgi.o cgiutils.o cgiauth.o  objects-cgi.o xobjects-cgi.o statu
> sdata-cgi.o xstatusdata-cgi.o -lgd -lttf -lpng -ljpeg -lz -lm
> make[1]: Leaving directory `/opt/src/nagios-2.0b2/cgi'
> cd ./html && make
> make[1]: Entering directory `/opt/src/nagios-2.0b2/html'
> make[1]: Nothing to be done for `all'.
> make[1]: Leaving directory `/opt/src/nagios-2.0b2/html'
> cd ./module && make
> make[1]: Entering directory `/opt/src/nagios-2.0b2/module'
> gcc -g -O2 -DHAVE_CONFIG_H  -o helloworld.o helloworld.c
> /usr/lib/crt1.o: In function `_start':
> /usr/lib/crt1.o(.text+0x18): undefined reference to `main'

The module directory contains code that hooks up to an undocumented API 
in Nagios. To build modules, you need to compile with
gcc -shared helloworld.c -o helloworld.so
What you've found is a bug in the Makefile (should have -shared in 
LDFLAGS), but noone competent enough to use the module API cares since 
it's a trivial fix and the only reason for anyone to meddle with it is 
if they're writing their own module.

Incidentally, the -shared flag tells GCC to add extra symbol tables for 
all exported symbols in the object, and not to worry about unresolved 
ones because they will be fixed when the code is loaded.

> /tmp/ccJ6bUlv.o: In function `nebmodule_init':
> /opt/src/nagios-2.0b2/module/helloworld.c:45: undefined reference to
> `write_to_all_logs'
> /opt/src/nagios-2.0b2/module/helloworld.c:50: undefined reference to
> `write_to_all_logs'
> /opt/src/nagios-2.0b2/module/helloworld.c:55: undefined reference to
> `schedule_new_event'
> /tmp/ccJ6bUlv.o: In function `nebmodule_deinit':
> /opt/src/nagios-2.0b2/module/helloworld.c:68: undefined reference to
> `write_to_all_logs'
> /tmp/ccJ6bUlv.o: In function `reminder_message':
> /opt/src/nagios-2.0b2/module/helloworld.c:81: undefined reference to
> `write_to_all_logs'
> collect2: ld returned 1 exit status
> make[1]: *** [helloworld.o] Error 1
> make[1]: Leaving directory `/opt/src/nagios-2.0b2/module'
> make: *** [all] Error 2
> 
> Not a huge deal. I'm going to upgrade the box soon anyway. If you have
> any suggestions, as always, they're appreciated.
> 
> Take care. :)
> 
> 
>>Date: Sat, 12 Feb 2005 12:22:38 +0100
>>From: Andreas Ericsson <ae at op5.se>
>>To: nagios-users at lists.sourceforge.net
>>Subject: Re: [Nagios-users] Compile issues on older system
>>
>>kmoogle wrote:
>>
>>>I'm trying to compile nagios-2.0b2 on an older system (my apologies in
>>>advance) -- but have run into an issue. './configure' runs properly,
>>>but fails on the 'make'. It currently runs Nagios 1.2.
>>>
>>>Any assistance is appreciated.
>>>
>>>Thank you.
>>>
>>>======> Specifics
>>>gcc version egcs-2.91.66 19990314/Linux (egcs-1.1.2 release)
>>>GNU Make version 3.78.1
>>>GNU ld version 2.9.5 (with BFD 2.9.5.0.22)
>>>ldd (GNU libc) 2.1.3
>>>kernel 2.4.23
>>>GNU C Library stable release version 2.1.3
>>>
>>>======> 'make all' output
>>>[nagios-2.0b2]# make all
>>>cd ./base && make
>>>make[1]: Entering directory `/opt/src/nagios-2.0b2/base'
>>>gcc -g -O2 -DHAVE_CONFIG_H -DNSCORE   -c -o broker.o broker.c
>>>In file included from ../include/nebmods.h:31,
>>>                 from broker.c:33:
>>>../include/nebmodules.h:78: parse error before `lt_ptr'
>>
>>Install latest libtool with header files and such, or try ./configure
>>--disable-event-broker. It's enabled by default, but the libtool support
>>autodetection is a bit shoddy.
>>
>>There aren't that many modules to Nagios as of yet, so the usefulness of
>>the event broker is still pretty limited.
> 
> 
> 
> -------------------------------------------------------
> SF email is sponsored by - The IT Product Guide
> Read honest & candid reviews on hundreds of IT Products from real users.
> Discover which products truly live up to the hype. Start reading now.
> http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
> _______________________________________________
> Nagios-users mailing list
> Nagios-users at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/nagios-users
> ::: Please include Nagios version, plugin version (-v) and OS when reporting any issue. 
> ::: Messages without supporting info will risk being sent to /dev/null
> 

-- 
Andreas Ericsson                   andreas.ericsson at op5.se
OP5 AB                             www.op5.se
Lead Developer


-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
Nagios-users mailing list
Nagios-users at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when reporting any issue. 
::: Messages without supporting info will risk being sent to /dev/null





More information about the Users mailing list