[Liboil] undefined reference to clock_gettime

David Schleef ds at schleef.org
Wed Mar 5 16:23:20 PST 2008

On Wed, Mar 05, 2008 at 01:42:13PM -0700, Nathan Caldwell wrote:
> Hi.
> First, I apologize for cross posting.
> I'm attempting to add schroedinger to HandBrake. The problem is when I
> go to link I get an undefined reference to clock_gettime from liboil
> and schroedinger. Any ideas why this would be?
> ...updating 1 target(s)...
> Link HandBrakeCLI
> contrib/lib/libschroedinger-1.0.a(libschroedinger_1.0_la-schroasync-pthread.o):
> In function `schro_async_wait_locked':
> (.text+0x476): undefined reference to `clock_gettime'
> contrib/lib/liboil-0.3.a(liboil_0.3_la-liboilcpu.o): In function
> `oil_profile_stamp_clock_gettime':
> /home/nate/projects/liboil/liboil/liboilcpu.c:88: undefined reference
> to `clock_gettime'
> collect2: ld returned 1 exit status

First of all, it appears you are linking statically.  This is generally
a bad idea.

Second, I'm guessing you're not using pkg-config to get the CFLAGS and
LIBS required to build and link against liboil or schroedinger.  This
is pretty much required, as evidenced by you missing "-lrt" in the
link flags.


More information about the Liboil mailing list