linux-api.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andrey Skvortsov <andrej.skvortzov@gmail.com>
To: Shuah Khan <shuahkh@osg.samsung.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Konstantin Khlebnikov <koct9i@gmail.com>,
	linux-api@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] selftests/vm: fix link error for transhuge-stress test
Date: Wed, 7 Jan 2015 23:10:45 +0300	[thread overview]
Message-ID: <20150107201045.GA5704@yulia-desktop> (raw)
In-Reply-To: <54AD872E.9060802@osg.samsung.com>

[-- Attachment #1: Type: text/plain, Size: 2029 bytes --]

On Wed, Jan 07, 2015 at 12:21:18PM -0700, Shuah Khan wrote:
> On 01/07/2015 11:35 AM, Andrey Skvortsov wrote:
> > add -lrt to fix undefined reference to `clock_gettime'
> > 
> > Signed-off-by: Andrey Skvortsov <andrej.skvortzov@gmail.com>
> > ---
> >  tools/testing/selftests/vm/Makefile |    2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/tools/testing/selftests/vm/Makefile b/tools/testing/selftests/vm/Makefile
> > index 4c4b1f6..077828c 100644
> > --- a/tools/testing/selftests/vm/Makefile
> > +++ b/tools/testing/selftests/vm/Makefile
> > @@ -7,7 +7,7 @@ BINARIES += transhuge-stress
> >  
> >  all: $(BINARIES)
> >  %: %.c
> > -	$(CC) $(CFLAGS) -o $@ $^
> > +	$(CC) $(CFLAGS) -o $@ $^ -lrt
> >  
> >  run_tests: all
> >  	@/bin/sh ./run_vmtests || (echo "vmtests: [FAIL]"; exit 1)
> > 
> 
> Andrey,
> 
> I don't see any undefined references when I build. Curious if it is
> specific to your env??
> 
> Please include the warning in the change log
> when you fix warnings in the future.
> 

thanks for the comment. 

Here is what I get without a patch:

linux-next/tools/testing/selftests/vm $ make
gcc -Wall -o hugepage-mmap hugepage-mmap.c
gcc -Wall -o hugepage-shm hugepage-shm.c
gcc -Wall -o map_hugetlb map_hugetlb.c
gcc -Wall -o thuge-gen thuge-gen.c
gcc -Wall -o hugetlbfstest hugetlbfstest.c
gcc -Wall -o transhuge-stress transhuge-stress.c
/tmp/ccpWoqkG.o: In function `main':
transhuge-stress.c:(.text+0x3a3): undefined reference to
`clock_gettime'
transhuge-stress.c:(.text+0x4dc): undefined reference to
`clock_gettime'
collect2: ld returned 1 exit status
make: *** [transhuge-stress] Error 1


$ gcc --version
gcc (Ubuntu/Linaro 4.6.4-1ubuntu1~12.04) 4.6.4.
The same error I get on my other Debian system.

man page for clock_gettime says 'Link with -lrt'. So I think the error
message is correct.

-- 
Best regards,
Andrey Skvortsov

Secure e-mail with gnupg: See http://www.gnupg.org/
PGP Key ID: 0x57A3AEAD



[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

  reply	other threads:[~2015-01-07 20:10 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-07 18:35 [PATCH] selftests/vm: fix link error for transhuge-stress test Andrey Skvortsov
     [not found] ` <1420655754-10076-1-git-send-email-Andrej.Skvortzov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2015-01-07 19:21   ` Shuah Khan
2015-01-07 20:10     ` Andrey Skvortsov [this message]
2015-01-08 15:55       ` Shuah Khan
2015-01-08 21:30         ` Andrey Skvortsov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150107201045.GA5704@yulia-desktop \
    --to=andrej.skvortzov@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=koct9i@gmail.com \
    --cc=linux-api@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=shuahkh@osg.samsung.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).