Xymon Mailing List Archive search

undefined reference to `clock_gettime'

list Scot Kreienkamp
Thu, 9 Apr 2009 08:58:29 -0400
Message-Id: <user-034aa4534e71@xymon.invalid>

Tim,

I have it on multiple systems, it's always worked for me.

Thanks,
 Scot Kreienkamp
La-Z-Boy Inc.

-----Original Message-----
From: Tim Boyer [mailto:user-390665de94b9@xymon.invalid] Sent: Thursday, April 09, 2009 8:13 AM
To: user-ae9b8668bcde@xymon.invalid
Cc: 'Me at home'; Me at home
Subject: RE: [hobbit] undefined reference to `clock_gettime'

Answering my own question here.  On all of my systems - and all of a
friend's systems, all running RHEL 5.3 - the  
LIBRTDEF = -lrt

Makefile workaround does not work.

What DOES work is this:

[root at challenger xymon-4.2.3]# LIBRTDEF=-lrt
[root at challenger xymon-4.2.3]# export LIBRTDEF

then make, etc.
I'm trying to install 4.2.3 to a RHEL5.3 system.  make returns the
following:

../lib/hobbitclient.a(timefunc-client.o): In function `gettimer':
/usr/src/xymon-4.2.3/lib/timefunc.c:55: undefined reference to
`clock_gettime'
../lib/hobbitclient.a(timefunc-client.o): In function `getntimer':
/usr/src/xymon-4.2.3/lib/timefunc.c:67: undefined reference to
`clock_gettime'
collect2: ld returned 1 exit status

I've seen a couple of posts that suggest I add

LIBRTDEF = -lrt

to the Makefile.  I've done that, and it gets worse...

client_config.c: In function 'dump_client_config':
client_config.c:1112: warning: format '%lld' expects type 'long long int',
but argument 2 has type 'off_t'
client_config.c:1114: warning: format '%lld' expects type 'long long int',
but argument 2 has type 'off_t'
client_config.c:1116: warning: format '%lld' expects type 'long long int',
but argument 2 has type 'off_t'
client_config.c: In function 'check_file':
client_config.c:1596: warning: format '%lld' expects type 'long long int',
but argument 3 has type 'off_t'
client_config.c:1596: warning: format '%lld' expects type 'long long int',
but argument 4 has type 'off_t'
client_config.c:1609: warning: format '%lld' expects type 'long long int',
but argument 3 has type 'off_t'
client_config.c:1609: warning: format '%lld' expects type 'long long int',
but argument 4 has type 'off_t'
client_config.c:1622: warning: format '%lld' expects type 'long long int',
but argument 3 has type 'off_t'
client_config.c:1622: warning: format '%lld' expects type 'long long int',
but argument 4 has type 'off_t'
gcc -o ../client/hobbitd_client -Wl,--rpath=/usr/lib64 hobbitd_client.o
hobbitd_worker.o hobbitd_buffer.o client_config.o ../lib/hobbitclient.a
-L/usr/lib64 -lpcre  ../lib/hobbitclient.a(timefunc-client.o): In function `gettimer':
/usr/src/xymon-4.2.3/lib/timefunc.c:55: undefined reference to
`clock_gettime'
../lib/hobbitclient.a(timefunc-client.o): In function `getntimer':
/usr/src/xymon-4.2.3/lib/timefunc.c:67: undefined reference to
`clock_gettime'
collect2: ld returned 1 exit status
make[1]: *** [../client/hobbitd_client] Error 1

Pointers in the right direction appreciated.

-- 
Tim Boyer
Denman Tire Corporation