* [PATCH v2] tools build: Check libasan and libubsan in Makefile.feature
@ 2020-06-03 6:10 Tiezhu Yang
2020-06-03 11:32 ` Arnaldo Carvalho de Melo
0 siblings, 1 reply; 5+ messages in thread
From: Tiezhu Yang @ 2020-06-03 6:10 UTC (permalink / raw)
To: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
Mark Rutland, Alexander Shishkin, Jiri Olsa, Namhyung Kim
Cc: linux-kernel, Xuefeng Li
When build perf with ASan or UBSan, if libasan or libubsan can not find,
the feature-glibc is 0 and there exists the following error log which is
wrong, because we can find gnu/libc-version.h in /usr/include, glibc-devel
is also installed.
[yangtiezhu@linux perf]$ make DEBUG=1 EXTRA_CFLAGS='-fno-omit-frame-pointer -fsanitize=address'
BUILD: Doing 'make -j4' parallel build
HOSTCC fixdep.o
HOSTLD fixdep-in.o
LINK fixdep
<stdin>:1:0: warning: -fsanitize=address and -fsanitize=kernel-address are not supported for this target
<stdin>:1:0: warning: -fsanitize=address not supported for this target
Auto-detecting system features:
... dwarf: [ OFF ]
... dwarf_getlocations: [ OFF ]
... glibc: [ OFF ]
... gtk2: [ OFF ]
... libaudit: [ OFF ]
... libbfd: [ OFF ]
... libcap: [ OFF ]
... libelf: [ OFF ]
... libnuma: [ OFF ]
... numa_num_possible_cpus: [ OFF ]
... libperl: [ OFF ]
... libpython: [ OFF ]
... libcrypto: [ OFF ]
... libunwind: [ OFF ]
... libdw-dwarf-unwind: [ OFF ]
... zlib: [ OFF ]
... lzma: [ OFF ]
... get_cpuid: [ OFF ]
... bpf: [ OFF ]
... libaio: [ OFF ]
... libzstd: [ OFF ]
... disassembler-four-args: [ OFF ]
Makefile.config:393: *** No gnu/libc-version.h found, please install glibc-dev[el]. Stop.
Makefile.perf:224: recipe for target 'sub-make' failed
make[1]: *** [sub-make] Error 2
Makefile:69: recipe for target 'all' failed
make: *** [all] Error 2
[yangtiezhu@linux perf]$ ls /usr/include/gnu/libc-version.h
/usr/include/gnu/libc-version.h
After install libasan and libubsan, the feature-glibc is 1 and the build
process is success, so the cause is related with libasan or libubsan, we
should check them and print an error log to reflect the reality.
Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>
---
v2:
- Check libasan and libubsan in tools/build/Makefile.feature
- Modify the patch subject
tools/build/Makefile.feature | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/tools/build/Makefile.feature b/tools/build/Makefile.feature
index 3abd431..e147c17 100644
--- a/tools/build/Makefile.feature
+++ b/tools/build/Makefile.feature
@@ -252,3 +252,10 @@ ifeq ($(feature_verbose),1)
$(foreach feat,$(TMP),$(call feature_print_status,$(feat),))
$(info )
endif
+
+ifneq ($(shell ldconfig -p | grep libasan >/dev/null 2>&1; echo $$?), 0)
+ msg := $(error No libasan found, please install libasan);
+endif
+ifneq ($(shell ldconfig -p | grep libubsan >/dev/null 2>&1; echo $$?), 0)
+ msg := $(error No libubsan found, please install libubsan);
+endif
--
2.1.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH v2] tools build: Check libasan and libubsan in Makefile.feature
2020-06-03 6:10 [PATCH v2] tools build: Check libasan and libubsan in Makefile.feature Tiezhu Yang
@ 2020-06-03 11:32 ` Arnaldo Carvalho de Melo
2020-06-15 2:20 ` Tiezhu Yang
0 siblings, 1 reply; 5+ messages in thread
From: Arnaldo Carvalho de Melo @ 2020-06-03 11:32 UTC (permalink / raw)
To: Tiezhu Yang
Cc: Peter Zijlstra, Ingo Molnar, Mark Rutland, Alexander Shishkin,
Jiri Olsa, Namhyung Kim, linux-kernel, Xuefeng Li
Em Wed, Jun 03, 2020 at 02:10:04PM +0800, Tiezhu Yang escreveu:
> When build perf with ASan or UBSan, if libasan or libubsan can not find,
> the feature-glibc is 0 and there exists the following error log which is
> wrong, because we can find gnu/libc-version.h in /usr/include, glibc-devel
> is also installed.
> [yangtiezhu@linux perf]$ make DEBUG=1 EXTRA_CFLAGS='-fno-omit-frame-pointer -fsanitize=address'
> BUILD: Doing 'make -j4' parallel build
> HOSTCC fixdep.o
> HOSTLD fixdep-in.o
> LINK fixdep
> <stdin>:1:0: warning: -fsanitize=address and -fsanitize=kernel-address are not supported for this target
> <stdin>:1:0: warning: -fsanitize=address not supported for this target
> Auto-detecting system features:
> ... dwarf: [ OFF ]
> ... dwarf_getlocations: [ OFF ]
> ... glibc: [ OFF ]
> ... gtk2: [ OFF ]
> ... libaudit: [ OFF ]
> ... libbfd: [ OFF ]
> ... libcap: [ OFF ]
> ... libelf: [ OFF ]
> ... libnuma: [ OFF ]
> ... numa_num_possible_cpus: [ OFF ]
> ... libperl: [ OFF ]
> ... libpython: [ OFF ]
> ... libcrypto: [ OFF ]
> ... libunwind: [ OFF ]
> ... libdw-dwarf-unwind: [ OFF ]
> ... zlib: [ OFF ]
> ... lzma: [ OFF ]
> ... get_cpuid: [ OFF ]
> ... bpf: [ OFF ]
> ... libaio: [ OFF ]
> ... libzstd: [ OFF ]
> ... disassembler-four-args: [ OFF ]
>
> Makefile.config:393: *** No gnu/libc-version.h found, please install glibc-dev[el]. Stop.
> Makefile.perf:224: recipe for target 'sub-make' failed
> make[1]: *** [sub-make] Error 2
> Makefile:69: recipe for target 'all' failed
> make: *** [all] Error 2
> [yangtiezhu@linux perf]$ ls /usr/include/gnu/libc-version.h
> /usr/include/gnu/libc-version.h
>
> After install libasan and libubsan, the feature-glibc is 1 and the build
> process is success, so the cause is related with libasan or libubsan, we
> should check them and print an error log to reflect the reality.
>
> Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>
> ---
>
> v2:
> - Check libasan and libubsan in tools/build/Makefile.feature
> - Modify the patch subject
>
> tools/build/Makefile.feature | 7 +++++++
> 1 file changed, 7 insertions(+)
>
> diff --git a/tools/build/Makefile.feature b/tools/build/Makefile.feature
> index 3abd431..e147c17 100644
> --- a/tools/build/Makefile.feature
> +++ b/tools/build/Makefile.feature
> @@ -252,3 +252,10 @@ ifeq ($(feature_verbose),1)
> $(foreach feat,$(TMP),$(call feature_print_status,$(feat),))
> $(info )
> endif
> +
> +ifneq ($(shell ldconfig -p | grep libasan >/dev/null 2>&1; echo $$?), 0)
> + msg := $(error No libasan found, please install libasan);
> +endif
> +ifneq ($(shell ldconfig -p | grep libubsan >/dev/null 2>&1; echo $$?), 0)
> + msg := $(error No libubsan found, please install libubsan);
> +endif
Hey, we need to only do that if -fsanitize=address is in EXTRA_CFLAGS,
right?
I applied it and got:
$ rm -rf /tmp/build/perf ; mkdir -p /tmp/build/perf
$ make O=/tmp/build/perf -C tools/perf install-bin
make: Entering directory '/home/acme/git/perf/tools/perf'
BUILD: Doing 'make -j8' parallel build
HOSTCC /tmp/build/perf/fixdep.o
HOSTLD /tmp/build/perf/fixdep-in.o
LINK /tmp/build/perf/fixdep
Warning: Kernel ABI header at 'tools/perf/util/hashmap.h' differs from latest version at 'tools/lib/bpf/hashmap.h'
diff -u tools/perf/util/hashmap.h tools/lib/bpf/hashmap.h
Warning: Kernel ABI header at 'tools/perf/util/hashmap.c' differs from latest version at 'tools/lib/bpf/hashmap.c'
diff -u tools/perf/util/hashmap.c tools/lib/bpf/hashmap.c
Auto-detecting system features:
... dwarf: [ on ]
... dwarf_getlocations: [ on ]
... glibc: [ on ]
... gtk2: [ on ]
... libbfd: [ on ]
... libcap: [ on ]
... libelf: [ on ]
... libnuma: [ on ]
... numa_num_possible_cpus: [ on ]
... libperl: [ on ]
... libpython: [ on ]
... libcrypto: [ on ]
... libunwind: [ on ]
... libdw-dwarf-unwind: [ on ]
... zlib: [ on ]
... lzma: [ on ]
... get_cpuid: [ on ]
... bpf: [ on ]
... libaio: [ on ]
... libzstd: [ on ]
... disassembler-four-args: [ on ]
/home/acme/git/perf/tools/build/Makefile.feature:255: *** No libasan found, please install libasan. Stop.
make[1]: *** [Makefile.perf:231: sub-make] Error 2
make: *** [Makefile:110: install-bin] Error 2
make: Leaving directory '/home/acme/git/perf/tools/perf'
$
Something enclosed in:
ifneq ($(filter s% -fsanitize=address%,$(EXTRA_CFLAGS),),)
Right Jiri?
- Arnaldo
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v2] tools build: Check libasan and libubsan in Makefile.feature
2020-06-03 11:32 ` Arnaldo Carvalho de Melo
@ 2020-06-15 2:20 ` Tiezhu Yang
2020-06-16 19:39 ` Arnaldo Carvalho de Melo
0 siblings, 1 reply; 5+ messages in thread
From: Tiezhu Yang @ 2020-06-15 2:20 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo
Cc: Peter Zijlstra, Ingo Molnar, Mark Rutland, Alexander Shishkin,
Jiri Olsa, Namhyung Kim, linux-kernel, Xuefeng Li
On 06/03/2020 07:32 PM, Arnaldo Carvalho de Melo wrote:
> Em Wed, Jun 03, 2020 at 02:10:04PM +0800, Tiezhu Yang escreveu:
>> When build perf with ASan or UBSan, if libasan or libubsan can not find,
>> the feature-glibc is 0 and there exists the following error log which is
>> wrong, because we can find gnu/libc-version.h in /usr/include, glibc-devel
>> is also installed.
>
>> [yangtiezhu@linux perf]$ make DEBUG=1 EXTRA_CFLAGS='-fno-omit-frame-pointer -fsanitize=address'
>> BUILD: Doing 'make -j4' parallel build
>> HOSTCC fixdep.o
>> HOSTLD fixdep-in.o
>> LINK fixdep
>> <stdin>:1:0: warning: -fsanitize=address and -fsanitize=kernel-address are not supported for this target
>> <stdin>:1:0: warning: -fsanitize=address not supported for this target
>
>> Auto-detecting system features:
>> ... dwarf: [ OFF ]
>> ... dwarf_getlocations: [ OFF ]
>> ... glibc: [ OFF ]
>> ... gtk2: [ OFF ]
>> ... libaudit: [ OFF ]
>> ... libbfd: [ OFF ]
>> ... libcap: [ OFF ]
>> ... libelf: [ OFF ]
>> ... libnuma: [ OFF ]
>> ... numa_num_possible_cpus: [ OFF ]
>> ... libperl: [ OFF ]
>> ... libpython: [ OFF ]
>> ... libcrypto: [ OFF ]
>> ... libunwind: [ OFF ]
>> ... libdw-dwarf-unwind: [ OFF ]
>> ... zlib: [ OFF ]
>> ... lzma: [ OFF ]
>> ... get_cpuid: [ OFF ]
>> ... bpf: [ OFF ]
>> ... libaio: [ OFF ]
>> ... libzstd: [ OFF ]
>> ... disassembler-four-args: [ OFF ]
>>
>> Makefile.config:393: *** No gnu/libc-version.h found, please install glibc-dev[el]. Stop.
>> Makefile.perf:224: recipe for target 'sub-make' failed
>> make[1]: *** [sub-make] Error 2
>> Makefile:69: recipe for target 'all' failed
>> make: *** [all] Error 2
>> [yangtiezhu@linux perf]$ ls /usr/include/gnu/libc-version.h
>> /usr/include/gnu/libc-version.h
>>
>> After install libasan and libubsan, the feature-glibc is 1 and the build
>> process is success, so the cause is related with libasan or libubsan, we
>> should check them and print an error log to reflect the reality.
>>
>> Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>
>> ---
>>
>> v2:
>> - Check libasan and libubsan in tools/build/Makefile.feature
>> - Modify the patch subject
>>
>> tools/build/Makefile.feature | 7 +++++++
>> 1 file changed, 7 insertions(+)
>>
>> diff --git a/tools/build/Makefile.feature b/tools/build/Makefile.feature
>> index 3abd431..e147c17 100644
>> --- a/tools/build/Makefile.feature
>> +++ b/tools/build/Makefile.feature
>> @@ -252,3 +252,10 @@ ifeq ($(feature_verbose),1)
>> $(foreach feat,$(TMP),$(call feature_print_status,$(feat),))
>> $(info )
>> endif
>> +
>> +ifneq ($(shell ldconfig -p | grep libasan >/dev/null 2>&1; echo $$?), 0)
>> + msg := $(error No libasan found, please install libasan);
>> +endif
>> +ifneq ($(shell ldconfig -p | grep libubsan >/dev/null 2>&1; echo $$?), 0)
>> + msg := $(error No libubsan found, please install libubsan);
>> +endif
> Hey, we need to only do that if -fsanitize=address is in EXTRA_CFLAGS,
> right?
Sorry for the late reply.
Maybe -fsanitize=undefined is also needed.
Please reference tools/perf/Documentation/Build.txt
>
> I applied it and got:
>
> $ rm -rf /tmp/build/perf ; mkdir -p /tmp/build/perf
> $ make O=/tmp/build/perf -C tools/perf install-bin
> make: Entering directory '/home/acme/git/perf/tools/perf'
> BUILD: Doing 'make -j8' parallel build
> HOSTCC /tmp/build/perf/fixdep.o
> HOSTLD /tmp/build/perf/fixdep-in.o
> LINK /tmp/build/perf/fixdep
> Warning: Kernel ABI header at 'tools/perf/util/hashmap.h' differs from latest version at 'tools/lib/bpf/hashmap.h'
> diff -u tools/perf/util/hashmap.h tools/lib/bpf/hashmap.h
> Warning: Kernel ABI header at 'tools/perf/util/hashmap.c' differs from latest version at 'tools/lib/bpf/hashmap.c'
> diff -u tools/perf/util/hashmap.c tools/lib/bpf/hashmap.c
>
> Auto-detecting system features:
> ... dwarf: [ on ]
> ... dwarf_getlocations: [ on ]
> ... glibc: [ on ]
> ... gtk2: [ on ]
> ... libbfd: [ on ]
> ... libcap: [ on ]
> ... libelf: [ on ]
> ... libnuma: [ on ]
> ... numa_num_possible_cpus: [ on ]
> ... libperl: [ on ]
> ... libpython: [ on ]
> ... libcrypto: [ on ]
> ... libunwind: [ on ]
> ... libdw-dwarf-unwind: [ on ]
> ... zlib: [ on ]
> ... lzma: [ on ]
> ... get_cpuid: [ on ]
> ... bpf: [ on ]
> ... libaio: [ on ]
> ... libzstd: [ on ]
> ... disassembler-four-args: [ on ]
>
> /home/acme/git/perf/tools/build/Makefile.feature:255: *** No libasan found, please install libasan. Stop.
> make[1]: *** [Makefile.perf:231: sub-make] Error 2
> make: *** [Makefile:110: install-bin] Error 2
> make: Leaving directory '/home/acme/git/perf/tools/perf'
> $
>
> Something enclosed in:
>
> ifneq ($(filter s% -fsanitize=address%,$(EXTRA_CFLAGS),),)
>
> Right Jiri?
>
> - Arnaldo
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v2] tools build: Check libasan and libubsan in Makefile.feature
2020-06-15 2:20 ` Tiezhu Yang
@ 2020-06-16 19:39 ` Arnaldo Carvalho de Melo
2020-06-17 1:55 ` Tiezhu Yang
0 siblings, 1 reply; 5+ messages in thread
From: Arnaldo Carvalho de Melo @ 2020-06-16 19:39 UTC (permalink / raw)
To: Tiezhu Yang
Cc: Peter Zijlstra, Ingo Molnar, Mark Rutland, Alexander Shishkin,
Jiri Olsa, Namhyung Kim, linux-kernel, Xuefeng Li
Em Mon, Jun 15, 2020 at 10:20:10AM +0800, Tiezhu Yang escreveu:
> On 06/03/2020 07:32 PM, Arnaldo Carvalho de Melo wrote:
> > Em Wed, Jun 03, 2020 at 02:10:04PM +0800, Tiezhu Yang escreveu:
> > > When build perf with ASan or UBSan, if libasan or libubsan can not find,
> > > the feature-glibc is 0 and there exists the following error log which is
> > > wrong, because we can find gnu/libc-version.h in /usr/include, glibc-devel
> > > is also installed.
> > > [yangtiezhu@linux perf]$ make DEBUG=1 EXTRA_CFLAGS='-fno-omit-frame-pointer -fsanitize=address'
> > > BUILD: Doing 'make -j4' parallel build
> > > HOSTCC fixdep.o
> > > HOSTLD fixdep-in.o
> > > LINK fixdep
> > > <stdin>:1:0: warning: -fsanitize=address and -fsanitize=kernel-address are not supported for this target
> > > <stdin>:1:0: warning: -fsanitize=address not supported for this target
> > > Auto-detecting system features:
> > > ... dwarf: [ OFF ]
> > > ... dwarf_getlocations: [ OFF ]
> > > ... glibc: [ OFF ]
> > > ... gtk2: [ OFF ]
> > > ... libaudit: [ OFF ]
> > > ... libbfd: [ OFF ]
> > > ... libcap: [ OFF ]
> > > ... libelf: [ OFF ]
> > > ... libnuma: [ OFF ]
> > > ... numa_num_possible_cpus: [ OFF ]
> > > ... libperl: [ OFF ]
> > > ... libpython: [ OFF ]
> > > ... libcrypto: [ OFF ]
> > > ... libunwind: [ OFF ]
> > > ... libdw-dwarf-unwind: [ OFF ]
> > > ... zlib: [ OFF ]
> > > ... lzma: [ OFF ]
> > > ... get_cpuid: [ OFF ]
> > > ... bpf: [ OFF ]
> > > ... libaio: [ OFF ]
> > > ... libzstd: [ OFF ]
> > > ... disassembler-four-args: [ OFF ]
> > >
> > > Makefile.config:393: *** No gnu/libc-version.h found, please install glibc-dev[el]. Stop.
> > > Makefile.perf:224: recipe for target 'sub-make' failed
> > > make[1]: *** [sub-make] Error 2
> > > Makefile:69: recipe for target 'all' failed
> > > make: *** [all] Error 2
> > > [yangtiezhu@linux perf]$ ls /usr/include/gnu/libc-version.h
> > > /usr/include/gnu/libc-version.h
> > >
> > > After install libasan and libubsan, the feature-glibc is 1 and the build
> > > process is success, so the cause is related with libasan or libubsan, we
> > > should check them and print an error log to reflect the reality.
> > >
> > > Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>
> > > ---
> > >
> > > v2:
> > > - Check libasan and libubsan in tools/build/Makefile.feature
> > > - Modify the patch subject
> > >
> > > tools/build/Makefile.feature | 7 +++++++
> > > 1 file changed, 7 insertions(+)
> > >
> > > diff --git a/tools/build/Makefile.feature b/tools/build/Makefile.feature
> > > index 3abd431..e147c17 100644
> > > --- a/tools/build/Makefile.feature
> > > +++ b/tools/build/Makefile.feature
> > > @@ -252,3 +252,10 @@ ifeq ($(feature_verbose),1)
> > > $(foreach feat,$(TMP),$(call feature_print_status,$(feat),))
> > > $(info )
> > > endif
> > > +
> > > +ifneq ($(shell ldconfig -p | grep libasan >/dev/null 2>&1; echo $$?), 0)
> > > + msg := $(error No libasan found, please install libasan);
> > > +endif
> > > +ifneq ($(shell ldconfig -p | grep libubsan >/dev/null 2>&1; echo $$?), 0)
> > > + msg := $(error No libubsan found, please install libubsan);
> > > +endif
> > Hey, we need to only do that if -fsanitize=address is in EXTRA_CFLAGS,
> > right?
>
> Sorry for the late reply.
> Maybe -fsanitize=undefined is also needed.
> Please reference tools/perf/Documentation/Build.txt
Can you send an updated patch then?
> >
> > I applied it and got:
> >
> > $ rm -rf /tmp/build/perf ; mkdir -p /tmp/build/perf
> > $ make O=/tmp/build/perf -C tools/perf install-bin
> > make: Entering directory '/home/acme/git/perf/tools/perf'
> > BUILD: Doing 'make -j8' parallel build
> > HOSTCC /tmp/build/perf/fixdep.o
> > HOSTLD /tmp/build/perf/fixdep-in.o
> > LINK /tmp/build/perf/fixdep
> > Warning: Kernel ABI header at 'tools/perf/util/hashmap.h' differs from latest version at 'tools/lib/bpf/hashmap.h'
> > diff -u tools/perf/util/hashmap.h tools/lib/bpf/hashmap.h
> > Warning: Kernel ABI header at 'tools/perf/util/hashmap.c' differs from latest version at 'tools/lib/bpf/hashmap.c'
> > diff -u tools/perf/util/hashmap.c tools/lib/bpf/hashmap.c
> > Auto-detecting system features:
> > ... dwarf: [ on ]
> > ... dwarf_getlocations: [ on ]
> > ... glibc: [ on ]
> > ... gtk2: [ on ]
> > ... libbfd: [ on ]
> > ... libcap: [ on ]
> > ... libelf: [ on ]
> > ... libnuma: [ on ]
> > ... numa_num_possible_cpus: [ on ]
> > ... libperl: [ on ]
> > ... libpython: [ on ]
> > ... libcrypto: [ on ]
> > ... libunwind: [ on ]
> > ... libdw-dwarf-unwind: [ on ]
> > ... zlib: [ on ]
> > ... lzma: [ on ]
> > ... get_cpuid: [ on ]
> > ... bpf: [ on ]
> > ... libaio: [ on ]
> > ... libzstd: [ on ]
> > ... disassembler-four-args: [ on ]
> > /home/acme/git/perf/tools/build/Makefile.feature:255: *** No libasan found, please install libasan. Stop.
> > make[1]: *** [Makefile.perf:231: sub-make] Error 2
> > make: *** [Makefile:110: install-bin] Error 2
> > make: Leaving directory '/home/acme/git/perf/tools/perf'
> > $
> >
> > Something enclosed in:
> >
> > ifneq ($(filter s% -fsanitize=address%,$(EXTRA_CFLAGS),),)
> >
> > Right Jiri?
> >
> > - Arnaldo
>
--
- Arnaldo
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v2] tools build: Check libasan and libubsan in Makefile.feature
2020-06-16 19:39 ` Arnaldo Carvalho de Melo
@ 2020-06-17 1:55 ` Tiezhu Yang
0 siblings, 0 replies; 5+ messages in thread
From: Tiezhu Yang @ 2020-06-17 1:55 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo
Cc: Peter Zijlstra, Ingo Molnar, Mark Rutland, Alexander Shishkin,
Jiri Olsa, Namhyung Kim, linux-kernel, Xuefeng Li
On 06/17/2020 03:39 AM, Arnaldo Carvalho de Melo wrote:
> Em Mon, Jun 15, 2020 at 10:20:10AM +0800, Tiezhu Yang escreveu:
>> On 06/03/2020 07:32 PM, Arnaldo Carvalho de Melo wrote:
>>> Em Wed, Jun 03, 2020 at 02:10:04PM +0800, Tiezhu Yang escreveu:
>>>> When build perf with ASan or UBSan, if libasan or libubsan can not find,
>>>> the feature-glibc is 0 and there exists the following error log which is
>>>> wrong, because we can find gnu/libc-version.h in /usr/include, glibc-devel
>>>> is also installed.
>>>> [yangtiezhu@linux perf]$ make DEBUG=1 EXTRA_CFLAGS='-fno-omit-frame-pointer -fsanitize=address'
>>>> BUILD: Doing 'make -j4' parallel build
>>>> HOSTCC fixdep.o
>>>> HOSTLD fixdep-in.o
>>>> LINK fixdep
>>>> <stdin>:1:0: warning: -fsanitize=address and -fsanitize=kernel-address are not supported for this target
>>>> <stdin>:1:0: warning: -fsanitize=address not supported for this target
>>>> Auto-detecting system features:
>>>> ... dwarf: [ OFF ]
>>>> ... dwarf_getlocations: [ OFF ]
>>>> ... glibc: [ OFF ]
>>>> ... gtk2: [ OFF ]
>>>> ... libaudit: [ OFF ]
>>>> ... libbfd: [ OFF ]
>>>> ... libcap: [ OFF ]
>>>> ... libelf: [ OFF ]
>>>> ... libnuma: [ OFF ]
>>>> ... numa_num_possible_cpus: [ OFF ]
>>>> ... libperl: [ OFF ]
>>>> ... libpython: [ OFF ]
>>>> ... libcrypto: [ OFF ]
>>>> ... libunwind: [ OFF ]
>>>> ... libdw-dwarf-unwind: [ OFF ]
>>>> ... zlib: [ OFF ]
>>>> ... lzma: [ OFF ]
>>>> ... get_cpuid: [ OFF ]
>>>> ... bpf: [ OFF ]
>>>> ... libaio: [ OFF ]
>>>> ... libzstd: [ OFF ]
>>>> ... disassembler-four-args: [ OFF ]
>>>>
>>>> Makefile.config:393: *** No gnu/libc-version.h found, please install glibc-dev[el]. Stop.
>>>> Makefile.perf:224: recipe for target 'sub-make' failed
>>>> make[1]: *** [sub-make] Error 2
>>>> Makefile:69: recipe for target 'all' failed
>>>> make: *** [all] Error 2
>>>> [yangtiezhu@linux perf]$ ls /usr/include/gnu/libc-version.h
>>>> /usr/include/gnu/libc-version.h
>>>>
>>>> After install libasan and libubsan, the feature-glibc is 1 and the build
>>>> process is success, so the cause is related with libasan or libubsan, we
>>>> should check them and print an error log to reflect the reality.
>>>>
>>>> Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>
>>>> ---
>>>>
>>>> v2:
>>>> - Check libasan and libubsan in tools/build/Makefile.feature
>>>> - Modify the patch subject
>>>>
>>>> tools/build/Makefile.feature | 7 +++++++
>>>> 1 file changed, 7 insertions(+)
>>>>
>>>> diff --git a/tools/build/Makefile.feature b/tools/build/Makefile.feature
>>>> index 3abd431..e147c17 100644
>>>> --- a/tools/build/Makefile.feature
>>>> +++ b/tools/build/Makefile.feature
>>>> @@ -252,3 +252,10 @@ ifeq ($(feature_verbose),1)
>>>> $(foreach feat,$(TMP),$(call feature_print_status,$(feat),))
>>>> $(info )
>>>> endif
>>>> +
>>>> +ifneq ($(shell ldconfig -p | grep libasan >/dev/null 2>&1; echo $$?), 0)
>>>> + msg := $(error No libasan found, please install libasan);
>>>> +endif
>>>> +ifneq ($(shell ldconfig -p | grep libubsan >/dev/null 2>&1; echo $$?), 0)
>>>> + msg := $(error No libubsan found, please install libubsan);
>>>> +endif
>>> Hey, we need to only do that if -fsanitize=address is in EXTRA_CFLAGS,
>>> right?
>> Sorry for the late reply.
>> Maybe -fsanitize=undefined is also needed.
>> Please reference tools/perf/Documentation/Build.txt
> Can you send an updated patch then?
OK, I will send v3 soon.
>
>>> I applied it and got:
>>>
>>> $ rm -rf /tmp/build/perf ; mkdir -p /tmp/build/perf
>>> $ make O=/tmp/build/perf -C tools/perf install-bin
>>> make: Entering directory '/home/acme/git/perf/tools/perf'
>>> BUILD: Doing 'make -j8' parallel build
>>> HOSTCC /tmp/build/perf/fixdep.o
>>> HOSTLD /tmp/build/perf/fixdep-in.o
>>> LINK /tmp/build/perf/fixdep
>>> Warning: Kernel ABI header at 'tools/perf/util/hashmap.h' differs from latest version at 'tools/lib/bpf/hashmap.h'
>>> diff -u tools/perf/util/hashmap.h tools/lib/bpf/hashmap.h
>>> Warning: Kernel ABI header at 'tools/perf/util/hashmap.c' differs from latest version at 'tools/lib/bpf/hashmap.c'
>>> diff -u tools/perf/util/hashmap.c tools/lib/bpf/hashmap.c
>>> Auto-detecting system features:
>>> ... dwarf: [ on ]
>>> ... dwarf_getlocations: [ on ]
>>> ... glibc: [ on ]
>>> ... gtk2: [ on ]
>>> ... libbfd: [ on ]
>>> ... libcap: [ on ]
>>> ... libelf: [ on ]
>>> ... libnuma: [ on ]
>>> ... numa_num_possible_cpus: [ on ]
>>> ... libperl: [ on ]
>>> ... libpython: [ on ]
>>> ... libcrypto: [ on ]
>>> ... libunwind: [ on ]
>>> ... libdw-dwarf-unwind: [ on ]
>>> ... zlib: [ on ]
>>> ... lzma: [ on ]
>>> ... get_cpuid: [ on ]
>>> ... bpf: [ on ]
>>> ... libaio: [ on ]
>>> ... libzstd: [ on ]
>>> ... disassembler-four-args: [ on ]
>>> /home/acme/git/perf/tools/build/Makefile.feature:255: *** No libasan found, please install libasan. Stop.
>>> make[1]: *** [Makefile.perf:231: sub-make] Error 2
>>> make: *** [Makefile:110: install-bin] Error 2
>>> make: Leaving directory '/home/acme/git/perf/tools/perf'
>>> $
>>>
>>> Something enclosed in:
>>>
>>> ifneq ($(filter s% -fsanitize=address%,$(EXTRA_CFLAGS),),)
>>>
>>> Right Jiri?
>>>
>>> - Arnaldo
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2020-06-17 1:56 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-03 6:10 [PATCH v2] tools build: Check libasan and libubsan in Makefile.feature Tiezhu Yang
2020-06-03 11:32 ` Arnaldo Carvalho de Melo
2020-06-15 2:20 ` Tiezhu Yang
2020-06-16 19:39 ` Arnaldo Carvalho de Melo
2020-06-17 1:55 ` Tiezhu Yang
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).