Re: [PATCH v2 3/9] perf build: Test correct path of perf in build-test
From: Wangnan (F)
Date: Thu Jan 14 2016 - 21:59:55 EST
On 2016/1/14 23:44, Arnaldo Carvalho de Melo wrote:
Em Thu, Jan 14, 2016 at 11:08:11PM +0800, pi3orama escreveu:
åèæç iPhone
å 2016å1æ14æïäå10:58ïArnaldo Carvalho de Melo <acme@xxxxxxxxxx> åéï
Em Thu, Jan 14, 2016 at 11:50:21AM -0300, Arnaldo Carvalho de Melo escreveu:
Em Thu, Jan 14, 2016 at 01:13:57PM +0000, Wang Nan escreveu:
If an 'O' is passed to 'make build-test', many 'test -x' and 'test -f'
will fail because perf resides in a different directory. Fix this by
computing PERF_OUT according to 'O' and test correct output files.
For make_kernelsrc and make_kernelsrc_tools, set KBUILD_OUTPUT_DIR
instead because the path is different from others ($(O)/perf vs
$(O)/tools/perf).
So, before this patch:
Also, while trying to get this to work, I found these places lacking the
O= prefixing, right?
diff --git a/tools/perf/tests/make b/tools/perf/tests/make
index e74c86b00c31..67842900482e 100644
--- a/tools/perf/tests/make
+++ b/tools/perf/tests/make
@@ -59,7 +59,7 @@ has = $(shell which $1 2>/dev/null)
# standard single make variable specified
make_clean_all := clean all
-make_python_perf_so := python/perf.so
+make_python_perf_so := $(PERF_O)/python/perf.so
make_debug := DEBUG=1
make_no_libperl := NO_LIBPERL=1
make_no_libpython := NO_LIBPYTHON=1
@@ -82,9 +82,9 @@ make_tags := tags
make_cscope := cscope
make_help := help
make_doc := doc
-make_perf_o := perf.o
-make_util_map_o := util/map.o
-make_util_pmu_bison_o := util/pmu-bison.o
+make_perf_o := $(PERF_O)/perf.o
+make_util_map_o := $(PERF_O)/util/map.o
+make_util_pmu_bison_o := $(PERF_O)/util/pmu-bison.o
make_install := install
make_install_bin := install-bin
make_install_doc := install-doc
I have throughly tested this patch set, both
with and without O, many times, and see no
error related to this part of code, so I think
we don't really need this prefix.
But maybe there's error I never noticed.
Let me check it tomorrow.
Ok, but are you testing it patch after patch or just after all the
patches in this series are applied?
Here, with up to:
I am getting 'make clean' related errors after some tests on a RHEL7.1
test machine:
- make_no_libunwind: cd . && make -f Makefile DESTDIR=/tmp/tmp.CKrCzt1X85 NO_LIBUNWIND=1
find: â/home/acme/git/linux/tools/perf/tests/dso-data.oâ: No such file or directory
find: â/home/acme/git/linux/tools/perf/tests/.dso-data.o.cmdâ: No such file or directory
find: â/home/acme/git/linux/tools/perf/tests/pmu.oâ: No such file or directory
find: â/home/acme/git/linux/tools/perf/tests/sw-clock.oâ: No such file or directory
find: â/home/acme/git/linux/tools/perf/tests/.sample-parsing.o.cmdâ: No such file or directory
find: â/home/acme/git/linux/tools/perf/tests/attr.oâ: No such file or directory
- make_help: cd . && make -f Makefile DESTDIR=/tmp/tmp.9Gcw1OfooR help
- make_no_slang: cd . && make -f Makefile DESTDIR=/tmp/tmp.Ce5PSg2snH NO_SLANG=1
And 'build-test' fails when it tries to run the 'make_static' target and that
is not the first one to be run:
- make_no_libelf: cd . && make -f Makefile DESTDIR=/tmp/tmp.tEwrxaQPOB NO_LIBELF=1
- make_no_libdw_dwarf_unwind: cd . && make -f Makefile DESTDIR=/tmp/tmp.4r7zlxeeAA NO_LIBDW_DWARF_UNWIND=1
- make_no_libnuma: cd . && make -f Makefile DESTDIR=/tmp/tmp.XuaZ3SACwX NO_LIBNUMA=1
- make_perf_o: cd . && make -f Makefile DESTDIR=/tmp/tmp.LXh3STdaiO perf.o
- make_static: cd . && make -f Makefile DESTDIR=/tmp/tmp.xii2W5SLf2 LDFLAGS=-static
cd . && make -f Makefile DESTDIR=/tmp/tmp.xii2W5SLf2 LDFLAGS=-static
BUILD: Doing 'make -j4' parallel build
Auto-detecting system features:
... dwarf: [ on ]
... glibc: [ on ]
... gtk2: [ on ]
... libaudit: [ on ]
... libbfd: [ on ]
... libelf: [ on ]
... libnuma: [ on ]
... numa_num_possible_cpus: [ on ]
... libperl: [ on ]
... libpython: [ on ]
... libslang: [ on ]
... libunwind: [ on ]
... libdw-dwarf-unwind: [ on ]
... zlib: [ on ]
... lzma: [ on ]
... get_cpuid: [ on ]
... bpf: [ on ]
Look at this feature detection result.
Auto-detecting system features:
... dwarf: [ OFF ]
... glibc: [ on ]
... gtk2: [ OFF ]
... libaudit: [ OFF ]
... libbfd: [ OFF ]
... libelf: [ on ]
... libnuma: [ OFF ]
... numa_num_possible_cpus: [ OFF ]
... libperl: [ OFF ]
... libpython: [ OFF ]
... libslang: [ OFF ]
... libunwind: [ OFF ]
... libdw-dwarf-unwind: [ OFF ]
... zlib: [ OFF ]
... lzma: [ OFF ]
... get_cpuid: [ on ]
... bpf: [ on ]
And this one.
They are different.
I reproduced this error in my environment. The reason is: if we use
'make clean O=something', the 'bin' files created by feature testing
won't be removed. Not related to my work. Here I give an example:
tools/perf> make clean
tools/perf> make
BUILD: Doing 'make -j24' parallel build
Auto-detecting system features:
... dwarf: [ on ]
... glibc: [ on ]
... gtk2: [ OFF ]
... libaudit: [ OFF ]
... libbfd: [ OFF ]
... libelf: [ on ]
... libnuma: [ OFF ]
... numa_num_possible_cpus: [ OFF ]
... libperl: [ on ]
... libpython: [ on ]
... libslang: [ OFF ]
... libunwind: [ OFF ]
... libdw-dwarf-unwind: [ on ]
... zlib: [ on ]
... lzma: [ on ]
... get_cpuid: [ on ]
... bpf: [ on ]
<SNIP>
tools/perf> make clean O=.
tools/perf> make LDFLAGS='-static'
BUILD: Doing 'make -j24' parallel build
Auto-detecting system features:
... dwarf: [ on ]
... glibc: [ on ]
... gtk2: [ OFF ]
... libaudit: [ OFF ]
... libbfd: [ OFF ]
... libelf: [ on ]
... libnuma: [ OFF ]
... numa_num_possible_cpus: [ OFF ]
... libperl: [ on ]
... libpython: [ on ]
... libslang: [ OFF ]
... libunwind: [ OFF ]
... libdw-dwarf-unwind: [ on ]
... zlib: [ on ]
... lzma: [ on ]
... get_cpuid: [ on ]
... bpf: [ on ]
config/Makefile:342: No libunwind found. Please install
libunwind-dev[el] >= 1.1 and/or set LIBUNWIND_DIR
config/Makefile:401: No libaudit.h found, disables 'trace' tool, please
install audit-libs-devel or libaudit-dev
config/Makefile:416: slang not found, disables TUI support. Please
install slang-devel or libslang-dev
config/Makefile:430: GTK2 not found, disables GTK2 support. Please
install gtk2-devel or libgtk2.0-dev
config/Makefile:562: No bfd.h/libbfd found, please install
binutils-dev[el]/zlib-static/libiberty-dev to gain symbol demangling
config/Makefile:604: No numa.h found, disables 'perf bench numa mem'
benchmark, please install numactl-devel/libnuma-devel/libnuma-dev
...
/home/w00229757/kernel-hydrogen/tools/lib/traceevent/libtraceevent.a(libtraceevent-in.o):
In function `load_plugin':
/home/w00229757/kernel-hydrogen/tools/lib/traceevent/event-plugin.c:304:
warning: Using 'dlopen' in statically linked applications requires at
runtime the shared libraries from the glibc version used for linking
/tmp/oxygen_root-w00229757/usr/bin/../lib64/gcc/x86_64-oe-linux/4.8.1/../../../../x86_64-oe-linux/bin/ld:
cannot find -llzma
/tmp/oxygen_root-w00229757/usr/bin/../lib64/gcc/x86_64-oe-linux/4.8.1/../../../../x86_64-oe-linux/bin/ld:
cannot find -lperl
libperf.a(libperf-in.o): In function `target__parse_uid':
/home/w00229757/kernel-hydrogen/tools/perf/util/target.c:79: warning:
Using 'getpwnam_r' in statically linked applications requires at runtime
the shared libraries from the glibc version used for linking
/home/w00229757/kernel-hydrogen/tools/perf/util/target.c:91: warning:
Using 'getpwuid_r' in statically linked applications requires at runtime
the shared libraries from the glibc version used for linking
/tmp/oxygen_root-w00229757/usr/bin/../lib64/gcc/x86_64-oe-linux/4.8.1/../../../../x86_64-oe-linux/bin/ld:
cannot find -llzma
collect2: error: ld returned 1 exit status
...
Result of feature testing is similar.
tools/perf> make clean
tools/perf> make LDFLAGS='-static'
BUILD: Doing 'make -j24' parallel build
Auto-detecting system features:
... dwarf: [ OFF ]
... glibc: [ on ]
... gtk2: [ OFF ]
... libaudit: [ OFF ]
... libbfd: [ OFF ]
... libelf: [ on ]
... libnuma: [ OFF ]
... numa_num_possible_cpus: [ OFF ]
... libperl: [ OFF ]
... libpython: [ OFF ]
... libslang: [ OFF ]
... libunwind: [ OFF ]
... libdw-dwarf-unwind: [ OFF ]
... zlib: [ on ]
... lzma: [ OFF ]
... get_cpuid: [ on ]
... bpf: [ on ]
...
Good result.
Look at [1]. Here's a similar problem I reported to Jiri.
Concultion: the reason of the problem you met is because 'make clean
O=.' doesn't clean
feature test results. In v1 I have:
-clean := @(cd $(PERF); make -s -f $(MK) clean >/dev/null)
+clean := @(cd $(PERF); make -s -f $(MK) O=$(PERF_OUT) clean >/dev/null;
make -s -f $(MK) clean >/dev/null)
(two 'make clean' here for safety)
But removes them in v2. The second 'make clean' would remove any feature
testing
results and return good testing result for you. This also explain why I
never met failure
like this: if patch 4 - 9 are applied, make static would use feature dump.
Let me see how to remove feature testing results.
[1] http://lkml.kernel.org/g/5694C73C.3070007@xxxxxxxxxx