Skip to contentSkip to conversation

tests/ programs need -lrt too since they use clock_gettime.

PATCH In review Török Edwin 2 participants 3 messages Apr 9, 2010

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tests/ programs need -lrt too since they use clock_gettime.

When using the binutils gold linker, even if libdrm.so is already linked against -lrt you still need to link your app against -lrt if your app needs symbols from it.

---
 tests/Makefile.am |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
tests/Makefile.am +1 -1
index 3e74705..81006ab 100644
@@ -4,7 +4,7 @@ AM_CPPFLAGS = \
 	-I $(top_srcdir)/include/drm \
 	-I $(top_srcdir)
 
-LDADD = $(top_builddir)/libdrm.la
+LDADD = $(top_builddir)/libdrm.la @CLOCK_LIB@
 
 noinst_PROGRAMS = \
 	dristat \
Signature · 14 lines
1.7.0


------------------------------------------------------------------------------
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
--
_______________________________________________
Dri-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/dri-devel
#1 lore raw
Quoted 14 lines · Török Edwin

When using the binutils gold linker, even if libdrm.so is already linked against -lrt you still need to link your app against -lrt if your app needs symbols from it.

---
 tests/Makefile.am |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
tests/Makefile.am +0 -0
index 3e74705..81006ab 100644

tests/Makefile.am AM_CPPFLAGS = \ · line 10

Quoted 8 lines
tests/Makefile.am +1 -1
@@ -4,7 +4,7 @@ AM_CPPFLAGS = \
 	-I $(top_srcdir)/include/drm \
 	-I $(top_srcdir)
 
-LDADD = $(top_builddir)/libdrm.la
+LDADD = $(top_builddir)/libdrm.la @CLOCK_LIB@
 
 noinst_PROGRAMS = \
 	dristat \

The tests don't use librt afaict, the uses of clock_gettime() are in libdrm and libdrm_intel. So your explanation doesn't seem to make sense...

Cheers,
Julien

------------------------------------------------------------------------------
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
--

#2 lore raw
Quoted 22 lines · Julien Cristau
Quoted 20 lines · Török Edwin

When using the binutils gold linker, even if libdrm.so is already linked against -lrt you still need to link your app against -lrt if your app needs symbols from it.

---
  tests/Makefile.am |    2 +-
  1 files changed, 1 insertions(+), 1 deletions(-)
tests/Makefile.am +1 -1
index 3e74705..81006ab 100644
@@ -4,7 +4,7 @@ AM_CPPFLAGS = \
  	-I $(top_srcdir)/include/drm \
  	-I $(top_srcdir)
 
-LDADD = $(top_builddir)/libdrm.la
+LDADD = $(top_builddir)/libdrm.la @CLOCK_LIB@
 
Quoted 6 lines

tests/Makefile.am AM_CPPFLAGS = \ · line 10

Quoted 2 lines
tests/Makefile.am +0 -0
  noinst_PROGRAMS = \
  	dristat \

The tests don't use librt afaict, the uses of clock_gettime() are in libdrm and libdrm_intel. So your explanation doesn't seem to make sense...

The test app links dristat.o, and that includes xf86drm.c that uses clock_gettime.

Here is the link error I get without my patch:
make[1]: Entering directory `/home/edwin/drm/tests
libtool: link: gcc -m32 -O2 -g -o .libs/dristat dristat.o ../.libs/libdrm.so
/usr/bin/ld: dristat.o: in function drmWaitVBlank:../xf86drm.c:1930:
error: undefined reference to 'clock_gettime' /usr/bin/ld: dristat.o: in function drmWaitVBlank:../xf86drm.c:1941:
error: undefined reference to 'clock_gettime'
collect2: ld returned 1 exit status

dristat.c is including xf86drm.c directly (no idea why, shouldn't it get what it needs from libdrm.so?):
#include "xf86drm.c"

And xf86drm.c uses clock_gettime:

xf86drm.c:    ret = clock_gettime(CLOCK_MONOTONIC, &timeout);
xf86drm.c:      fprintf(stderr, "clock_gettime failed: %s\n", 

strerror(ret));
xf86drm.c: clock_gettime(CLOCK_MONOTONIC, &cur);

Best regards,
--Edwin

------------------------------------------------------------------------------
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
--