From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jakub Kicinski Subject: Re: [PATCH bpf-next 3/4] samples: bpf: fix build after move to compiling full libbpf.a Date: Mon, 14 May 2018 13:47:38 -0700 Message-ID: <20180514134738.09dab501@cakuba> References: <20180512001729.21634-1-jakub.kicinski@netronome.com> <20180512001729.21634-4-jakub.kicinski@netronome.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Cc: Alexei Starovoitov , Daniel Borkmann , oss-drivers@netronome.com, netdev , =?UTF-8?B?QmrDtnJuIFTDtnBlbA==?= To: Y Song Return-path: Received: from mail-pf0-f196.google.com ([209.85.192.196]:46617 "EHLO mail-pf0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752051AbeENUrl (ORCPT ); Mon, 14 May 2018 16:47:41 -0400 Received: by mail-pf0-f196.google.com with SMTP id p12-v6so6567461pff.13 for ; Mon, 14 May 2018 13:47:41 -0700 (PDT) In-Reply-To: Sender: netdev-owner@vger.kernel.org List-ID: On Mon, 14 May 2018 12:12:05 -0700, Y Song wrote: > On Fri, May 11, 2018 at 5:17 PM, Jakub Kicinski > wrote: > > There are many ways users may compile samples, some of them got > > broken by commit 5f9380572b4b ("samples: bpf: compile and link > > against full libbpf"). Improve path resolution and make libbpf > > building a dependency of source files to force its build. > > > > Samples should now again build with any of: > > cd samples/bpf; make > > make samples/bpf > > make -C samples/bpf > > cd samples/bpf; make O=3Dbuilddir > > make samples/bpf O=3Dbuilddir > > make -C samples/bpf O=3Dbuilddir =20 >=20 > I typically built samples/bpf/ this way: > export KBUILD_OUTPUT=3D/home/yhs/linux-bld > at linux source directory: > make defconfig > in /home/yhs/linux-bld, > make -j100 && make headers_install && make samples/bpf/ Thanks Yonghong! I will add this to my tests. > With this patch, the build for samples/bpf/ still failed. >=20 > -bash-4.2$ make samples/bpf/ > CHK include/config/kernel.release > Using /data/users/yhs/work/net-next as source for kernel > GEN ./Makefile > CHK include/generated/uapi/linux/version.h > CHK include/generated/utsrelease.h > CHK include/generated/bounds.h > CHK include/generated/timeconst.h > CHK include/generated/asm-offsets.h > CALL /data/users/yhs/work/net-next/scripts/checksyscalls.sh > DESCEND objtool > CHK scripts/mod/devicetable-offsets.h > scripts/Makefile.host:106: target > `samples/bpf//data/users/yhs/work/net-next/samples/bpf/../../tools/lib/bp= f/libbpf.a' > doesn't match the target pattern > make -C /data/users/yhs/work/net-next/samples/bpf/../../tools/lib/bpf/ > O=3D srctree=3D/data/users/yhs/work/net-next/samples/bpf/../../ >=20 > Auto-detecting system features: > ... libelf: [ OFF ] > ... bpf: [ OFF ] >=20 > No libelf found The problem now is that feature detection gets confused about where its output directory is, I think. This is very similar to what Bj=C3=B6rn reported. > make[4]: *** [elfdep] Error 1 > make[3]: *** [/data/users/yhs/work/net-next/samples/bpf/../../tools/lib/b= pf/libbpf.a] > Error 2 > make[2]: *** [samples/bpf/] Error 2 > make[1]: *** [sub-make] Error 2 > make: *** [__sub-make] Error 2 > -bash-4.2$ >=20 > I noticied that I might use BPF_SAMPLES_PATH variable to tell where is > the samples/bpf source. > Below is what I did: > -bash-4.2$ BPF_SAMPLES_PATH=3D../../../net-next/samples/bpf make > samples/bpf/ > CHK include/config/kernel.release > Using /data/users/yhs/work/net-next as source for kernel > GEN ./Makefile > CHK include/generated/uapi/linux/version.h > CHK include/generated/utsrelease.h > CHK include/generated/bounds.h > CHK include/generated/timeconst.h > CHK include/generated/asm-offsets.h > CALL /data/users/yhs/work/net-next/scripts/checksyscalls.sh > DESCEND objtool > CHK scripts/mod/devicetable-offsets.h > scripts/Makefile.host:106: target > `samples/bpf/../../../net-next/samples/bpf/../../tools/lib/bpf/libbpf.a' > doesn't match the target pattern > CHK samples/bpf/syscall_nrs.h > HOSTCC samples/bpf/../../../net-next/samples/bpf/../../tools/lib/bpf/l= ibbpf.a > gcc: fatal error: no input files > compilation terminated. > make[3]: *** [samples/bpf/../../../net-next/samples/bpf/../../tools/lib/b= pf/libbpf.a] > Error 4 > make[2]: *** [samples/bpf/] Error 2 > make[1]: *** [sub-make] Error 2 > make: *** [__sub-make] Error 2 > -bash-4.2$ >=20 > -bash-4.2$ pwd > /home/yhs/work > -bash-4.2$ ls > linux-bld net-next > -bash-4.2$