From mboxrd@z Thu Jan 1 00:00:00 1970 From: =?ISO-8859-1?Q?T=F6r=F6k_Edwin?= Subject: Re: [PATCH] tests/ programs need -lrt too since they use clock_gettime. Date: Fri, 09 Apr 2010 22:09:23 +0300 Message-ID: <4BBF7B63.2070000@gmail.com> References: <1270820807-21442-1-git-send-email-edwintorok@gmail.com> <20100409190049.GK3082@radis.liafa.jussieu.fr> Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Return-path: In-Reply-To: <20100409190049.GK3082@radis.liafa.jussieu.fr> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.sourceforge.net To: Julien Cristau Cc: dri-devel@lists.sourceforge.net List-Id: dri-devel@lists.freedesktop.org On 04/09/2010 10:00 PM, Julien Cristau wrote: > On Fri, Apr 9, 2010 at 16:46:46 +0300, T=F6r=F6k Edwin wrote: > >> 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 symb= ols from >> it. >> >> Signed-off-by: T=F6r=F6k Edwin >> --- >> tests/Makefile.am | 2 +- >> 1 files changed, 1 insertions(+), 1 deletions(-) >> >> diff --git a/tests/Makefile.am b/tests/Makefile.am >> index 3e74705..81006ab 100644 >> --- a/tests/Makefile.am >> +++ b/tests/Makefile.am >> @@ -4,7 +4,7 @@ AM_CPPFLAGS =3D \ >> -I $(top_srcdir)/include/drm \ >> -I $(top_srcdir) >> >> -LDADD =3D $(top_builddir)/libdrm.la >> +LDADD =3D $(top_builddir)/libdrm.la @CLOCK_LIB@ >> >> noinst_PROGRAMS =3D \ >> 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 =3D 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 --