[dev] Linking against rt in dwm

From: Eric Pruitt <eric.pruitt_AT_gmail.com>
Date: Mon, 7 Jul 2014 21:59:58 -0500

I'm attempting to write a patch for dwm that uses clock_gettime(3), but
I cannot figure out how to get librt properly linked to the build.

In config.mk, I changed the LIBS variable:

    -LIBS = -L${X11LIB} -lX11 ${XINERAMALIBS}
    +LIBS = -L${X11LIB} -lX11 ${XINERAMALIBS} -lrt

Inside dwm, I also have the include for time.h. However, when I attempt
to compile dwm with my patch, I get the following warning and error:

    dwm build options:
    CFLAGS = -std=c99 -pedantic -Wall -Wno-deprecated-declarations -Os -I/usr/X11R6/include -D_BSD_SOURCE -D_POSIX_C_SOURCE=2 -DVERSION="6.1"
    LDFLAGS = -s -L/usr/X11R6/lib -lX11 -lrt
    CC = cc
    dwm.c:1451:3: warning: implicit declaration of function ‘clock_gettime’ [-Wimplicit-function-declaration]
    dwm.c:1451:21: error: ‘CLOCK_MONOTONIC’ undeclared (first use in this function)

What am I doing wrong?

Received on Tue Jul 08 2014 - 04:59:58 CEST

This archive was generated by hypermail 2.3.0 : Tue Jul 08 2014 - 05:12:03 CEST