Re: [PATCH 05/54] perf build: Use feature dump file for build-test

From: Arnaldo Carvalho de Melo
Date: Wed Jan 27 2016 - 08:54:28 EST


Em Wed, Jan 27, 2016 at 10:36:54AM +0800, Wangnan (F) escreveu:
> On 2016/1/27 0:59, Arnaldo Carvalho de Melo wrote:
> >Em Mon, Jan 25, 2016 at 09:55:52AM +0000, Wang Nan escreveu:
> >>To prevent feature check run too many times, this patch utilizes
> >>previous introduced feature-dump make target and FEATURES_DUMP
> >>variable, makes sure the feature checkers run only once when doing
> >>build-test for normal test cases.

<SNIP>

> >So, I'm having this problem when this patch is applied.

> [SNIP]
>
> >nothing added to commit but untracked files present (use "git add" to track)
> >[acme@jouet linux]$ rm -f tools/perf/BUILD_TEST_FEATURE_DUMP tools/perf/make_no_libbpf tools/perf/make_no_newt
> >[acme@jouet linux]$ perf stat make -C tools/perf build-test
> >make: Entering directory '/home/acme/git/linux/tools/perf'
> >Testing Makefile
> >- /home/acme/git/linux/tools/perf/BUILD_TEST_FEATURE_DUMP: cd . && make FEATURE_DUMP_COPY=/home/acme/git/linux/tools/perf/BUILD_TEST_FEATURE_DUMP feature-dump
> >cd . && make FEATURE_DUMP_COPY=/home/acme/git/linux/tools/perf/BUILD_TEST_FEATURE_DUMP feature-dump
> >- make_doc: cd . && make -f Makefile DESTDIR=/tmp/tmp.lLyAWJ2KUJ doc FEATURES_DUMP=/home/acme/git/linux/tools/perf/BUILD_TEST_FEATURE_DUMP
> >- make_no_libperl: cd . && make -f Makefile DESTDIR=/tmp/tmp.iPREXpyGhh NO_LIBPERL=1 FEATURES_DUMP=/home/acme/git/linux/tools/perf/BUILD_TEST_FEATURE_DUMP
> >cd . && make -f Makefile DESTDIR=/tmp/tmp.iPREXpyGhh NO_LIBPERL=1 FEATURES_DUMP=/home/acme/git/linux/tools/perf/BUILD_TEST_FEATURE_DUMP
> > BUILD: Doing 'make -j4' parallel build
> > GEN common-cmds.h
> > CC fixdep.o
> > CC perf-read-vdso32
> >In file included from /usr/include/features.h:389:0,
> > from /usr/include/stdio.h:27,
> > from perf-read-vdso.c:1:
> >/usr/include/gnu/stubs.h:7:27: fatal error: gnu/stubs-32.h: No such file or directory
> >compilation terminated.
> >Makefile.perf:416: recipe for target 'perf-read-vdso32' failed
> >make[4]: *** [perf-read-vdso32] Error 1
> >make[4]: *** Waiting for unfinished jobs....
> > LD fixdep-in.o
> > LINK fixdep
> > PERF_VERSION = 4.4.g80fcfd7
> >Makefile:68: recipe for target 'all' failed
> >make[3]: *** [all] Error 2
> > test: test -x ./perf
> >tests/make:274: recipe for target 'make_no_libperl' failed
> >make[2]: *** [make_no_libperl] Error 1
> >tests/make:7: recipe for target 'all' failed
> >make[1]: *** [all] Error 2
> >Makefile:81: recipe for target 'build-test' failed
> >make: *** [build-test] Error 2
> >make: Leaving directory '/home/acme/git/linux/tools/perf'

> This is the problem of test-compile-32. In
> ./tools/build/feature/test-compile.c, we check the '-m32' compiler
> flag but don't check include files.

> Could you please have a look at your environment? Do you have
> glibc-devel-i386 installed? What's the result of

> $ gcc -m32 tools/build/feature/test-compile.c

[acme@jouet linux]$ gcc -m32 tools/build/feature/test-compile.c
/usr/bin/ld: cannot find crt1.o: No such file or directory
/usr/bin/ld: cannot find crti.o: No such file or directory
/usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-redhat-linux/5.3.1/libgcc_s.so when searching for -lgcc_s
/usr/bin/ld: cannot find -lgcc_s
/usr/bin/ld: cannot find -lc
/usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-redhat-linux/5.3.1/libgcc_s.so when searching for -lgcc_s
/usr/bin/ld: cannot find -lgcc_s
/usr/bin/ld: cannot find crtn.o: No such file or directory
collect2: error: ld returned 1 exit status
[acme@jouet linux]$

But this fails, in the same fashion, on my older devel machine, with fedora 21.

> I guess in your platform you can compile and link test-compile.c without
> gnu/stubs-32.h. Then we need to improve test-compile.c to make it check
> headers also.

Yeah, on the old system (fedora 21 x86_64 ivy bridge) there is no stups-32.h
file anywhere, nor in the new one (fedora 23 x86_64 broadwell).

> Another question is why you don't meet this error before this patch. It
> seems test-compile-32 should also pass...

What happened is that I got a new notebook, and in the new one, as you
correctly analysed, probably a file required for building that file is not
present, I'll dig deeper and try to add an informative message about
requirements to the test in question...

But the curious thing is that what I have now in my perf/core branch
passes 'make -C tools/perf build-test', its only when this specific
patch is added that it fails.

I.e. it seems that by reusing the features dump file we're triggering some
conditional compilation differently than without this reuse. I wonder if we
could try first having a mechanism that would do as before, i.e. the feature
detection, and then compare with what is passed via the FEATURES_DUMP= make
command line variable, flagging any difference, that would help us figure out
this problem...

Anyway, I'm running:

make -C tools clean ; perf stat make -C tools/perf build-test

To recheck that it is just when this patch gets applied that the build fails.

- Arnaldo