Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1728673 > unrolled thread

Re: [PATCH 33/35] perf bench futex: Fix build on musl + clang

Started byJörg Krause <joerg.krause@embedded.rocks>
First post2017-09-08 10:20 +0200
Last post2017-09-08 15:50 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: [PATCH 33/35] perf bench futex: Fix build on musl + clang Jörg Krause <joerg.krause@embedded.rocks> - 2017-09-08 10:20 +0200
    Re: [PATCH 33/35] perf bench futex: Fix build on musl + clang Arnaldo Carvalho de Melo <acme@kernel.org> - 2017-09-08 15:50 +0200

#1728673 — Re: [PATCH 33/35] perf bench futex: Fix build on musl + clang

FromJörg Krause <joerg.krause@embedded.rocks>
Date2017-09-08 10:20 +0200
SubjectRe: [PATCH 33/35] perf bench futex: Fix build on musl + clang
Message-ID<unmG5-4bi-5@gated-at.bofh.it>
Hi Arnaldo,

On Mon, 2017-03-06 at 16:38 -0300, Arnaldo Carvalho de Melo wrote:
> From: Arnaldo Carvalho de Melo <acme@redhat.com>
> 
> When building with clang on a musl libc system, Alpine Linux, we end up
> hitting a problem where memset() is used but its prototype is not
> present, add it to avoid this:
> 
>   bench/futex-wake.c:99:3: error: implicitly declaring library function 'memset' with type 'void *(void *, int, unsigned long)'
>         [-Werror,-Wimplicit-function-declaration]
>                   CPU_ZERO(&cpu);
>                   ^
>   /usr/include/sched.h:127:23: note: expanded from macro 'CPU_ZERO'
>   #define CPU_ZERO(set) CPU_ZERO_S(sizeof(cpu_set_t),set)
>                         ^
>   /usr/include/sched.h:110:30: note: expanded from macro 'CPU_ZERO_S'
>   #define CPU_ZERO_S(size,set) memset(set,0,size)
>                                ^
>   bench/futex-wake.c:99:3: note: include the header <string.h> or explicitly provide a declaration for 'memset'

In my opinion the musl <shed.h> header file should include <string.h>.
I've reported the issue to the musl mailing list:

http://www.openwall.com/lists/musl/2017/09/08/1

> Found while updating my test build containers to build perf with clang in more
> systems.
> 
> Cc: Adrian Hunter <adrian.hunter@intel.com>
> Cc: David Ahern <dsahern@gmail.com>
> Cc: Davidlohr Bueso <dave@stgolabs.net>
> Cc: Jiri Olsa <jolsa@kernel.org>
> Cc: Namhyung Kim <namhyung@kernel.org>
> Cc: Wang Nan <wangnan0@huawei.com>
> Link: http://lkml.kernel.org/n/tip-jh10vaz2r98zl6gm5iau8prr@git.kernel.org
> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
> ---
>  tools/perf/bench/futex-hash.c          | 1 +
>  tools/perf/bench/futex-lock-pi.c       | 1 +
>  tools/perf/bench/futex-requeue.c       | 1 +
>  tools/perf/bench/futex-wake-parallel.c | 1 +
>  tools/perf/bench/futex-wake.c          | 1 +
>  5 files changed, 5 insertions(+)
> 
> diff --git a/tools/perf/bench/futex-hash.c b/tools/perf/bench/futex-hash.c
> index da04b8c5568a..2499e1b0c6fb 100644
> --- a/tools/perf/bench/futex-hash.c
> +++ b/tools/perf/bench/futex-hash.c
> @@ -9,6 +9,7 @@
>   */
>  
>  /* For the CLR_() macros */
> +#include <string.h>
>  #include <pthread.h>
>  
>  #include <errno.h>
> diff --git a/tools/perf/bench/futex-lock-pi.c b/tools/perf/bench/futex-lock-pi.c
> index 91877777ec6e..a20814d94af1 100644
> --- a/tools/perf/bench/futex-lock-pi.c
> +++ b/tools/perf/bench/futex-lock-pi.c
> @@ -3,6 +3,7 @@
>   */
>  
>  /* For the CLR_() macros */
> +#include <string.h>
>  #include <pthread.h>
>  
>  #include <signal.h>
> diff --git a/tools/perf/bench/futex-requeue.c b/tools/perf/bench/futex-requeue.c
> index 2b9705a8734c..9fad1e4fcd3e 100644
> --- a/tools/perf/bench/futex-requeue.c
> +++ b/tools/perf/bench/futex-requeue.c
> @@ -9,6 +9,7 @@
>   */
>  
>  /* For the CLR_() macros */
> +#include <string.h>
>  #include <pthread.h>
>  
>  #include <signal.h>
> diff --git a/tools/perf/bench/futex-wake-parallel.c b/tools/perf/bench/futex-wake-parallel.c
> index 2c8fa67ad537..40f5fcf1d120 100644
> --- a/tools/perf/bench/futex-wake-parallel.c
> +++ b/tools/perf/bench/futex-wake-parallel.c
> @@ -8,6 +8,7 @@
>   */
>  
>  /* For the CLR_() macros */
> +#include <string.h>
>  #include <pthread.h>
>  
>  #include <signal.h>
> diff --git a/tools/perf/bench/futex-wake.c b/tools/perf/bench/futex-wake.c
> index e246b1b8388a..789490281ae3 100644
> --- a/tools/perf/bench/futex-wake.c
> +++ b/tools/perf/bench/futex-wake.c
> @@ -9,6 +9,7 @@
>   */
>  
>  /* For the CLR_() macros */
> +#include <string.h>
>  #include <pthread.h>
>  
>  #include <signal.h>

Best regards,
Jörg Krause

[toc] | [next] | [standalone]


#1728905

FromArnaldo Carvalho de Melo <acme@kernel.org>
Date2017-09-08 15:50 +0200
Message-ID<unrPs-7GO-11@gated-at.bofh.it>
In reply to#1728673
Em Fri, Sep 08, 2017 at 10:04:05AM +0200, Jörg Krause escreveu:
> On Mon, 2017-03-06 at 16:38 -0300, Arnaldo Carvalho de Melo wrote:
> > When building with clang on a musl libc system, Alpine Linux, we end up
> > hitting a problem where memset() is used but its prototype is not
> > present, add it to avoid this:

> >   bench/futex-wake.c:99:3: error: implicitly declaring library function 'memset' with type 'void *(void *, int, unsigned long)'
> >         [-Werror,-Wimplicit-function-declaration]
> >                   CPU_ZERO(&cpu);
> >                   ^
> >   /usr/include/sched.h:127:23: note: expanded from macro 'CPU_ZERO'
> >   #define CPU_ZERO(set) CPU_ZERO_S(sizeof(cpu_set_t),set)
> >                         ^
> >   /usr/include/sched.h:110:30: note: expanded from macro 'CPU_ZERO_S'
> >   #define CPU_ZERO_S(size,set) memset(set,0,size)
> >                                ^
> >   bench/futex-wake.c:99:3: note: include the header <string.h> or explicitly provide a declaration for 'memset'

> In my opinion the musl <shed.h> header file should include <string.h>.

Agreed.

> I've reported the issue to the musl mailing list:
 
> http://www.openwall.com/lists/musl/2017/09/08/1

Thanks for reporting that to them,

- Arnaldo

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web