[Nagiosplug-help] Re: check_icmp error under Solaris again

Andreas Ericsson ae at op5.se
Mon Dec 20 13:25:02 CET 2004

Horváth Tamás wrote:
> Hi!
> Thanks Andreas!
> I tried what you suggested, but got the following error:
> bash-2.03# gcc -O2 check_icmp.c -o check_icmp
> Undefined                       first referenced
>  symbol                             in file
> inet_addr                           /var/tmp//cc2lIMsO.o
> getprotobyname                      /var/tmp//cc2lIMsO.o
> gethostbyname                       /var/tmp//cc2lIMsO.o
> sendto                              /var/tmp//cc2lIMsO.o
> h_errno                             /var/tmp//cc2lIMsO.o
> socket                              /var/tmp//cc2lIMsO.o
> recvfrom                            /var/tmp//cc2lIMsO.o
> inet_ntoa                           /var/tmp//cc2lIMsO.o
> gethostbyaddr                       /var/tmp//cc2lIMsO.o
> ld: fatal: Symbol referencing errors. No output written to check_icmp
> collect2: ld returned 1 exit status
> My GCC version is:
> bash-2.03# gcc -v
> Reading specs from /usr/local/lib/gcc-lib/sparc-sun-solaris2.8/3.3/specs
> Configured with: ../configure --disable-nls --with-as=/usr/ccs/bin/as
> --with-ld=/usr/ccs/bin/ld
> Thread model: posix
> gcc version 3.3
> bash-2.03#
> Sorry, but I'm not a programmer and have absolutely no experience with
> compiling. How can I solve this issue?

It seems you need to link check_icmp with additional libraries to reach 
the functions you need.

Do like this;
for i in `grep -l sendto /lib/*.so /usr/lib/*.so | sed -e 's,^.*/lib,,' 
-e 's/\..*//'`; do gcc check_icmp -o check_icmp -l$i; done

That will try linking with all libraries that have a symbol called 
sendto in them (or one referring to it, compiled with debugging 
support). If that doesn't help I'll need more info about the system.

Most likely someone else on this list is more experienced with solaris 
than I am, so they might be able to help you.

> Thanks in advance!
> Bye, Tamas. 

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

More information about the Help mailing list