jemalloc-4.0.0 on el5 and el6: undefined reference to `clock_gettime'

Ingvar Hagelund ingvar at redpill-linpro.com
Thu Aug 20 00:34:59 PDT 2015


When compiling jemalloc-4.0.0 on rhel5 or rhel6, the linker stops with
"undefined reference to `clock_gettime'"

Adding "-lrt" to LDFLAGS gets around this, but perhaps it could have
been picked up automatically?

Regards,
Ingvar


el6$ gcc -o test/unit/atomic test/unit/atomic.o src/jemalloc.jet.o
src/arena.jet.o src/atomic.jet.o src/base.jet.o src/bitmap.jet.o
src/chunk.jet.o src/chunk_dss.jet.o src/chunk_mmap.jet.o src/ckh.jet.o
src/ctl.jet.o src/extent.jet.o src/hash.jet.o src/huge.jet.o
src/mb.jet.o src/mutex.jet.o src/pages.jet.o src/prof.jet.o
src/quarantine.jet.o src/rtree.jet.o src/stats.jet.o src/tcache.jet.o
src/util.jet.o src/tsd.jet.o src/valgrind.jet.o test/src/btalloc.unit.o
test/src/btalloc_0.unit.o test/src/btalloc_1.unit.o test/src/math.unit.o
test/src/mtx.unit.o test/src/mq.unit.o test/src/SFMT.unit.o
test/src/test.unit.o test/src/thd.unit.o test/src/timer.unit.o
-Wl,-rpath,lib  -lpthread -lm
test/src/timer.unit.o: In function `timer_stop':
/builddir/build/BUILD/jemalloc-4.0.0/test/src/timer.c:27: undefined
reference to `clock_gettime'
test/src/timer.unit.o: In function `timer_start':
/builddir/build/BUILD/jemalloc-4.0.0/test/src/timer.c:14: undefined
reference to `clock_gettime'
/builddir/build/BUILD/jemalloc-4.0.0/test/src/timer.c:14: undefined
reference to `clock_gettime'
collect2: ld returned 1 exit status
make: *** [test/unit/atomic] Error 1


More information about the jemalloc-discuss mailing list