Skip to contentSkip to conversation

tools lib: Reinstate strlcpy() header guard with __UCLIBC__

PATCH Superseded Vineet Gupta 4 participants 15 messages Aug 17, 2016 – Aug 22, 2016 Synopsys ARC architecture

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tools lib: Reinstate strlcpy() header guard with __UCLIBC__

perf tools build in recent kernels spews splat when cross compiling with uClibc

|   CC       util/alias.o
| In file included from tools/perf/util/../ui/../util/cache.h:8:0,
|                 from tools/perf/util/../ui/helpline.h:7,
|                 from tools/perf/util/debug.h:8,
|                 from arch/../util/cpumap.h:9,
|                 from arch/../util/env.h:5,
|                 from arch/common.h:4,
|                 from arch/common.c:3:
| tools/include/linux/string.h:12:15: warning: redundant redeclaration of ?strlcpy? [-Wredundant-decls]
|  extern size_t strlcpy(char *dest, const char *src, size_t size);
               ^

This is after commit 61a6445e463a31 ("tools lib: Guard the strlcpy() header with __GLIBC__"). While the commit was right in theory, issue is uClibc also defines __GLIBC__ for application headers.

Instead of reverting the commit, manually revert with some addeed commentary to same effect.

Cc Adrian Hunter <adrian.hunter at intel.com>
Cc Alexey Brodkin <Alexey.Brodkin at synopsys.com>
Cc David Ahern <dsahern at gmail.com>
Cc Jiri Olsa <jolsa at kernel.org>
Cc Namhyung Kim <namhyung at kernel.org>
Cc Wang Nan <wangnan0 at huawei.com>
Cc Petri Gynther <pgynther at google.com>
Cc Peter Zijlstra (Intel) <peterz at infradead.org>
Signed-off-by Vineet Gupta <vgupta at synopsys.com>
---
 tools/include/linux/string.h | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
tools/include/linux/string.h +6 -1
index b96879477311..5a9e30334ffa 100644
@@ -8,7 +8,12 @@ void *memdup(const void *src, size_t len);
 
 int strtobool(const char *s, bool *res);
 
-#ifdef __GLIBC__
+/*
+ * Ideally instead of blacklisting libs which define this already (uclibc,
+ * musl..), we could whitelist libs which reuire it (glibc). However uClibc
+ * also defines __GLIBC__ for user application headers
+ */
+#ifndef __UCLIBC__
 extern size_t strlcpy(char *dest, const char *src, size_t size);
 #endif
 
Signature · 1 line
2.7.4
#1 lore raw

Em Wed, Aug 17, 2016 at 01:00:50PM -0700, Vineet Gupta escreveu:

Quoted 13 lines

perf tools build in recent kernels spews splat when cross compiling with uClibc

|   CC       util/alias.o
| In file included from tools/perf/util/../ui/../util/cache.h:8:0,
|                 from tools/perf/util/../ui/helpline.h:7,
|                 from tools/perf/util/debug.h:8,
|                 from arch/../util/cpumap.h:9,
|                 from arch/../util/env.h:5,
|                 from arch/common.h:4,
|                 from arch/common.c:3:
| tools/include/linux/string.h:12:15: warning: redundant redeclaration of ?strlcpy? [-Wredundant-decls]
|  extern size_t strlcpy(char *dest, const char *src, size_t size);
               ^
Quoted 6 lines

This is after commit 61a6445e463a31 ("tools lib: Guard the strlcpy() header with __GLIBC__"). While the commit was right in theory, issue is uClibc also defines __GLIBC__ for application headers.

Instead of reverting the commit, manually revert with some addeed commentary to same effect.

Well, you can't revert it, as this will make it break elsewhere. So please check if

#if defined(__GLIBC__) && !defined(__UCLIBC__)

suits uclibc.

Are you aware of any readily available tarball or docker image that has a uclibc based devel env that I could grab? I'd add it to my build setup to make sure I (and my downstreamers) don't break uclibc environments in the future.

- Arnaldo

Quoted 33 lines
Cc Adrian Hunter <adrian.hunter at intel.com>
Cc Alexey Brodkin <Alexey.Brodkin at synopsys.com>
Cc David Ahern <dsahern at gmail.com>
Cc Jiri Olsa <jolsa at kernel.org>
Cc Namhyung Kim <namhyung at kernel.org>
Cc Wang Nan <wangnan0 at huawei.com>
Cc Petri Gynther <pgynther at google.com>
Cc Peter Zijlstra (Intel) <peterz at infradead.org>
Signed-off-by Vineet Gupta <vgupta at synopsys.com>
---
 tools/include/linux/string.h | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
tools/include/linux/string.h +6 -1
index b96879477311..5a9e30334ffa 100644
@@ -8,7 +8,12 @@ void *memdup(const void *src, size_t len);
 
 int strtobool(const char *s, bool *res);
 
-#ifdef __GLIBC__
+/*
+ * Ideally instead of blacklisting libs which define this already (uclibc,
+ * musl..), we could whitelist libs which reuire it (glibc). However uClibc
+ * also defines __GLIBC__ for user application headers
+ */
+#ifndef __UCLIBC__
 extern size_t strlcpy(char *dest, const char *src, size_t size);
 #endif
 
Signature · 1 line
2.7.4
#2 lore raw
Quoted 18 lines · Arnaldo Carvalho de Melo

Em Wed, Aug 17, 2016 at 01:00:50PM -0700, Vineet Gupta escreveu:

Quoted 17 lines

perf tools build in recent kernels spews splat when cross compiling with uClibc

|   CC       util/alias.o
| In file included from tools/perf/util/../ui/../util/cache.h:8:0,
|                 from tools/perf/util/../ui/helpline.h:7,
|                 from tools/perf/util/debug.h:8,
|                 from arch/../util/cpumap.h:9,
|                 from arch/../util/env.h:5,
|                 from arch/common.h:4,
|                 from arch/common.c:3:
| tools/include/linux/string.h:12:15: warning: redundant redeclaration of ?strlcpy? [-Wredundant-decls]
|  extern size_t strlcpy(char *dest, const char *src, size_t size);
               ^

This is after commit 61a6445e463a31 ("tools lib: Guard the strlcpy() header with __GLIBC__"). While the commit was right in theory, issue is uClibc also defines __GLIBC__ for application headers.

Quoted 4 lines
Quoted 2 lines

Instead of reverting the commit, manually revert with some addeed commentary to same effect.

Well, you can't revert it, as this will make it break elsewhere.

Just curious, your last change to use ifdef GLIBC vs. ifndef UCLIBC was just a preventive fix or was it addressing something reported.

Quoted 6 lines

So
please check if

#if defined(__GLIBC__) && !defined(__UCLIBC__)

suits uclibc.

Yes that works as well - I'll send a v2.

Quoted 4 lines

Are you aware of any readily available tarball or docker image that has a uclibc based devel env that I could grab? I'd add it to my build setup to make sure I (and my downstreamers) don't break uclibc environments in the future.

A prebuilt toolchain would just suffice.

https://github.com/foss-for-synopsys-dwc-arc-processors/toolchain/releases/download/arc-2016.03/arc_gnu_2016.03_prebuilt_uclibc_le_archs_linux_install.tar.gz

Thx,
-Vineet

#3 lore raw

Em Thu, Aug 18, 2016 at 09:03:08AM -0700, Vineet Gupta escreveu:

Quoted 19 lines · Arnaldo Carvalho de Melo
Quoted 18 lines

Em Wed, Aug 17, 2016 at 01:00:50PM -0700, Vineet Gupta escreveu:

Quoted 17 lines

perf tools build in recent kernels spews splat when cross compiling with uClibc

|   CC       util/alias.o
| In file included from tools/perf/util/../ui/../util/cache.h:8:0,
|                 from tools/perf/util/../ui/helpline.h:7,
|                 from tools/perf/util/debug.h:8,
|                 from arch/../util/cpumap.h:9,
|                 from arch/../util/env.h:5,
|                 from arch/common.h:4,
|                 from arch/common.c:3:
| tools/include/linux/string.h:12:15: warning: redundant redeclaration of ?strlcpy? [-Wredundant-decls]
|  extern size_t strlcpy(char *dest, const char *src, size_t size);
               ^

This is after commit 61a6445e463a31 ("tools lib: Guard the strlcpy() header with __GLIBC__"). While the commit was right in theory, issue is uClibc also defines __GLIBC__ for application headers.

Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

Instead of reverting the commit, manually revert with some addeed commentary to same effect.

Well, you can't revert it, as this will make it break elsewhere.

Just curious, your last change to use ifdef GLIBC vs. ifndef UCLIBC was just a preventive fix or was it addressing something reported.

Lets see, applying your revert and starting a build on the 30 docker images I have for building perf I get... Hey, lucky me, the first one already bombs, its alpine Linux, that comes with musl libc, see below, I'll let it continue building to see if some other target explodes:

[root at jouet ~]# time dm
1 11.315522963 alpine:3.4: FAIL
make: Entering directory '/git/linux/tools/perf'
BUILD: Doing 'make -j4' parallel build

Auto-detecting system features:
... dwarf: [ OFF ]
... dwarf_getlocations: [ OFF ]
... glibc: [ OFF ]
... gtk2: [ on ]
... libaudit: [ OFF ]

...                        libbfd: [ on  ]
...                        libelf: [ on  ]
...                       libnuma: [ OFF ]
...        numa_num_possible_cpus: [ OFF ]
...                       libperl: [ on  ]
...                     libpython: [ on  ]
...                      libslang: [ on  ]
...                     libcrypto: [ on  ]
...                     libunwind: [ OFF ]
...            libdw-dwarf-unwind: [ OFF ]
...                          zlib: [ on  ]
...                          lzma: [ on  ]
...                     get_cpuid: [ on  ]
...                           bpf: [ on  ]

Makefile.config:279: No libdw DWARF unwind found, Please install elfutils-devel/libdw-dev >= 0.158 and/or set LIBDW_DIR Makefile.config:283: No libdw.h found or old libdw.h found or elfutils is older than 0.138, disables dwarf support. Please install new elfutils-devel/libdw-dev Makefile.config:315: gelf_getnote() not found on libelf, SDT support disabled
Makefile.config:352: DWARF support is off, BPF prologue is disabled
Makefile.config:360: No sys/sdt.h found, no SDT events are defined, please install systemtap-sdt-devel or systemtap-sdt-dev Makefile.config:406: No libunwind found. Please install libunwind-dev[el] >= 1.1 and/or set LIBUNWIND_DIR
Makefile.config:433: Disabling post unwind, no support found.
Makefile.config:479: No libaudit.h found, disables 'trace' tool, please install audit-libs-devel or libaudit-dev
Makefile.config:693: No numa.h found, disables 'perf bench numa mem' benchmark, please install numactl-devel/libnuma-devel/libnuma-dev
GEN /tmp/build/perf/common-cmds.h
Warning: x86_64's syscall_64.tbl differs from kernel

  CC       /tmp/build/perf/fixdep.o
  LD       /tmp/build/perf/fixdep-in.o
  LINK     /tmp/build/perf/fixdep
  MKDIR    /tmp/build/perf/fd/
  CC       /tmp/build/perf/exec-cmd.o
  CC       /tmp/build/perf/fd/array.o
  CC       /tmp/build/perf/event-parse.o
  LD       /tmp/build/perf/fd/libapi-in.o
  MKDIR    /tmp/build/perf/fs/
  CC       /tmp/build/perf/fs/fs.o
  CC       /tmp/build/perf/help.o
  MKDIR    /tmp/build/perf/fs/
  CC       /tmp/build/perf/fs/tracing_path.o
In file included from fs/tracing_path.c:8:0:
/git/linux/tools/include/linux/string.h:17:15: error: redundant redeclaration of 'strlcpy' [-Werror=redundant-decls]
 extern size_t strlcpy(char *dest, const char *src, size_t size);
               ^
In file included from fs/tracing_path.c:7:0:
/usr/include/string.h:84:8: note: previous declaration of 'strlcpy' was here
 size_t strlcpy (char *, const char *, size_t);
        ^

cc1: all warnings being treated as errors
mv: can't rename '/tmp/build/perf/fs/.tracing_path.o.tmp': No such file or directory /git/linux/tools/build/Makefile.build:77: recipe for target '/tmp/build/perf/fs/tracing_path.o' failed make[4]: *** [/tmp/build/perf/fs/tracing_path.o] Error 1 /git/linux/tools/build/Makefile.build:116: recipe for target 'fs' failed
make[3]: *** [fs] Error 2
Makefile:43: recipe for target '/tmp/build/perf/libapi-in.o' failed
make[2]: *** [/tmp/build/perf/libapi-in.o] Error 2
Makefile.perf:546: recipe for target '/tmp/build/perf/libapi.a' failed
make[1]: *** [/tmp/build/perf/libapi.a] Error 2
make[1]: *** Waiting for unfinished jobs....

  CC       /tmp/build/perf/pager.o
  CC       /tmp/build/perf/parse-options.o
  CC       /tmp/build/perf/run-command.o

PERF_VERSION = 4.8.0-rc2
CC /tmp/build/perf/sigchain.o
In file included from run-command.c:6:0:
/git/linux/tools/include/linux/string.h:17:15: error: redundant redeclaration of 'strlcpy' [-Werror=redundant-decls]

 extern size_t strlcpy(char *dest, const char *src, size_t size);
               ^
In file included from run-command.c:5:0:
/usr/include/string.h:84:8: note: previous declaration of 'strlcpy' was here
 size_t strlcpy (char *, const char *, size_t);
        ^
  CC       /tmp/build/perf/event-plugin.o
  CC       /tmp/build/perf/subcmd-config.o
  CC       /tmp/build/perf/trace-seq.o

cc1: all warnings being treated as errors
mv: can't rename '/tmp/build/perf/.run-command.o.tmp': No such file or directory /git/linux/tools/build/Makefile.build:77: recipe for target '/tmp/build/perf/run-command.o' failed make[3]: *** [/tmp/build/perf/run-command.o] Error 1
make[3]: *** Waiting for unfinished jobs....

  CC       /tmp/build/perf/parse-filter.o
  CC       /tmp/build/perf/parse-utils.o
  CC       /tmp/build/perf/kbuffer-parse.o
  LD       /tmp/build/perf/libtraceevent-in.o
  LINK     /tmp/build/perf/libtraceevent.a

Makefile:45: recipe for target '/tmp/build/perf/libsubcmd-in.o' failed make[2]: *** [/tmp/build/perf/libsubcmd-in.o] Error 2 Makefile.perf:560: recipe for target '/tmp/build/perf/libsubcmd.a' failed make[1]: *** [/tmp/build/perf/libsubcmd.a] Error 2 Makefile:68: recipe for target 'all' failed
make: *** [all] Error 2
make: Leaving directory '/git/linux/tools/perf'
-----------------------------------------------------------------------------
2 27.319840639 android-ndk:r12b-arm: Ok
3 79.233901230 archlinux:latest: Ok
4: centos:5...

#4 lore raw
In reply to Vineet Gupta

Em Thu, Aug 18, 2016 at 09:03:08AM -0700, Vineet Gupta escreveu:

Quoted 9 lines · Arnaldo Carvalho de Melo
Quoted 4 lines

Are you aware of any readily available tarball or docker image that has a uclibc based devel env that I could grab? I'd add it to my build setup to make sure I (and my downstreamers) don't break uclibc environments in the future.

A prebuilt toolchain would just suffice.

https://github.com/foss-for-synopsys-dwc-arc-processors/toolchain/releases/download/arc-2016.03/arc_gnu_2016.03_prebuilt_uclibc_le_archs_linux_install.tar.gz

So, I did just that, from now on, before pushing things to Ingo, that prebuilt toolchain will be used in a docker container, please take a look at the Dockerfile and see if there is something missing from the cross build make command line:

# -------------------- 8< ------------------------------- # docker.io/acmel/linux-perf-tools-build-fedora:24-x-ARC-uClibc FROM docker.io/fedora:24
MAINTAINER Arnaldo Carvalho de Melo <acme at kernel.org> ENV TOOLCHAIN=arc_gnu_2016.03_prebuilt_uclibc_le_archs_linux_install

RUN SOURCEFILE=${TOOLCHAIN}.tar.gz && \
    dnf -y install make flex bison tar gzip && \
    dnf -y clean all && \
    mkdir -m 777 -p /tmp/build/perf && \
    curl -OL https://github.com/foss-for-synopsys-dwc-arc-processors/toolchain/releases/download/arc-2016.03/${SOURCEFILE} && \
    tar xf ${SOURCEFILE} && \
    rm -f ${SOURCEFILE} && \
    groupadd -r perfbuilder && \
    useradd -r -g perfbuilder perfbuilder

USER perfbuilder
ENTRYPOINT make -C /git/linux/tools/perf O=/tmp/build/perf ARCH=arc CROSS_COMPILE=/${TOOLCHAIN}/bin/arc-linux- # -------------------- 8< -------------------------------

Do I have to pass some extra flags? Perhaps for sysroot?

With the above I get:

  # dm fedora:24-x-ARC-uClibc
  1: 29.108592825 fedora:24-x-ARC-uClibc: Ok
  # 

Which selected these features:

make: Entering directory '/git/linux/tools/perf'
BUILD: Doing 'make -j4' parallel build
sh: line 0: command: -c: invalid option
command: usage: command [-pVv] command [arg ...]

Auto-detecting system features:
... dwarf: [ OFF ]
... dwarf_getlocations: [ OFF ]
... glibc: [ on ]
... gtk2: [ OFF ]
... libaudit: [ OFF ]
... libbfd: [ OFF ]
... libelf: [ OFF ]
... libnuma: [ OFF ]
... numa_num_possible_cpus: [ OFF ]
... libperl: [ OFF ]
... libpython: [ OFF ]
... libslang: [ OFF ]
... libcrypto: [ OFF ]
... libunwind: [ OFF ]
... libdw-dwarf-unwind: [ OFF ]
... zlib: [ OFF ]
... lzma: [ OFF ]
... get_cpuid: [ OFF ]
... bpf: [ on ]

Makefile.config:260: No libelf found, disables 'probe' tool and BPF support in 'perf record', please install libelf-dev, libelf-devel or elfutils-libelf-devel Makefile.config:360: No sys/sdt.h found, no SDT events are defined, please install systemtap-sdt-devel or systemtap-sdt-dev Makefile.config:433: Disabling post unwind, no support found.
Makefile.config:479: No libaudit.h found, disables 'trace' tool, please install audit-libs-devel or libaudit-dev Makefile.config:490: No libcrypto.h found, disables jitted code injection, please install libssl-devel or libssl-dev Makefile.config:505: slang not found, disables TUI support. Please install slang-devel, libslang-dev or libslang2-dev Makefile.config:519: GTK2 not found, disables GTK2 support. Please install gtk2-devel or libgtk2.0-dev
Makefile.config:547: Missing perl devel files. Disabling perl scripting support, please install perl-ExtUtils-Embed/libperl-dev Makefile.config:573: No python interpreter was found: disables Python support - please install python-devel/python-dev Makefile.config:680: No liblzma found, disables xz kernel module decompression, please install xz-devel/liblzma-dev Makefile.config:693: No numa.h found, disables 'perf bench numa mem' benchmark, please install numactl-devel/libnuma-devel/libnuma-dev Makefile.config:750: Your gcc lacks the __get_cpuid() builtin, disables support for auxtrace/Intel PT, please install a newer gcc

- Arnaldo

#5 lore raw
Quoted 30 lines · Arnaldo Carvalho de Melo

Em Thu, Aug 18, 2016 at 09:03:08AM -0700, Vineet Gupta escreveu:

Quoted 9 lines · Arnaldo Carvalho de Melo
Quoted 4 lines

Are you aware of any readily available tarball or docker image that has a uclibc based devel env that I could grab? I'd add it to my build setup to make sure I (and my downstreamers) don't break uclibc environments in the future.

A prebuilt toolchain would just suffice.

https://github.com/foss-for-synopsys-dwc-arc-processors/toolchain/releases/download/arc-2016.03/arc_gnu_2016.03_prebuilt_uclibc_le_archs_linux_install.tar.gz

So, I did just that, from now on, before pushing things to Ingo, that prebuilt toolchain will be used in a docker container, please take a look at the Dockerfile and see if there is something missing from the cross build make command line:

# -------------------- 8< ------------------------------- # docker.io/acmel/linux-perf-tools-build-fedora:24-x-ARC-uClibc FROM docker.io/fedora:24
MAINTAINER Arnaldo Carvalho de Melo <acme at kernel.org> ENV TOOLCHAIN=arc_gnu_2016.03_prebuilt_uclibc_le_archs_linux_install

RUN SOURCEFILE=${TOOLCHAIN}.tar.gz && \
    dnf -y install make flex bison tar gzip && \
    dnf -y clean all && \
    mkdir -m 777 -p /tmp/build/perf && \
    curl -OL https://github.com/foss-for-synopsys-dwc-arc-processors/toolchain/releases/download/arc-2016.03/${SOURCEFILE} && \
    tar xf ${SOURCEFILE} && \
    rm -f ${SOURCEFILE} && \
    groupadd -r perfbuilder && \
    useradd -r -g perfbuilder perfbuilder
Quoted 2 lines

USER perfbuilder
ENTRYPOINT make -C /git/linux/tools/perf O=/tmp/build/perf ARCH=arc CROSS_COMPILE=/${TOOLCHAIN}/bin/arc-linux-

This is interesting. I thought CROSS_COMPILE provided the prefixes to make vars and that PATH was still needed. But good if this works too so u don't have to fudge PATH with ARC tools in your env.

Quoted 3 lines

# -------------------- 8< -------------------------------

Do I have to pass some extra flags? Perhaps for sysroot?

No - the default sysroot just works.

Quoted 35 lines

With the above I get:

  # dm fedora:24-x-ARC-uClibc
  1: 29.108592825 fedora:24-x-ARC-uClibc: Ok
  # 

Which selected these features:

make: Entering directory '/git/linux/tools/perf'
BUILD: Doing 'make -j4' parallel build
sh: line 0: command: -c: invalid option
command: usage: command [-pVv] command [arg ...]

Auto-detecting system features:
... dwarf: [ OFF ]
... dwarf_getlocations: [ OFF ]
... glibc: [ on ]
... gtk2: [ OFF ]
... libaudit: [ OFF ]
... libbfd: [ OFF ]
... libelf: [ OFF ]
... libnuma: [ OFF ]
... numa_num_possible_cpus: [ OFF ]
... libperl: [ OFF ]
... libpython: [ OFF ]
... libslang: [ OFF ]
... libcrypto: [ OFF ]
... libunwind: [ OFF ]
... libdw-dwarf-unwind: [ OFF ]
... zlib: [ OFF ]
... lzma: [ OFF ]
... get_cpuid: [ OFF ]
... bpf: [ on ]

Quoted 12 lines

Makefile.config:260: No libelf found, disables 'probe' tool and BPF support in 'perf record', please install libelf-dev, libelf-devel or elfutils-libelf-devel Makefile.config:360: No sys/sdt.h found, no SDT events are defined, please install systemtap-sdt-devel or systemtap-sdt-dev Makefile.config:433: Disabling post unwind, no support found.
Makefile.config:479: No libaudit.h found, disables 'trace' tool, please install audit-libs-devel or libaudit-dev Makefile.config:490: No libcrypto.h found, disables jitted code injection, please install libssl-devel or libssl-dev Makefile.config:505: slang not found, disables TUI support. Please install slang-devel, libslang-dev or libslang2-dev Makefile.config:519: GTK2 not found, disables GTK2 support. Please install gtk2-devel or libgtk2.0-dev
Makefile.config:547: Missing perl devel files. Disabling perl scripting support, please install perl-ExtUtils-Embed/libperl-dev Makefile.config:573: No python interpreter was found: disables Python support - please install python-devel/python-dev Makefile.config:680: No liblzma found, disables xz kernel module decompression, please install xz-devel/liblzma-dev Makefile.config:693: No numa.h found, disables 'perf bench numa mem' benchmark, please install numactl-devel/libnuma-devel/libnuma-dev Makefile.config:750: Your gcc lacks the __get_cpuid() builtin, disables support for auxtrace/Intel PT, please install a newer gcc

Awesome - I presume it ran to completion and builds perf successfully.

Thx a bunch for doing this Arnaldo - CROSS build and uclibc had a tendency to break here and there so this will catch errors early.

-Vineet

#6 lore raw

Em Fri, Aug 19, 2016 at 11:01:49AM -0700, Vineet Gupta escreveu:

Quoted 1 line

Awesome - I presume it ran to completion and builds perf successfully.

Right, see full logs below.

But one question: when you test build, do you have any extra devel packages installed besides what is in this prebuilt toolchain tarball?

I'll add at least zlib and elfutils to the mix, building it in the docker image creation process, and then testing with/without NO_LIBELF=1, as I do to other cross-building images:

Quoted 2 lines

Thx a bunch for doing this Arnaldo - CROSS build and uclibc had a tendency to break here and there so this will catch errors early.

Hopefully this is something of the past :-)

- Arnaldo

fedora:24-x-ARC-uClibc
make: Entering directory '/git/linux/tools/perf'
BUILD: Doing 'make -j4' parallel build
sh: line 0: command: -c: invalid option
command: usage: command [-pVv] command [arg ...]

Auto-detecting system features:
... dwarf: [ OFF ]
... dwarf_getlocations: [ OFF ]
... glibc: [ on ]
... gtk2: [ OFF ]
... libaudit: [ OFF ]
... libbfd: [ OFF ]
... libelf: [ OFF ]
... libnuma: [ OFF ]
... numa_num_possible_cpus: [ OFF ]
... libperl: [ OFF ]
... libpython: [ OFF ]
... libslang: [ OFF ]
... libcrypto: [ OFF ]
... libunwind: [ OFF ]
... libdw-dwarf-unwind: [ OFF ]
... zlib: [ OFF ]
... lzma: [ OFF ]
... get_cpuid: [ OFF ]
... bpf: [ on ]

Makefile.config:260: No libelf found, disables 'probe' tool and BPF support in 'perf record', please install libelf-dev, libelf-devel or elfutils-libelf-devel Makefile.config:360: No sys/sdt.h found, no SDT events are defined, please install systemtap-sdt-devel or systemtap-sdt-dev Makefile.config:433: Disabling post unwind, no support found.
Makefile.config:479: No libaudit.h found, disables 'trace' tool, please install audit-libs-devel or libaudit-dev Makefile.config:490: No libcrypto.h found, disables jitted code injection, please install libssl-devel or libssl-dev Makefile.config:505: slang not found, disables TUI support. Please install slang-devel, libslang-dev or libslang2-dev Makefile.config:519: GTK2 not found, disables GTK2 support. Please install gtk2-devel or libgtk2.0-dev
Makefile.config:547: Missing perl devel files. Disabling perl scripting support, please install perl-ExtUtils-Embed/libperl-dev Makefile.config:573: No python interpreter was found: disables Python support - please install python-devel/python-dev Makefile.config:680: No liblzma found, disables xz kernel module decompression, please install xz-devel/liblzma-dev Makefile.config:693: No numa.h found, disables 'perf bench numa mem' benchmark, please install numactl-devel/libnuma-devel/libnuma-dev Makefile.config:750: Your gcc lacks the __get_cpuid() builtin, disables support for auxtrace/Intel PT, please install a newer gcc

  GEN      /tmp/build/perf/common-cmds.h
  MKDIR    /tmp/build/perf/fd/
  CC       /tmp/build/perf/fd/array.o
  CC       /tmp/build/perf/event-parse.o
  CC       /tmp/build/perf/exec-cmd.o
  LD       /tmp/build/perf/fd/libapi-in.o
  MKDIR    /tmp/build/perf/fs/
  CC       /tmp/build/perf/fs/fs.o
  CC       /tmp/build/perf/help.o
  MKDIR    /tmp/build/perf/fs/
  CC       /tmp/build/perf/fs/tracing_path.o
  LD       /tmp/build/perf/fs/libapi-in.o
  PERF_VERSION = 4.8.0-rc2
  CC       /tmp/build/perf/cpu.o
  CC       /tmp/build/perf/pager.o
  CC       /tmp/build/perf/plugin_jbd2.o
  CC       /tmp/build/perf/debug.o
  LD       /tmp/build/perf/plugin_jbd2-in.o
  CC       /tmp/build/perf/plugin_hrtimer.o
  CC       /tmp/build/perf/str_error_r.o
  CC       /tmp/build/perf/parse-options.o
  LD       /tmp/build/perf/libapi-in.o
  LD       /tmp/build/perf/plugin_hrtimer-in.o
  AR       /tmp/build/perf/libapi.a
  CC       /tmp/build/perf/plugin_kmem.o
  GEN      perf-archive
  GEN      perf-with-kcore
  MKDIR    /tmp/build/perf/util/
  LD       /tmp/build/perf/plugin_kmem-in.o
  CC       /tmp/build/perf/util/alias.o
  CC       /tmp/build/perf/plugin_kvm.o
  LD       /tmp/build/perf/plugin_kvm-in.o
  CC       /tmp/build/perf/plugin_mac80211.o
  CC       /tmp/build/perf/event-plugin.o
  MKDIR    /tmp/build/perf/util/
  LD       /tmp/build/perf/plugin_mac80211-in.o
  CC       /tmp/build/perf/plugin_sched_switch.o
  CC       /tmp/build/perf/util/annotate.o
  CC       /tmp/build/perf/trace-seq.o
  CC       /tmp/build/perf/parse-filter.o
  LD       /tmp/build/perf/plugin_sched_switch-in.o
  CC       /tmp/build/perf/plugin_function.o
  LD       /tmp/build/perf/plugin_function-in.o
  CC       /tmp/build/perf/plugin_xen.o
  LD       /tmp/build/perf/plugin_xen-in.o
  CC       /tmp/build/perf/plugin_scsi.o
  CC       /tmp/build/perf/parse-utils.o
  LD       /tmp/build/perf/plugin_scsi-in.o
  CC       /tmp/build/perf/plugin_cfg80211.o
  CC       /tmp/build/perf/kbuffer-parse.o
  CC       /tmp/build/perf/run-command.o
  LD       /tmp/build/perf/plugin_cfg80211-in.o
  LINK     /tmp/build/perf/plugin_jbd2.so
  LINK     /tmp/build/perf/plugin_hrtimer.so
  LD       /tmp/build/perf/libtraceevent-in.o
  LINK     /tmp/build/perf/libtraceevent.a
  LINK     /tmp/build/perf/plugin_kmem.so
  LINK     /tmp/build/perf/plugin_kvm.so
  LINK     /tmp/build/perf/plugin_mac80211.so
  LINK     /tmp/build/perf/plugin_sched_switch.so
  LINK     /tmp/build/perf/plugin_function.so
  LINK     /tmp/build/perf/plugin_xen.so
  LINK     /tmp/build/perf/plugin_scsi.so
  CC       /tmp/build/perf/sigchain.o
  LINK     /tmp/build/perf/plugin_cfg80211.so
  GEN      /tmp/build/perf/libtraceevent-dynamic-list
  CC       /tmp/build/perf/util/build-id.o
  CC       /tmp/build/perf/subcmd-config.o
  LD       /tmp/build/perf/libsubcmd-in.o
  AR       /tmp/build/perf/libsubcmd.a
  CC       /tmp/build/perf/util/config.o
  CC       /tmp/build/perf/builtin-bench.o
  CC       /tmp/build/perf/builtin-annotate.o
  CC       /tmp/build/perf/util/ctype.o
  CC       /tmp/build/perf/util/db-export.o
  CC       /tmp/build/perf/util/env.o
  CC       /tmp/build/perf/util/event.o
  CC       /tmp/build/perf/builtin-config.o
  CC       /tmp/build/perf/util/evlist.o
  CC       /tmp/build/perf/builtin-diff.o
  CC       /tmp/build/perf/util/evsel.o
  CC       /tmp/build/perf/util/evsel_fprintf.o
  CC       /tmp/build/perf/util/find_bit.o
  CC       /tmp/build/perf/builtin-evlist.o
  CC       /tmp/build/perf/util/kallsyms.o
  CC       /tmp/build/perf/util/levenshtein.o
  CC       /tmp/build/perf/builtin-help.o
  CC       /tmp/build/perf/util/llvm-utils.o
  MKDIR    /tmp/build/perf/arch/
  CC       /tmp/build/perf/arch/common.o
  BISON    /tmp/build/perf/util/parse-events-bison.c
  MKDIR    /tmp/build/perf/arch/arc/
  LD       /tmp/build/perf/arch/arc/libperf-in.o
  LD       /tmp/build/perf/arch/libperf-in.o
  MKDIR    /tmp/build/perf/ui/
  CC       /tmp/build/perf/builtin-sched.o
  CC       /tmp/build/perf/ui/setup.o
  MKDIR    /tmp/build/perf/ui/
  CC       /tmp/build/perf/ui/helpline.o
  CC       /tmp/build/perf/util/perf_regs.o
  CC       /tmp/build/perf/ui/progress.o
  CC       /tmp/build/perf/util/path.o
  CC       /tmp/build/perf/ui/util.o
  CC       /tmp/build/perf/ui/hist.o
  CC       /tmp/build/perf/util/rbtree.o
  MKDIR    /tmp/build/perf/ui/stdio/
  CC       /tmp/build/perf/ui/stdio/hist.o
  CC       /tmp/build/perf/util/libstring.o
  CC       /tmp/build/perf/util/bitmap.o
  CC       /tmp/build/perf/util/hweight.o
  CC       /tmp/build/perf/util/quote.o
  CC       /tmp/build/perf/util/strbuf.o
  CC       /tmp/build/perf/util/string.o
  CC       /tmp/build/perf/util/strlist.o
  CC       /tmp/build/perf/util/strfilter.o
  CC       /tmp/build/perf/util/top.o
  MKDIR    /tmp/build/perf/scripts/
  LD       /tmp/build/perf/scripts/libperf-in.o
  CC       /tmp/build/perf/builtin-buildid-list.o
  CC       /tmp/build/perf/util/usage.o
  CC       /tmp/build/perf/builtin-buildid-cache.o
  CC       /tmp/build/perf/util/dso.o
  CC       /tmp/build/perf/builtin-list.o
  CC       /tmp/build/perf/builtin-record.o
  CC       /tmp/build/perf/builtin-report.o
  LD       /tmp/build/perf/ui/libperf-in.o
  CC       /tmp/build/perf/builtin-stat.o
  CC       /tmp/build/perf/util/symbol.o
  CC       /tmp/build/perf/builtin-timechart.o
  CC       /tmp/build/perf/builtin-top.o
  CC       /tmp/build/perf/util/symbol_fprintf.o
  CC       /tmp/build/perf/util/color.o
  CC       /tmp/build/perf/builtin-script.o
  CC       /tmp/build/perf/util/header.o
  CC       /tmp/build/perf/builtin-kmem.o
  CC       /tmp/build/perf/builtin-lock.o
  CC       /tmp/build/perf/builtin-kvm.o
  CC       /tmp/build/perf/builtin-inject.o
  CC       /tmp/build/perf/builtin-mem.o
  CC       /tmp/build/perf/util/callchain.o
  CC       /tmp/build/perf/builtin-data.o
  CC       /tmp/build/perf/builtin-version.o
  MKDIR    /tmp/build/perf/bench/
  CC       /tmp/build/perf/bench/sched-messaging.o
  MKDIR    /tmp/build/perf/tests/
  CC       /tmp/build/perf/tests/builtin-test.o
  CC       /tmp/build/perf/util/values.o
  MKDIR    /tmp/build/perf/bench/
  CC       /tmp/build/perf/bench/sched-pipe.o
  MKDIR    /tmp/build/perf/tests/
  CC       /tmp/build/perf/tests/parse-events.o
  CC       /tmp/build/perf/util/debug.o
  CC       /tmp/build/perf/bench/mem-functions.o
  CC       /tmp/build/perf/util/machine.o
  CC       /tmp/build/perf/bench/futex-hash.o
  CC       /tmp/build/perf/bench/futex-wake.o
  CC       /tmp/build/perf/bench/futex-wake-parallel.o
  CC       /tmp/build/perf/bench/futex-requeue.o
  CC       /tmp/build/perf/bench/futex-lock-pi.o
  CC       /tmp/build/perf/util/map.o
  LD       /tmp/build/perf/bench/perf-in.o
  CC       /tmp/build/perf/perf.o
  CC       /tmp/build/perf/util/pstack.o
  CC       /tmp/build/perf/util/session.o
  CC       /tmp/build/perf/util/ordered-events.o
  CC       /tmp/build/perf/util/comm.o
  CC       /tmp/build/perf/util/thread.o
  CC       /tmp/build/perf/util/thread_map.o
  CC       /tmp/build/perf/util/trace-event-parse.o
  CC       /tmp/build/perf/tests/dso-data.o
  CC       /tmp/build/perf/util/parse-events-bison.o
  BISON    /tmp/build/perf/util/pmu-bison.c
  CC       /tmp/build/perf/util/trace-event-read.o
  CC       /tmp/build/perf/tests/attr.o
  CC       /tmp/build/perf/tests/vmlinux-kallsyms.o
  CC       /tmp/build/perf/util/trace-event-info.o
  CC       /tmp/build/perf/util/trace-event-scripting.o
  CC       /tmp/build/perf/tests/openat-syscall.o
  CC       /tmp/build/perf/util/trace-event.o
  CC       /tmp/build/perf/tests/openat-syscall-all-cpus.o
  CC       /tmp/build/perf/util/svghelper.o
  CC       /tmp/build/perf/util/sort.o
  CC       /tmp/build/perf/util/hist.o
  CC       /tmp/build/perf/tests/openat-syscall-tp-fields.o
  CC       /tmp/build/perf/tests/mmap-basic.o
  CC       /tmp/build/perf/tests/perf-record.o
  CC       /tmp/build/perf/util/util.o
  CC       /tmp/build/perf/tests/evsel-roundtrip-name.o
  CC       /tmp/build/perf/tests/evsel-tp-sched.o
  CC       /tmp/build/perf/tests/fdarray.o
  CC       /tmp/build/perf/tests/pmu.o
  CC       /tmp/build/perf/tests/hists_common.o
  CC       /tmp/build/perf/tests/hists_link.o
  CC       /tmp/build/perf/tests/hists_filter.o
  CC       /tmp/build/perf/util/xyarray.o
  CC       /tmp/build/perf/util/cpumap.o
  CC       /tmp/build/perf/tests/hists_output.o
  CC       /tmp/build/perf/util/cgroup.o
  CC       /tmp/build/perf/tests/hists_cumulate.o
  CC       /tmp/build/perf/util/target.o
  CC       /tmp/build/perf/util/rblist.o
  CC       /tmp/build/perf/util/intlist.o
  CC       /tmp/build/perf/util/vdso.o
  CC       /tmp/build/perf/tests/python-use.o
  CC       /tmp/build/perf/tests/bp_signal.o
  CC       /tmp/build/perf/tests/bp_signal_overflow.o
  CC       /tmp/build/perf/util/counts.o
  CC       /tmp/build/perf/tests/task-exit.o
  CC       /tmp/build/perf/tests/sw-clock.o
  CC       /tmp/build/perf/tests/mmap-thread-lookup.o
  CC       /tmp/build/perf/util/stat.o
  CC       /tmp/build/perf/tests/thread-mg-share.o
  CC       /tmp/build/perf/tests/switch-tracking.o
  CC       /tmp/build/perf/tests/keep-tracking.o
  CC       /tmp/build/perf/tests/code-reading.o
  CC       /tmp/build/perf/tests/sample-parsing.o
  CC       /tmp/build/perf/util/stat-shadow.o
  CC       /tmp/build/perf/tests/parse-no-sample-id-all.o
  CC       /tmp/build/perf/tests/kmod-path.o
  CC       /tmp/build/perf/tests/thread-map.o
  CC       /tmp/build/perf/tests/llvm.o
  CC       /tmp/build/perf/util/record.o
  CC       /tmp/build/perf/tests/bpf.o
  CC       /tmp/build/perf/util/srcline.o
  CC       /tmp/build/perf/tests/topology.o
  CC       /tmp/build/perf/tests/cpumap.o
  CC       /tmp/build/perf/util/data.o
  CC       /tmp/build/perf/util/tsc.o
  CC       /tmp/build/perf/tests/stat.o
  CC       /tmp/build/perf/tests/event_update.o
  CC       /tmp/build/perf/util/cloexec.o
  CC       /tmp/build/perf/util/call-path.o
  CC       /tmp/build/perf/tests/event-times.o
  CC       /tmp/build/perf/util/thread-stack.o
  CC       /tmp/build/perf/util/parse-branch-options.o
  CC       /tmp/build/perf/tests/backward-ring-buffer.o
  CC       /tmp/build/perf/util/parse-regs-options.o
  CC       /tmp/build/perf/tests/sdt.o
  CC       /tmp/build/perf/util/term.o
  CC       /tmp/build/perf/tests/is_printable_array.o
  CC       /tmp/build/perf/tests/bitmap.o
  CC       /tmp/build/perf/util/help-unknown-cmd.o
  CC       /tmp/build/perf/tests/llvm-src-base.o
  CC       /tmp/build/perf/tests/llvm-src-kbuild.o
  CC       /tmp/build/perf/util/mem-events.o
  CC       /tmp/build/perf/tests/llvm-src-prologue.o
  CC       /tmp/build/perf/tests/llvm-src-relocation.o
  CC       /tmp/build/perf/util/vsprintf.o
  CC       /tmp/build/perf/util/symbol-minimal.o
  LD       /tmp/build/perf/tests/perf-in.o
  MKDIR    /tmp/build/perf/util/scripting-engines/
  LD       /tmp/build/perf/util/scripting-engines/libperf-in.o
  CC       /tmp/build/perf/util/demangle-java.o
  LD       /tmp/build/perf/perf-in.o
  CC       /tmp/build/perf/util/demangle-rust.o
  FLEX     /tmp/build/perf/util/parse-events-flex.c
  FLEX     /tmp/build/perf/util/pmu-flex.c
  CC       /tmp/build/perf/util/pmu-bison.o
  CC       /tmp/build/perf/util/parse-events.o
  CC       /tmp/build/perf/util/parse-events-flex.o
  CC       /tmp/build/perf/util/pmu.o
  CC       /tmp/build/perf/util/pmu-flex.o
  LD       /tmp/build/perf/util/libperf-in.o
  LD       /tmp/build/perf/libperf-in.o
  AR       /tmp/build/perf/libperf.a
  LINK     /tmp/build/perf/perf

make: Leaving directory '/git/linux/tools/perf'
fedora:24-x-ARC-uClibc: Ok

#7 lore raw
Quoted 3 lines · Arnaldo Carvalho de Melo

.
But one question: when you test build, do you have any extra devel packages installed besides what is in this prebuilt toolchain tarball?

No - not when doing this with minimal cross tools - we do have Buildroot where libelf and zlib as cross devel packages.

Quoted 3 lines

I'll add at least zlib and elfutils to the mix, building it in the docker image creation process, and then testing with/without NO_LIBELF=1, as I do to other cross-building images:

But that won't work with tools you got now - I can have someone provide you prebuilt tools off of Buildroot with those packages included. Or if you could be arsed that is really easy to do off upstream buildroot :-)

Quoted 4 lines
Quoted 3 lines

Thx a bunch for doing this Arnaldo - CROSS build and uclibc had a tendency to break here and there so this will catch errors early.

Hopefully this is something of the past :-)

Cool stuff - thx once again !

-Vineet

#8 lore raw
In reply to Arnaldo Carvalho de Melo

Em Fri, Aug 19, 2016 at 04:23:02PM -0300, Arnaldo Carvalho de Melo escreveu:

Quoted 11 lines

Em Fri, Aug 19, 2016 at 11:01:49AM -0700, Vineet Gupta escreveu:

Quoted 1 line

Awesome - I presume it ran to completion and builds perf successfully.

Right, see full logs below.

But one question: when you test build, do you have any extra devel packages installed besides what is in this prebuilt toolchain tarball?

I'll add at least zlib and elfutils to the mix, building it in the docker image creation process, and then testing with/without NO_LIBELF=1, as I do to other cross-building images:

Trying to build elfutils 0.166:

checking whether gcc accepts -Wduplicated-cond... no checking whether gcc accepts -Wnull-dereference... no
configure: WARNING: "libc does not have argp" checking for argp_parse in -largp... no
configure: error: "no libargp found"

----

will go errands now, will try to check what is needed to build elfutils with uclibc, ideas?

- Arnaldo

Quoted 316 lines
Quoted 2 lines

Thx a bunch for doing this Arnaldo - CROSS build and uclibc had a tendency to break here and there so this will catch errors early.

Hopefully this is something of the past :-)

- Arnaldo

fedora:24-x-ARC-uClibc
make: Entering directory '/git/linux/tools/perf'
BUILD: Doing 'make -j4' parallel build
sh: line 0: command: -c: invalid option
command: usage: command [-pVv] command [arg ...]

Auto-detecting system features:
... dwarf: [ OFF ]
... dwarf_getlocations: [ OFF ]
... glibc: [ on ]
... gtk2: [ OFF ]
... libaudit: [ OFF ]
... libbfd: [ OFF ]
... libelf: [ OFF ]
... libnuma: [ OFF ]
... numa_num_possible_cpus: [ OFF ]
... libperl: [ OFF ]
... libpython: [ OFF ]
... libslang: [ OFF ]
... libcrypto: [ OFF ]
... libunwind: [ OFF ]
... libdw-dwarf-unwind: [ OFF ]
... zlib: [ OFF ]
... lzma: [ OFF ]
... get_cpuid: [ OFF ]
... bpf: [ on ]

Makefile.config:260: No libelf found, disables 'probe' tool and BPF support in 'perf record', please install libelf-dev, libelf-devel or elfutils-libelf-devel Makefile.config:360: No sys/sdt.h found, no SDT events are defined, please install systemtap-sdt-devel or systemtap-sdt-dev Makefile.config:433: Disabling post unwind, no support found.
Makefile.config:479: No libaudit.h found, disables 'trace' tool, please install audit-libs-devel or libaudit-dev Makefile.config:490: No libcrypto.h found, disables jitted code injection, please install libssl-devel or libssl-dev Makefile.config:505: slang not found, disables TUI support. Please install slang-devel, libslang-dev or libslang2-dev Makefile.config:519: GTK2 not found, disables GTK2 support. Please install gtk2-devel or libgtk2.0-dev
Makefile.config:547: Missing perl devel files. Disabling perl scripting support, please install perl-ExtUtils-Embed/libperl-dev Makefile.config:573: No python interpreter was found: disables Python support - please install python-devel/python-dev Makefile.config:680: No liblzma found, disables xz kernel module decompression, please install xz-devel/liblzma-dev Makefile.config:693: No numa.h found, disables 'perf bench numa mem' benchmark, please install numactl-devel/libnuma-devel/libnuma-dev Makefile.config:750: Your gcc lacks the __get_cpuid() builtin, disables support for auxtrace/Intel PT, please install a newer gcc

  GEN      /tmp/build/perf/common-cmds.h
  MKDIR    /tmp/build/perf/fd/
  CC       /tmp/build/perf/fd/array.o
  CC       /tmp/build/perf/event-parse.o
  CC       /tmp/build/perf/exec-cmd.o
  LD       /tmp/build/perf/fd/libapi-in.o
  MKDIR    /tmp/build/perf/fs/
  CC       /tmp/build/perf/fs/fs.o
  CC       /tmp/build/perf/help.o
  MKDIR    /tmp/build/perf/fs/
  CC       /tmp/build/perf/fs/tracing_path.o
  LD       /tmp/build/perf/fs/libapi-in.o
  PERF_VERSION = 4.8.0-rc2
  CC       /tmp/build/perf/cpu.o
  CC       /tmp/build/perf/pager.o
  CC       /tmp/build/perf/plugin_jbd2.o
  CC       /tmp/build/perf/debug.o
  LD       /tmp/build/perf/plugin_jbd2-in.o
  CC       /tmp/build/perf/plugin_hrtimer.o
  CC       /tmp/build/perf/str_error_r.o
  CC       /tmp/build/perf/parse-options.o
  LD       /tmp/build/perf/libapi-in.o
  LD       /tmp/build/perf/plugin_hrtimer-in.o
  AR       /tmp/build/perf/libapi.a
  CC       /tmp/build/perf/plugin_kmem.o
  GEN      perf-archive
  GEN      perf-with-kcore
  MKDIR    /tmp/build/perf/util/
  LD       /tmp/build/perf/plugin_kmem-in.o
  CC       /tmp/build/perf/util/alias.o
  CC       /tmp/build/perf/plugin_kvm.o
  LD       /tmp/build/perf/plugin_kvm-in.o
  CC       /tmp/build/perf/plugin_mac80211.o
  CC       /tmp/build/perf/event-plugin.o
  MKDIR    /tmp/build/perf/util/
  LD       /tmp/build/perf/plugin_mac80211-in.o
  CC       /tmp/build/perf/plugin_sched_switch.o
  CC       /tmp/build/perf/util/annotate.o
  CC       /tmp/build/perf/trace-seq.o
  CC       /tmp/build/perf/parse-filter.o
  LD       /tmp/build/perf/plugin_sched_switch-in.o
  CC       /tmp/build/perf/plugin_function.o
  LD       /tmp/build/perf/plugin_function-in.o
  CC       /tmp/build/perf/plugin_xen.o
  LD       /tmp/build/perf/plugin_xen-in.o
  CC       /tmp/build/perf/plugin_scsi.o
  CC       /tmp/build/perf/parse-utils.o
  LD       /tmp/build/perf/plugin_scsi-in.o
  CC       /tmp/build/perf/plugin_cfg80211.o
  CC       /tmp/build/perf/kbuffer-parse.o
  CC       /tmp/build/perf/run-command.o
  LD       /tmp/build/perf/plugin_cfg80211-in.o
  LINK     /tmp/build/perf/plugin_jbd2.so
  LINK     /tmp/build/perf/plugin_hrtimer.so
  LD       /tmp/build/perf/libtraceevent-in.o
  LINK     /tmp/build/perf/libtraceevent.a
  LINK     /tmp/build/perf/plugin_kmem.so
  LINK     /tmp/build/perf/plugin_kvm.so
  LINK     /tmp/build/perf/plugin_mac80211.so
  LINK     /tmp/build/perf/plugin_sched_switch.so
  LINK     /tmp/build/perf/plugin_function.so
  LINK     /tmp/build/perf/plugin_xen.so
  LINK     /tmp/build/perf/plugin_scsi.so
  CC       /tmp/build/perf/sigchain.o
  LINK     /tmp/build/perf/plugin_cfg80211.so
  GEN      /tmp/build/perf/libtraceevent-dynamic-list
  CC       /tmp/build/perf/util/build-id.o
  CC       /tmp/build/perf/subcmd-config.o
  LD       /tmp/build/perf/libsubcmd-in.o
  AR       /tmp/build/perf/libsubcmd.a
  CC       /tmp/build/perf/util/config.o
  CC       /tmp/build/perf/builtin-bench.o
  CC       /tmp/build/perf/builtin-annotate.o
  CC       /tmp/build/perf/util/ctype.o
  CC       /tmp/build/perf/util/db-export.o
  CC       /tmp/build/perf/util/env.o
  CC       /tmp/build/perf/util/event.o
  CC       /tmp/build/perf/builtin-config.o
  CC       /tmp/build/perf/util/evlist.o
  CC       /tmp/build/perf/builtin-diff.o
  CC       /tmp/build/perf/util/evsel.o
  CC       /tmp/build/perf/util/evsel_fprintf.o
  CC       /tmp/build/perf/util/find_bit.o
  CC       /tmp/build/perf/builtin-evlist.o
  CC       /tmp/build/perf/util/kallsyms.o
  CC       /tmp/build/perf/util/levenshtein.o
  CC       /tmp/build/perf/builtin-help.o
  CC       /tmp/build/perf/util/llvm-utils.o
  MKDIR    /tmp/build/perf/arch/
  CC       /tmp/build/perf/arch/common.o
  BISON    /tmp/build/perf/util/parse-events-bison.c
  MKDIR    /tmp/build/perf/arch/arc/
  LD       /tmp/build/perf/arch/arc/libperf-in.o
  LD       /tmp/build/perf/arch/libperf-in.o
  MKDIR    /tmp/build/perf/ui/
  CC       /tmp/build/perf/builtin-sched.o
  CC       /tmp/build/perf/ui/setup.o
  MKDIR    /tmp/build/perf/ui/
  CC       /tmp/build/perf/ui/helpline.o
  CC       /tmp/build/perf/util/perf_regs.o
  CC       /tmp/build/perf/ui/progress.o
  CC       /tmp/build/perf/util/path.o
  CC       /tmp/build/perf/ui/util.o
  CC       /tmp/build/perf/ui/hist.o
  CC       /tmp/build/perf/util/rbtree.o
  MKDIR    /tmp/build/perf/ui/stdio/
  CC       /tmp/build/perf/ui/stdio/hist.o
  CC       /tmp/build/perf/util/libstring.o
  CC       /tmp/build/perf/util/bitmap.o
  CC       /tmp/build/perf/util/hweight.o
  CC       /tmp/build/perf/util/quote.o
  CC       /tmp/build/perf/util/strbuf.o
  CC       /tmp/build/perf/util/string.o
  CC       /tmp/build/perf/util/strlist.o
  CC       /tmp/build/perf/util/strfilter.o
  CC       /tmp/build/perf/util/top.o
  MKDIR    /tmp/build/perf/scripts/
  LD       /tmp/build/perf/scripts/libperf-in.o
  CC       /tmp/build/perf/builtin-buildid-list.o
  CC       /tmp/build/perf/util/usage.o
  CC       /tmp/build/perf/builtin-buildid-cache.o
  CC       /tmp/build/perf/util/dso.o
  CC       /tmp/build/perf/builtin-list.o
  CC       /tmp/build/perf/builtin-record.o
  CC       /tmp/build/perf/builtin-report.o
  LD       /tmp/build/perf/ui/libperf-in.o
  CC       /tmp/build/perf/builtin-stat.o
  CC       /tmp/build/perf/util/symbol.o
  CC       /tmp/build/perf/builtin-timechart.o
  CC       /tmp/build/perf/builtin-top.o
  CC       /tmp/build/perf/util/symbol_fprintf.o
  CC       /tmp/build/perf/util/color.o
  CC       /tmp/build/perf/builtin-script.o
  CC       /tmp/build/perf/util/header.o
  CC       /tmp/build/perf/builtin-kmem.o
  CC       /tmp/build/perf/builtin-lock.o
  CC       /tmp/build/perf/builtin-kvm.o
  CC       /tmp/build/perf/builtin-inject.o
  CC       /tmp/build/perf/builtin-mem.o
  CC       /tmp/build/perf/util/callchain.o
  CC       /tmp/build/perf/builtin-data.o
  CC       /tmp/build/perf/builtin-version.o
  MKDIR    /tmp/build/perf/bench/
  CC       /tmp/build/perf/bench/sched-messaging.o
  MKDIR    /tmp/build/perf/tests/
  CC       /tmp/build/perf/tests/builtin-test.o
  CC       /tmp/build/perf/util/values.o
  MKDIR    /tmp/build/perf/bench/
  CC       /tmp/build/perf/bench/sched-pipe.o
  MKDIR    /tmp/build/perf/tests/
  CC       /tmp/build/perf/tests/parse-events.o
  CC       /tmp/build/perf/util/debug.o
  CC       /tmp/build/perf/bench/mem-functions.o
  CC       /tmp/build/perf/util/machine.o
  CC       /tmp/build/perf/bench/futex-hash.o
  CC       /tmp/build/perf/bench/futex-wake.o
  CC       /tmp/build/perf/bench/futex-wake-parallel.o
  CC       /tmp/build/perf/bench/futex-requeue.o
  CC       /tmp/build/perf/bench/futex-lock-pi.o
  CC       /tmp/build/perf/util/map.o
  LD       /tmp/build/perf/bench/perf-in.o
  CC       /tmp/build/perf/perf.o
  CC       /tmp/build/perf/util/pstack.o
  CC       /tmp/build/perf/util/session.o
  CC       /tmp/build/perf/util/ordered-events.o
  CC       /tmp/build/perf/util/comm.o
  CC       /tmp/build/perf/util/thread.o
  CC       /tmp/build/perf/util/thread_map.o
  CC       /tmp/build/perf/util/trace-event-parse.o
  CC       /tmp/build/perf/tests/dso-data.o
  CC       /tmp/build/perf/util/parse-events-bison.o
  BISON    /tmp/build/perf/util/pmu-bison.c
  CC       /tmp/build/perf/util/trace-event-read.o
  CC       /tmp/build/perf/tests/attr.o
  CC       /tmp/build/perf/tests/vmlinux-kallsyms.o
  CC       /tmp/build/perf/util/trace-event-info.o
  CC       /tmp/build/perf/util/trace-event-scripting.o
  CC       /tmp/build/perf/tests/openat-syscall.o
  CC       /tmp/build/perf/util/trace-event.o
  CC       /tmp/build/perf/tests/openat-syscall-all-cpus.o
  CC       /tmp/build/perf/util/svghelper.o
  CC       /tmp/build/perf/util/sort.o
  CC       /tmp/build/perf/util/hist.o
  CC       /tmp/build/perf/tests/openat-syscall-tp-fields.o
  CC       /tmp/build/perf/tests/mmap-basic.o
  CC       /tmp/build/perf/tests/perf-record.o
  CC       /tmp/build/perf/util/util.o
  CC       /tmp/build/perf/tests/evsel-roundtrip-name.o
  CC       /tmp/build/perf/tests/evsel-tp-sched.o
  CC       /tmp/build/perf/tests/fdarray.o
  CC       /tmp/build/perf/tests/pmu.o
  CC       /tmp/build/perf/tests/hists_common.o
  CC       /tmp/build/perf/tests/hists_link.o
  CC       /tmp/build/perf/tests/hists_filter.o
  CC       /tmp/build/perf/util/xyarray.o
  CC       /tmp/build/perf/util/cpumap.o
  CC       /tmp/build/perf/tests/hists_output.o
  CC       /tmp/build/perf/util/cgroup.o
  CC       /tmp/build/perf/tests/hists_cumulate.o
  CC       /tmp/build/perf/util/target.o
  CC       /tmp/build/perf/util/rblist.o
  CC       /tmp/build/perf/util/intlist.o
  CC       /tmp/build/perf/util/vdso.o
  CC       /tmp/build/perf/tests/python-use.o
  CC       /tmp/build/perf/tests/bp_signal.o
  CC       /tmp/build/perf/tests/bp_signal_overflow.o
  CC       /tmp/build/perf/util/counts.o
  CC       /tmp/build/perf/tests/task-exit.o
  CC       /tmp/build/perf/tests/sw-clock.o
  CC       /tmp/build/perf/tests/mmap-thread-lookup.o
  CC       /tmp/build/perf/util/stat.o
  CC       /tmp/build/perf/tests/thread-mg-share.o
  CC       /tmp/build/perf/tests/switch-tracking.o
  CC       /tmp/build/perf/tests/keep-tracking.o
  CC       /tmp/build/perf/tests/code-reading.o
  CC       /tmp/build/perf/tests/sample-parsing.o
  CC       /tmp/build/perf/util/stat-shadow.o
  CC       /tmp/build/perf/tests/parse-no-sample-id-all.o
  CC       /tmp/build/perf/tests/kmod-path.o
  CC       /tmp/build/perf/tests/thread-map.o
  CC       /tmp/build/perf/tests/llvm.o
  CC       /tmp/build/perf/util/record.o
  CC       /tmp/build/perf/tests/bpf.o
  CC       /tmp/build/perf/util/srcline.o
  CC       /tmp/build/perf/tests/topology.o
  CC       /tmp/build/perf/tests/cpumap.o
  CC       /tmp/build/perf/util/data.o
  CC       /tmp/build/perf/util/tsc.o
  CC       /tmp/build/perf/tests/stat.o
  CC       /tmp/build/perf/tests/event_update.o
  CC       /tmp/build/perf/util/cloexec.o
  CC       /tmp/build/perf/util/call-path.o
  CC       /tmp/build/perf/tests/event-times.o
  CC       /tmp/build/perf/util/thread-stack.o
  CC       /tmp/build/perf/util/parse-branch-options.o
  CC       /tmp/build/perf/tests/backward-ring-buffer.o
  CC       /tmp/build/perf/util/parse-regs-options.o
  CC       /tmp/build/perf/tests/sdt.o
  CC       /tmp/build/perf/util/term.o
  CC       /tmp/build/perf/tests/is_printable_array.o
  CC       /tmp/build/perf/tests/bitmap.o
  CC       /tmp/build/perf/util/help-unknown-cmd.o
  CC       /tmp/build/perf/tests/llvm-src-base.o
  CC       /tmp/build/perf/tests/llvm-src-kbuild.o
  CC       /tmp/build/perf/util/mem-events.o
  CC       /tmp/build/perf/tests/llvm-src-prologue.o
  CC       /tmp/build/perf/tests/llvm-src-relocation.o
  CC       /tmp/build/perf/util/vsprintf.o
  CC       /tmp/build/perf/util/symbol-minimal.o
  LD       /tmp/build/perf/tests/perf-in.o
  MKDIR    /tmp/build/perf/util/scripting-engines/
  LD       /tmp/build/perf/util/scripting-engines/libperf-in.o
  CC       /tmp/build/perf/util/demangle-java.o
  LD       /tmp/build/perf/perf-in.o
  CC       /tmp/build/perf/util/demangle-rust.o
  FLEX     /tmp/build/perf/util/parse-events-flex.c
  FLEX     /tmp/build/perf/util/pmu-flex.c
  CC       /tmp/build/perf/util/pmu-bison.o
  CC       /tmp/build/perf/util/parse-events.o
  CC       /tmp/build/perf/util/parse-events-flex.o
  CC       /tmp/build/perf/util/pmu.o
  CC       /tmp/build/perf/util/pmu-flex.o
  LD       /tmp/build/perf/util/libperf-in.o
  LD       /tmp/build/perf/libperf-in.o
  AR       /tmp/build/perf/libperf.a
  LINK     /tmp/build/perf/perf

make: Leaving directory '/git/linux/tools/perf'
fedora:24-x-ARC-uClibc: Ok

#9 lore raw
Quoted 14 lines · Arnaldo Carvalho de Melo
Quoted 6 lines

But one question: when you test build, do you have any extra devel

Quoted 5 lines

packages installed besides what is in this prebuilt toolchain tarball?

I'll add at least zlib and elfutils to the mix, building it in the docker image creation process, and then testing with/without NO_LIBELF=1, as I do to other cross-building images:

Trying to build elfutils 0.166:

checking whether gcc accepts -Wduplicated-cond... no checking whether gcc accepts -Wnull-dereference... no
configure: WARNING: "libc does not have argp" checking for argp_parse in -largp... no
configure: error: "no libargp found"

Quoted 4 lines

----

will go errands now, will try to check what is needed to build elfutils with uclibc, ideas?

So back in 3.2 days I ran into these issues with elfutils - the workaround was to use the standalone libelf
http://www.mr511.de/software/libelf-0.8.9.tar.gz.

Not sure if you will be willing to take that path.

OTOH, you could use standalone argp @ http://www.lysator.liu.se/~nisse/archive but it seems that requires a bunch of patches too - from looking into the corresponding buildroot package folder. Give this a shot - otherwise it is easier to just build a custom toolchain with pre-req packages from buildroot. Or can be provided if you so deem fit !

-Vineet

#10 lore raw

Em Fri, Aug 19, 2016 at 02:27:58PM -0700, Vineet Gupta escreveu:

Quoted 15 lines · Arnaldo Carvalho de Melo
Quoted 14 lines
Quoted 6 lines

But one question: when you test build, do you have any extra devel

Quoted 5 lines

packages installed besides what is in this prebuilt toolchain tarball?

I'll add at least zlib and elfutils to the mix, building it in the docker image creation process, and then testing with/without NO_LIBELF=1, as I do to other cross-building images:

Trying to build elfutils 0.166:

checking whether gcc accepts -Wduplicated-cond... no checking whether gcc accepts -Wnull-dereference... no
configure: WARNING: "libc does not have argp" checking for argp_parse in -largp... no
configure: error: "no libargp found"

Quoted 8 lines
Quoted 4 lines

----

will go errands now, will try to check what is needed to build elfutils with uclibc, ideas?

So back in 3.2 days I ran into these issues with elfutils - the workaround was to use the standalone libelf
http://www.mr511.de/software/libelf-0.8.9.tar.gz.

Ok, so I'll git it a try with libelf, lets see...

Quoted 7 lines

Not sure if you will be willing to take that path.

OTOH, you could use standalone argp @ http://www.lysator.liu.se/~nisse/archive but it seems that requires a bunch of patches too - from looking into the corresponding buildroot package folder. Give this a shot - otherwise it is easier to just build a custom toolchain with pre-req packages from buildroot. Or can be provided if you so deem fit !

I tried this path and its not fun :-\

#11 lore raw

Em Fri, Aug 19, 2016 at 06:42:07PM -0300, Arnaldo Carvalho de Melo escreveu:

Quoted 18 lines

Em Fri, Aug 19, 2016 at 02:27:58PM -0700, Vineet Gupta escreveu:

Quoted 17 lines · Arnaldo Carvalho de Melo
Quoted 16 lines
Quoted 6 lines

But one question: when you test build, do you have any extra devel

Quoted 5 lines

packages installed besides what is in this prebuilt toolchain tarball?

I'll add at least zlib and elfutils to the mix, building it in the docker image creation process, and then testing with/without NO_LIBELF=1, as I do to other cross-building images:

Trying to build elfutils 0.166:

checking whether gcc accepts -Wduplicated-cond... no checking whether gcc accepts -Wnull-dereference... no
configure: WARNING: "libc does not have argp" checking for argp_parse in -largp... no
configure: error: "no libargp found"

----

Quoted 8 lines
Quoted 6 lines
Quoted 2 lines

will go errands now, will try to check what is needed to build elfutils with uclibc, ideas?

So back in 3.2 days I ran into these issues with elfutils - the workaround was to use the standalone libelf
http://www.mr511.de/software/libelf-0.8.9.tar.gz.

Ok, so I'll git it a try with libelf, lets see...

Argh, give up, now it is refusing to build shared libraries:

checking for native ELF system... no
configure: warning: shared libraries not supported for arc-snps-linux-uclibc

And also it says ELF64 isn't support and thus GElf, some more details, anyway.

Quoted 8 lines
Quoted 8 lines

Not sure if you will be willing to take that path.

OTOH, you could use standalone argp @ http://www.lysator.liu.se/~nisse/archive but it seems that requires a bunch of patches too - from looking into the

corresponding buildroot package folder. Give this a shot - otherwise it is easier to just build a custom toolchain with pre-req packages from buildroot. Or can be provided if you so deem fit !

Please, if you do that, then I'll be able to test more stuff, I already had enough fun trying to get elfutils, argp-standalone and libelf built on this env :-\

- Arnaldo

#12 lore raw

Hi Arnaldo,

Quoted 50 lines · Arnaldo Carvalho de Melo

Em Fri, Aug 19, 2016 at 06:42:07PM -0300, Arnaldo Carvalho de Melo escreveu:

Quoted 23 lines

Em Fri, Aug 19, 2016 at 02:27:58PM -0700, Vineet Gupta escreveu:

Quoted 21 lines · Arnaldo Carvalho de Melo
Quoted 19 lines
Quoted 9 lines

But one question: when you test build, do you have any extra devel

Quoted 6 lines

packages installed besides what is in this prebuilt toolchain tarball?

I'll add at least zlib and elfutils to the mix, building it in the docker image creation process, and then testing with/without NO_LIBELF=1, as I do to other cross-building images:

Trying to build elfutils 0.166:

checking whether gcc accepts -Wduplicated-cond... no checking whether gcc accepts -Wnull-dereference... no
configure: WARNING: "libc does not have argp" checking for argp_parse in -largp... no
configure: error: "no libargp found"

----

Quoted 8 lines
Quoted 6 lines
Quoted 2 lines

will go errands now, will try to check what is needed to build elfutils with uclibc, ideas?

So back in 3.2 days I ran into these issues with elfutils - the workaround was to use the standalone libelf
http://www.mr511.de/software/libelf-0.8.9.tar.gz.

Ok, so I'll git it a try with libelf, lets see...

Argh, give up, now it is refusing to build shared libraries:

? checking for native ELF system... no
? configure: warning: shared libraries not supported for arc-snps-linux-uclibc

And also it says ELF64 isn't support and thus GElf, some more details, anyway.
??

Quoted 9 lines
Quoted 9 lines

Not sure if you will be willing to take that path.

OTOH, you could use standalone argp @ http://www.lysator.liu.se/~nisse/archive but it seems that requires a bunch of patches too - from looking into the

Quoted 7 lines
Quoted 3 lines
Quoted 3 lines

corresponding buildroot package folder. Give this a shot - otherwise it is easier to just build a custom toolchain with pre-req packages from buildroot. Or can be provided if you so deem fit !

Please, if you do that, then I'll be able to test more stuff, I already had enough fun trying to get elfutils, argp-standalone and libelf built on this env :-\

Please find a tarball with prebuilt toolchain for ARC HS38 by that link:
https://www.dropbox.com/s/uvqla26pmq03h5u/br-2016.08-rc2-65-g11109fd-archs38.tar.gz?dl=0

Just FYI I built it from today's BR sources, i.e. this is gcc6 based with all latest fixes for ARC on top of vanilla gcc 6.1.1.

That's a defconfig I used in Buildroot:
-------------------->8---------------------
BR2_arcle=y
BR2_archs38=y
BR2_TOOLCHAIN_BUILDROOT_INET_RPC=y
BR2_TOOLCHAIN_BUILDROOT_LOCALE=y
BR2_PACKAGE_ELFUTILS=y
-------------------->8---------------------

-Alexey

#13 lore raw

Em Mon, Aug 22, 2016 at 06:01:08PM +0000, Alexey Brodkin escreveu:

Quoted 7 lines · Arnaldo Carvalho de Melo
Quoted 5 lines

Em Fri, Aug 19, 2016 at 06:42:07PM -0300, Arnaldo Carvalho de Melo escreveu:

Quoted 4 lines

Em Fri, Aug 19, 2016 at 02:27:58PM -0700, Vineet Gupta escreveu:

Quoted 3 lines

corresponding buildroot package folder. Give this a shot - otherwise it is easier to just build a custom toolchain with pre-req packages from buildroot. Or can be provided if you so deem fit !

Quoted 6 lines
Quoted 3 lines

Please, if you do that, then I'll be able to test more stuff, I already had enough fun trying to get elfutils, argp-standalone and libelf built on this env :-\

Please find a tarball with prebuilt toolchain for ARC HS38 by that link:
https://www.dropbox.com/s/uvqla26pmq03h5u/br-2016.08-rc2-65-g11109fd-archs38.tar.gz?dl=0

Thanks for that, I'm behind a slow connection right now, will try later, but can you consider leaving this on a permanent location? At some point I'll publish my Dockerfiles, probably on the kernel sources, so that other people can replicate my test build environment, and then it would be nice for them to be able to audit what is in there, where the toolchains/packages come from, etc.

For reference, this is how I have the ARC-uclibc set up right now, with the previous toolchain Vineet provided me:

[root at jouet perf]# cat fedora/24/x-ARC-uClibc/Dockerfile # docker.io/acmel/linux-perf-tools-build-fedora:24-x-ARC-uClibc FROM docker.io/fedora:24
MAINTAINER Arnaldo Carvalho de Melo <acme at kernel.org> ENV TOOLCHAIN=arc_gnu_2016.03_prebuilt_uclibc_le_archs_linux_install ENV CROSS=arc-linux-

# binutils for ar, used without cross compiler prefix in libelf build
RUN SOURCEFILE=${TOOLCHAIN}.tar.gz && \
    dnf -y install make flex bison binutils wget tar bzip2 && \
    dnf -y clean all && \
    mkdir -m 777 -p /tmp/build/perf && \
    curl -OL https://github.com/foss-for-synopsys-dwc-arc-processors/toolchain/releases/download/arc-2016.03/${SOURCEFILE} && \
    tar xf ${SOURCEFILE} && \
    rm -f ${SOURCEFILE} && \
    export TARGET=arc-snps-linux-uclibc && \
    export INSTALLDIR=/${TOOLCHAIN}/${TARGET}/sysroot/ && \
    export PATH=/${TOOLCHAIN}/bin:$PATH && \
    export TARGETMACH=${TARGET} && \
    export CC=${CROSS}gcc && \
    export LD=${CROSS}ld && \
    export AS=${CROSS}as && \
    export AR=${CROSS}ar && \
    wget -q http://zlib.net/zlib-1.2.8.tar.gz && \
    tar xf zlib-1.2.8.tar.gz && \
    cd zlib-1.2.8 && \
    ./configure --prefix=${INSTALLDIR} && \
    make && \
    make install && \
    cd .. && \
    rm -rf zlib-1.2.8 && \
    rm -f zlib-1.2.8.tar.gz && \
    dnf -y remove tar wget bzip2 binutils && \
    groupadd -r perfbuilder && \
    useradd -r -g perfbuilder perfbuilder
USER perfbuilder
ENTRYPOINT make -C /git/linux/tools/perf O=/tmp/build/perf NO_LIBBPF=1
ARCH=arc CROSS_COMPILE=/${TOOLCHAIN}/bin/${CROSS}

- Arnaldo

Quoted 13 lines

Just FYI I built it from today's BR sources, i.e. this is gcc6 based with all latest fixes for ARC on top of vanilla gcc 6.1.1.

That's a defconfig I used in Buildroot:
-------------------->8---------------------
BR2_arcle=y
BR2_archs38=y
BR2_TOOLCHAIN_BUILDROOT_INET_RPC=y
BR2_TOOLCHAIN_BUILDROOT_LOCALE=y
BR2_PACKAGE_ELFUTILS=y
-------------------->8---------------------

-Alexey

#14 lore raw

PATCH v2 1/1 tools lib: Reinstate strlcpy() header guard with __UCLIBC__

In reply to Arnaldo Carvalho de Melo

perf tools build in recent kernels spews splat when cross compiling with uClibc

|   CC       util/alias.o
| In file included from tools/perf/util/../ui/../util/cache.h:8:0,
|                 from tools/perf/util/../ui/helpline.h:7,
|                 from tools/perf/util/debug.h:8,
|                 from arch/../util/cpumap.h:9,
|                 from arch/../util/env.h:5,
|                 from arch/common.h:4,
|                 from arch/common.c:3:
| tools/include/linux/string.h:12:15: warning: redundant redeclaration of ?strlcpy? [-Wredundant-decls]
|  extern size_t strlcpy(char *dest, const char *src, size_t size);
               ^

This is after commit 61a6445e463a31 ("tools lib: Guard the strlcpy() header with __GLIBC__").

The problem is uClibc also defines __GLIBC__ for exported headers for applications. So add that specific check to not trip for uClibc.

Cc Adrian Hunter <adrian.hunter at intel.com>
Cc Alexey Brodkin <Alexey.Brodkin at synopsys.com>
Cc David Ahern <dsahern at gmail.com>
Cc Jiri Olsa <jolsa at kernel.org>
Cc Namhyung Kim <namhyung at kernel.org>
Cc Wang Nan <wangnan0 at huawei.com>
Cc Petri Gynther <pgynther at google.com>
Cc Peter Zijlstra (Intel) <peterz at infradead.org>
Signed-off-by Vineet Gupta <vgupta at synopsys.com>
---
 tools/include/linux/string.h | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
tools/include/linux/string.h +5 -1
index b96879477311..f436d2420a18 100644
@@ -8,7 +8,11 @@ void *memdup(const void *src, size_t len);
 
 int strtobool(const char *s, bool *res);
 
-#ifdef __GLIBC__
+/*
+ * glibc based builds needs the extern while uClibc doesn't.
+ * However uClibc headers also define __GLIBC__ hence the hack below
+ */
+#if defined(__GLIBC__) && !defined(__UCLIBC__)
 extern size_t strlcpy(char *dest, const char *src, size_t size);
 #endif
 
Signature · 1 line
2.7.4