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

Daniel Micay danielmicay at gmail.com
Thu Aug 20 00:36:45 PDT 2015


On 20/08/15 03:34 AM, Ingvar Hagelund wrote:
> 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

Yeah, the issue would be that clock_gettime was moved to libc in newer
versions of libc so -lrt wasn't added for the tests.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: <http://jemalloc.net/mailman/jemalloc-discuss/attachments/20150820/1eb1893a/attachment.sig>


More information about the jemalloc-discuss mailing list