Re: kselftest build broken?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Jun 12, 2019 at 11:13 AM Dmitry Vyukov <dvyukov@xxxxxxxxxx> wrote:
>
> On Wed, Jun 12, 2019 at 11:09 AM Dmitry Vyukov <dvyukov@xxxxxxxxxx> wrote:
> > > On Tue, Jun 11, 2019 at 9:20 PM shuah <shuah@xxxxxxxxxx> wrote:
> > > >
> > > > On 6/11/19 10:03 AM, Dmitry Vyukov wrote:
> > > > > On Tue, Jun 11, 2019 at 5:16 PM shuah <shuah@xxxxxxxxxx> wrote:
> > > > >>
> > > > >> Hi Dmitry,
> > > > >>
> > > > >> On 6/11/19 4:30 AM, Dmitry Vyukov wrote:
> > > > >>> Hi,
> > > > >>>
> > > > >>> I've tried to build kselftests for several years now, but I always
> > > > >>> find the build broken. Which makes me wonder if the instructions are
> > > > >>> broken or something. I follow the instructions in
> > > > >>> Documentation/dev-tools/kselftest.rst and start with "make -C
> > > > >>> tools/testing/selftests". Here is the errors I get on the upstream
> > > > >>> commit 16d72dd4891fecc1e1bf7ca193bb7d5b9804c038:
> > > > >>>> error: unable to create target: 'No available targets are compatible
> > > > >>> with triple "bpf"'
> > > > >>> 1 error generated.
> > > > >>> Makefile:259: recipe for target 'elfdep' failed
> > > > >>> Makefile:156: recipe for target 'all' failed
> > > > >>> Makefile:106: recipe for target
> > > > >>> '/linux/tools/testing/selftests/bpf/libbpf.a' failed
> > > > >>> test_execve.c:4:10: fatal error: cap-ng.h: No such file or directory
> > > > >>
> > > > >> These errors are due to missing dependencies. You will need
> > > > >>
> > > > >> libmount-dev
> > > > >> libcap-ng-dev
> > > > >> libelf-dev
> > > > >>
> > > > >> for bpf to build and also clang
> > > > >>
> > > > >>> ../lib.mk:138: recipe for target
> > > > >>> '/linux/tools/testing/selftests/capabilities/test_execve' failed
> > > > >>> gpio-mockup-chardev.c:20:10: fatal error: libmount.h: No such file or directory > <builtin>: recipe for target 'gpio-mockup-chardev' failed
> > > > >>> fuse_mnt.c:17:10: fatal error: fuse.h: No such file or directory
> > > > >>
> > > > >> libfuse-dev is missing.
> > > > >>
> > > > >>> ../lib.mk:138: recipe for target
> > > > >>> '/linux/tools/testing/selftests/memfd/fuse_mnt' failed
> > > > >>> collect2: error: ld returned 1 exit status
> > > > >>> ../lib.mk:138: recipe for target
> > > > >>> '/linux/tools/testing/selftests/mqueue/mq_open_tests' failed
> > > > >>
> > > > >> Needs libpopt-dev
> > > > >>
> > > > >>> reuseport_bpf_numa.c:24:10: fatal error: numa.h: No such file or directory
> > > > >>
> > > > >> Needs libnuma-dev
> > > > >>
> > > > >>> ../lib.mk:138: recipe for target
> > > > >>> '/linux/tools/testing/selftests/net/reuseport_bpf_numa' failed
> > > > >>> mlock-random-test.c:8:10: fatal error: sys/capability.h: No such file
> > > > >>> or directory > ../lib.mk:138: recipe for target
> > > > >>> '/linux/tools/testing/selftests/vm/mlock-random-test' failed
> > > > >>>
> > > > >>> Here is full log:
> > > > >>>
> > > > >>> https://gist.githubusercontent.com/dvyukov/47430636e160f297b657df5ba2efa82b/raw/7babc4db228b88f341a376c15e8bc9c4c3b02160/gistfile1.txt
> > > > >>>
> > > > >>> I have libelf-dev installed. Do I need to install something else? Or
> > > > >>> run some other command?
> > > > >>
> > > > >> ii  libelf-dev:amd 0.170-0.4ubu amd64        libelf1 development
> > > > >> libraries and
> > > > >> ii  libelf1:amd64  0.170-0.4ubu amd64        library to read and write
> > > > >> ELF fil
> > > > >>
> > > > >>
> > > > >> All of the above built for me on Linux 5.2-rc4. Try installing all of
> > > > >> these and let me know if you still see problems.
> > > > >
> > > > >
> > > > > Hi Shuah,
> > > > >
> > > > > Thanks for quick reply!
> > > > >
> > > > > I've installed these: libmount-dev libcap-ng-dev libfuse-dev
> > > > > libpopt-dev libnuma-dev.
> > > > > libelf-dev I already had. And for clang I switched to distro-provided one.
> > > > >
> > > > > This reduced number of errors, but I still see some:
> > > > >
> > > > > clang: error: unable to execute command: Broken pipe
> > > > > clang: error: clang frontend command failed due to signal (use -v to
> > > > > see invocation)
> > > > > Makefile:259: recipe for target 'elfdep' failed
> > > > > Makefile:156: recipe for target 'all' failed
> > > > > Makefile:106: recipe for target
> > > > > '/linux/tools/testing/selftests/bpf/libbpf.a' failed
> > > >
> > > > Getting bpf compile to work take a few steps. If I remember correctly,
> > > > You will need llvm as well. Here is what I have on my system:
> > > >
> > > > ii  libllvm6.0:amd 1:6.0-1ubunt amd64        Modular compiler and
> > > > toolchain te
> > > > ii  llvm           1:6.0-41~exp amd64        Low-Level Virtual Machine
> > > > (LLVM)
> > > > ii  llvm-6.0       1:6.0-1ubunt amd64        Modular compiler and
> > > > toolchain te
> > > > ii  llvm-6.0-dev   1:6.0-1ubunt amd64        Modular compiler and
> > > > toolchain te
> > > > un  llvm-6.0-doc   <none>       <none>       (no description available)
> > > > ii  llvm-6.0-runti 1:6.0-1ubunt amd64        Modular compiler and
> > > > toolchain te
> > > > ii  llvm-runtime   1:6.0-41~exp amd64        Low-Level Virtual Machine
> > > > (LLVM),
> > > >
> > > > > timestamping.c:249:19: error: ‘SIOCGSTAMP’ undeclared (first use in
> > > > > this function); did you mean ‘SIOCGSTAMPNS’?
> > > > > ../../lib.mk:138: recipe for target
> > > > > '/linux/tools/testing/selftests/networking/timestamping/timestamping'
> > > > > failed
> > > > > mlock-random-test.c:8:10: fatal error: sys/capability.h: No such file
> > > > > or directory
> > > >
> > > > Do you have libcap-dev installed?
> > > >
> > > > ii  libcap-dev:amd 1:2.25-1.2   amd64        POSIX 1003.1e capabilities
> > > > (devel
> > > > ii  libcap-ng-dev  0.7.7-3.1    amd64        Development and header
> > > > files for
> > > > ii  libcap-ng0:amd 0.7.7-3.1    amd64        An alternate POSIX
> > > > capabilities l
> > > > ii  libcap2:amd64  1:2.25-1.2   amd64        POSIX 1003.1e capabilities
> > > > (libra
> > > > ii  libcap2-bin    1:2.25-1.2   amd64        POSIX 1003.1e capabilities
> > > > (utili
> > > > un  libcap2-dev    <none>       <none>       (no description available)
> > >
> > > I've installed libcap-dev and resolved the missing header.
> > >
> > > I've also installed llvm llvm-6.0  llvm-6.0-dev  llvm-6.0-doc
> > > libllvm6.0  llvm-6.0-runtime llvm-runtime and it fixed crashing
> > > compiler.
> > > But bpf tests build was still failing due to missing libelf. But I had
> > > the library, so I went and removed some random files:
> > > tools/testing/selftests/bpf/{feature,FEATURE-DUMP.libbpf}. Don't ask
> > > me why these.
> > >
> > > I am now down to just 1 build error:
> > >
> > >   CC       /usr/local/google/home/dvyukov/src/linux/tools/testing/selftests/bpf/str_error.o
> > > timestamping.c:249:19: error: ‘SIOCGSTAMP’ undeclared (first use in
> > > this function); did you mean ‘SIOCGSTAMPNS’?
> >
> >
> > Is this a non-fatal error? Usually when make produces errors, one
> > expects that nothing is done and it was aborted mid-way. But make
> > seems to produce some test binaries by now.
> >
> >
> > Reading the doc further, these command seem to implicitly assume that
> > the tests will run right on my host machine:
> >
> >   $ make -C tools/testing/selftests run_tests
> >   $ make kselftest
> >
> > Is it right? At least I don't see how it's configured to run them
> > somewhere else? Or it uses something like qemu by default to run the
> > kernel under test?
> > If it runs the tests on the host, it can't work for me. I don't have
> > the test kernel installed and there is no way I can do this. Policy
> > rules aside, this is yet untested kernel, so by installing it I am
> > risking losing my whole machine and all data...
> >
> > What am I missing?
>
> Reading further. "Install selftests" and "Running installed selftests"
> sections. Is it something I can use to copy the pre-built tests to the
> test machine? The sections don't spell it, so I am just trying to
> second guess. Or what's the purpose of installing?
>
> The "Running installed selftests" section says:
> "Kselftest install as well as the Kselftest tarball provide a script
> named "run_kselftest.sh" to run the tests".
>
> What is the "Kselftest tarball"? Where does one get one? I don't see
> any mentions of "tarball" anywhere else in the doc.



Running ./kselftest_install.sh I am getting:

/bin/sh: llvm-readelf: command not found

I can't find any package that would provide this. I happened to have a
custom llvm build that has that binary, but I am interested how I was
supposed to get this for the purposes of documentation and reuse of
instructions by others.

After adding my llvm-readelf to PATH, I am then getting:

make[1]: *** No rule to make target 'emit_tests'.  Stop.

Looks like an error, or is it?

It produced something in the output dir, so copied that to the test
machine and tried to run run_kselftest.sh there, but it failed too:

~/kselftest# ./run_kselftest.sh
./run_kselftest.sh: 2: ./run_kselftest.sh: realpath: not found
./run_kselftest.sh: 4: .: Can't open ./kselftest/runner.sh

Is there some kind of prerequisites that I am supposed to install there?
Since the target may have non-x86 arch and a custom distro, any
additional dependency there may be very painful to get...




[Index of Archives]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux