linux-perf-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Namhyung Kim <namhyung@kernel.org>
To: taeung <treeze.taeung@gmail.com>
Cc: linux-perf-users@vger.kernel.org, acme@kernel.org, jolsa@kernel.org
Subject: Re: compile error : about declaration of ‘pthread_attr_setaffinity_np’
Date: Sat, 28 Feb 2015 12:04:55 +0900	[thread overview]
Message-ID: <20150228030454.GC15964@danjae> (raw)
In-Reply-To: <54EC3E3B.2040702@gmail.com>

(Adding Arnaldo and Jiri to CC.)

On Tue, Feb 24, 2015 at 06:02:51PM +0900, taeung wrote:
> Hi, Namhyung

Hi Taeung,

> 
> After I pulled new changed source codes from 'perf/core' branch
> (https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git)
> ,when I compiled perf I've had a problem with error messages as below.
> 
> (I'm using as below
> system : Ubuntu 14.04.2 LTS 64-bit
> kernel version : 3.13.0-40-generic)
> 
> ==================
> taeung ~/git/tip/tools/perf
>  :> make -j4
> 
> ...(omitted)
> 
> In file included from bench/futex-hash.c:17:0:
> bench/futex.h:73:19: error: conflicting types for
> ‘pthread_attr_setaffinity_np’
>  static inline int pthread_attr_setaffinity_np(pthread_attr_t *attr,
>                    ^
> In file included from bench/futex.h:72:0,
>                  from bench/futex-hash.c:17:
> /usr/include/pthread.h:407:12: note: previous declaration of
> ‘pthread_attr_setaffinity_np’ was here
>  extern int pthread_attr_setaffinity_np (pthread_attr_t *__attr,
>             ^

This means it failed to find pthread_attr_setaffinity_np() on the
feature test (so HAVE_PTHREAD_ATTR_SETAFFINITY_NP is not defined) but
it's actually available on your system.


> make[3]: *** [bench/futex-hash.o] Error 1
> make[2]: *** [bench] Error 2
> make[2]: *** Waiting for unfinished jobs....
> 
> ...(omitted)
> 
> ==================
> 
> But I modified 'tools/perf/config/feature-checks/Makefile' as Jirka said
> (https://lkml.org/lkml/2015/1/12/216)
> so I was able to compile perf.

No Jiri's advice was to add -lpthread, not remove _GNU_SOURCE define.
I guess adding -pthread instead of -lpthread might help..


> 
> 
> diff --git a/tools/perf/config/feature-checks/Makefile
> b/tools/perf/config/feature-checks/Makefile
> index b32ff33..42ac05a 100644
> --- a/tools/perf/config/feature-checks/Makefile
> +++ b/tools/perf/config/feature-checks/Makefile
> @@ -49,7 +49,7 @@ test-hello.bin:
>         $(BUILD)
> 
>  test-pthread-attr-setaffinity-np.bin:
> -       $(BUILD) -D_GNU_SOURCE -Werror -lpthread
> +       $(BUILD) -Werror -lpthread
> 
>  test-stackprotector-all.bin:
>         $(BUILD) -Werror -fstack-protector-all
> 
> 
> Is this patch right ?

I don't think so.  You'd better to find out the reason of the failure
in the feature test.

Thanks,
Namhyung

      reply	other threads:[~2015-02-28  3:05 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-24  9:02 compile error : about declaration of ‘pthread_attr_setaffinity_np’ taeung
2015-02-28  3:04 ` Namhyung Kim [this message]

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=20150228030454.GC15964@danjae \
    --to=namhyung@kernel.org \
    --cc=acme@kernel.org \
    --cc=jolsa@kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=treeze.taeung@gmail.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).