bpf.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] samples: bpf: fix outdated README build command
@ 2019-11-10  8:19 Daniel T. Lee
  2019-11-11  6:09 ` Andrii Nakryiko
  2019-11-11 13:58 ` Daniel Borkmann
  0 siblings, 2 replies; 7+ messages in thread
From: Daniel T. Lee @ 2019-11-10  8:19 UTC (permalink / raw)
  To: Daniel Borkmann, Alexei Starovoitov, Björn Töpel,
	Andrii Nakryiko
  Cc: netdev, bpf

Currently, building the bpf samples under samples/bpf directory isn't
working. Running make from the directory 'samples/bpf' will just shows
following result without compiling any samples.

 $ make
 make -C ../../ /git/linux/samples/bpf/ BPF_SAMPLES_PATH=/git/linux/samples/bpf
 make[1]: Entering directory '/git/linux'
   CALL    scripts/checksyscalls.sh
   CALL    scripts/atomic/check-atomics.sh
   DESCEND  objtool
 make[1]: Leaving directory '/git/linux'

Due to commit 394053f4a4b3 ("kbuild: make single targets work more
correctly"), building samples/bpf without support of samples/Makefile
is unavailable. Instead, building the samples with 'make M=samples/bpf'
from the root source directory will solve this issue.[1]

This commit fixes the outdated README build command with samples/bpf.

[0]: https://patchwork.kernel.org/patch/11168393/

Signed-off-by: Daniel T. Lee <danieltimlee@gmail.com>
---
 samples/bpf/README.rst | 19 +++++++++----------
 1 file changed, 9 insertions(+), 10 deletions(-)

diff --git a/samples/bpf/README.rst b/samples/bpf/README.rst
index 5f27e4faca50..bfd2405705ed 100644
--- a/samples/bpf/README.rst
+++ b/samples/bpf/README.rst
@@ -32,12 +32,10 @@ Compiling
 For building the BPF samples, issue the below command from the kernel
 top level directory::
 
- make samples/bpf/
+ make M=samples/bpf
 
-Do notice the "/" slash after the directory name.
-
-It is also possible to call make from this directory.  This will just
-hide the the invocation of make as above with the appended "/".
+Due to samples/bpf cannot be built without support in the
+samples/Makefile, it is unavailable to call make from this directory.
 
 Manually compiling LLVM with 'bpf' support
 ------------------------------------------
@@ -63,14 +61,15 @@ Quick sniplet for manually compiling LLVM and clang
 It is also possible to point make to the newly compiled 'llc' or
 'clang' command via redefining LLC or CLANG on the make command line::
 
- make samples/bpf/ LLC=~/git/llvm/build/bin/llc CLANG=~/git/llvm/build/bin/clang
+ make M=samples/bpf LLC=~/git/llvm/build/bin/llc CLANG=~/git/llvm/build/bin/clang
 
 Cross compiling samples
 -----------------------
 In order to cross-compile, say for arm64 targets, export CROSS_COMPILE and ARCH
 environment variables before calling make. This will direct make to build
-samples for the cross target.
+samples for the cross target.::
+
+ export ARCH=arm64
+ export CROSS_COMPILE="aarch64-linux-gnu-"
+ make M=samples/bpf LLC=~/git/llvm/build/bin/llc CLANG=~/git/llvm/build/bin/clang
 
-export ARCH=arm64
-export CROSS_COMPILE="aarch64-linux-gnu-"
-make samples/bpf/ LLC=~/git/llvm/build/bin/llc CLANG=~/git/llvm/build/bin/clang
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH] samples: bpf: fix outdated README build command
  2019-11-10  8:19 [PATCH] samples: bpf: fix outdated README build command Daniel T. Lee
@ 2019-11-11  6:09 ` Andrii Nakryiko
  2019-11-11  9:24   ` Toke Høiland-Jørgensen
  2019-11-12 11:45   ` Daniel T. Lee
  2019-11-11 13:58 ` Daniel Borkmann
  1 sibling, 2 replies; 7+ messages in thread
From: Andrii Nakryiko @ 2019-11-11  6:09 UTC (permalink / raw)
  To: Daniel T. Lee
  Cc: Daniel Borkmann, Alexei Starovoitov, Björn Töpel,
	Andrii Nakryiko, Networking, bpf

On Sun, Nov 10, 2019 at 12:19 AM Daniel T. Lee <danieltimlee@gmail.com> wrote:
>
> Currently, building the bpf samples under samples/bpf directory isn't
> working. Running make from the directory 'samples/bpf' will just shows
> following result without compiling any samples.
>

Do you mind trying to see if it's possible to detect that plain `make`
is being run from samples/bpf subdirectory, and if that's the case,
just running something like `make M=samples/bpf -C ../../`? If that's
not too hard, it would be a nice touch to still have it working old
(and intuitive) way, IMO.


>  $ make
>  make -C ../../ /git/linux/samples/bpf/ BPF_SAMPLES_PATH=/git/linux/samples/bpf
>  make[1]: Entering directory '/git/linux'
>    CALL    scripts/checksyscalls.sh
>    CALL    scripts/atomic/check-atomics.sh
>    DESCEND  objtool
>  make[1]: Leaving directory '/git/linux'
>
> Due to commit 394053f4a4b3 ("kbuild: make single targets work more
> correctly"), building samples/bpf without support of samples/Makefile
> is unavailable. Instead, building the samples with 'make M=samples/bpf'
> from the root source directory will solve this issue.[1]
>
> This commit fixes the outdated README build command with samples/bpf.
>
> [0]: https://patchwork.kernel.org/patch/11168393/
>
> Signed-off-by: Daniel T. Lee <danieltimlee@gmail.com>
> ---
>  samples/bpf/README.rst | 19 +++++++++----------
>  1 file changed, 9 insertions(+), 10 deletions(-)
>

[...]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] samples: bpf: fix outdated README build command
  2019-11-11  6:09 ` Andrii Nakryiko
@ 2019-11-11  9:24   ` Toke Høiland-Jørgensen
  2019-11-12 11:47     ` Daniel T. Lee
  2019-11-12 11:45   ` Daniel T. Lee
  1 sibling, 1 reply; 7+ messages in thread
From: Toke Høiland-Jørgensen @ 2019-11-11  9:24 UTC (permalink / raw)
  To: Andrii Nakryiko, Daniel T. Lee
  Cc: Daniel Borkmann, Alexei Starovoitov, Björn Töpel,
	Andrii Nakryiko, Networking, bpf

Andrii Nakryiko <andrii.nakryiko@gmail.com> writes:

> On Sun, Nov 10, 2019 at 12:19 AM Daniel T. Lee <danieltimlee@gmail.com> wrote:
>>
>> Currently, building the bpf samples under samples/bpf directory isn't
>> working. Running make from the directory 'samples/bpf' will just shows
>> following result without compiling any samples.
>>
>
> Do you mind trying to see if it's possible to detect that plain `make`
> is being run from samples/bpf subdirectory, and if that's the case,
> just running something like `make M=samples/bpf -C ../../`? If that's
> not too hard, it would be a nice touch to still have it working old
> (and intuitive) way, IMO.

I think it's just the M= that's missing. Tentatively, the below seems to
work for me (I get some other compile errors, but I think that is
unrelated).

-Toke


diff --git a/samples/bpf/Makefile b/samples/bpf/Makefile
index 8a9af3ab7769..48e7f1ff7861 100644
--- a/samples/bpf/Makefile
+++ b/samples/bpf/Makefile
@@ -246,7 +246,7 @@ endif
 
 # Trick to allow make to be run from this directory
 all:
-       $(MAKE) -C ../../ $(CURDIR)/ BPF_SAMPLES_PATH=$(CURDIR)
+       $(MAKE) -C ../../ M=$(CURDIR) BPF_SAMPLES_PATH=$(CURDIR)
 
 clean:
        $(MAKE) -C ../../ M=$(CURDIR) clean


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH] samples: bpf: fix outdated README build command
  2019-11-10  8:19 [PATCH] samples: bpf: fix outdated README build command Daniel T. Lee
  2019-11-11  6:09 ` Andrii Nakryiko
@ 2019-11-11 13:58 ` Daniel Borkmann
  2019-11-12 11:48   ` Daniel T. Lee
  1 sibling, 1 reply; 7+ messages in thread
From: Daniel Borkmann @ 2019-11-11 13:58 UTC (permalink / raw)
  To: Daniel T. Lee, Alexei Starovoitov, Björn Töpel,
	Andrii Nakryiko
  Cc: netdev, bpf

On 11/10/19 9:19 AM, Daniel T. Lee wrote:
> Currently, building the bpf samples under samples/bpf directory isn't
> working. Running make from the directory 'samples/bpf' will just shows
> following result without compiling any samples.
> 
>   $ make
>   make -C ../../ /git/linux/samples/bpf/ BPF_SAMPLES_PATH=/git/linux/samples/bpf
>   make[1]: Entering directory '/git/linux'
>     CALL    scripts/checksyscalls.sh
>     CALL    scripts/atomic/check-atomics.sh
>     DESCEND  objtool
>   make[1]: Leaving directory '/git/linux'
> 
> Due to commit 394053f4a4b3 ("kbuild: make single targets work more
> correctly"), building samples/bpf without support of samples/Makefile
> is unavailable. Instead, building the samples with 'make M=samples/bpf'
> from the root source directory will solve this issue.[1]
> 
> This commit fixes the outdated README build command with samples/bpf.
> 
> [0]: https://patchwork.kernel.org/patch/11168393/
> 
> Signed-off-by: Daniel T. Lee <danieltimlee@gmail.com>

Thanks for the patch, Daniel! Looks like it's not rebased to the latest bpf-next
tree and therefore doesn't apply cleanly.

Meanwhile, https://patchwork.ozlabs.org/patch/1192639/ was sent which addresses
the same issue.

Best,
Daniel

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] samples: bpf: fix outdated README build command
  2019-11-11  6:09 ` Andrii Nakryiko
  2019-11-11  9:24   ` Toke Høiland-Jørgensen
@ 2019-11-12 11:45   ` Daniel T. Lee
  1 sibling, 0 replies; 7+ messages in thread
From: Daniel T. Lee @ 2019-11-12 11:45 UTC (permalink / raw)
  To: Andrii Nakryiko
  Cc: Daniel Borkmann, Alexei Starovoitov, Björn Töpel,
	Andrii Nakryiko, Networking, bpf

On Mon, Nov 11, 2019 at 3:09 PM Andrii Nakryiko
<andrii.nakryiko@gmail.com> wrote:
>
> On Sun, Nov 10, 2019 at 12:19 AM Daniel T. Lee <danieltimlee@gmail.com> wrote:
> >
> > Currently, building the bpf samples under samples/bpf directory isn't
> > working. Running make from the directory 'samples/bpf' will just shows
> > following result without compiling any samples.
> >
>
> Do you mind trying to see if it's possible to detect that plain `make`
> is being run from samples/bpf subdirectory, and if that's the case,
> just running something like `make M=samples/bpf -C ../../`? If that's
> not too hard, it would be a nice touch to still have it working old
> (and intuitive) way, IMO.
>

Thanks for the review!
And seems it works with `make M=samples/bpf -C ../../` and it's better
solution!

It's just the issue has been solved as Daniel Borkmann mentioned.
Anyway, thanks for the review!

Best,
Daniel

>
> >  $ make
> >  make -C ../../ /git/linux/samples/bpf/ BPF_SAMPLES_PATH=/git/linux/samples/bpf
> >  make[1]: Entering directory '/git/linux'
> >    CALL    scripts/checksyscalls.sh
> >    CALL    scripts/atomic/check-atomics.sh
> >    DESCEND  objtool
> >  make[1]: Leaving directory '/git/linux'
> >
> > Due to commit 394053f4a4b3 ("kbuild: make single targets work more
> > correctly"), building samples/bpf without support of samples/Makefile
> > is unavailable. Instead, building the samples with 'make M=samples/bpf'
> > from the root source directory will solve this issue.[1]
> >
> > This commit fixes the outdated README build command with samples/bpf.
> >
> > [0]: https://patchwork.kernel.org/patch/11168393/
> >
> > Signed-off-by: Daniel T. Lee <danieltimlee@gmail.com>
> > ---
> >  samples/bpf/README.rst | 19 +++++++++----------
> >  1 file changed, 9 insertions(+), 10 deletions(-)
> >
>
> [...]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] samples: bpf: fix outdated README build command
  2019-11-11  9:24   ` Toke Høiland-Jørgensen
@ 2019-11-12 11:47     ` Daniel T. Lee
  0 siblings, 0 replies; 7+ messages in thread
From: Daniel T. Lee @ 2019-11-12 11:47 UTC (permalink / raw)
  To: Toke Høiland-Jørgensen
  Cc: Andrii Nakryiko, Daniel Borkmann, Alexei Starovoitov,
	Björn Töpel, Andrii Nakryiko, Networking, bpf

On Mon, Nov 11, 2019 at 6:24 PM Toke Høiland-Jørgensen
<thoiland@redhat.com> wrote:
>
> Andrii Nakryiko <andrii.nakryiko@gmail.com> writes:
>
> > On Sun, Nov 10, 2019 at 12:19 AM Daniel T. Lee <danieltimlee@gmail.com> wrote:
> >>
> >> Currently, building the bpf samples under samples/bpf directory isn't
> >> working. Running make from the directory 'samples/bpf' will just shows
> >> following result without compiling any samples.
> >>
> >
> > Do you mind trying to see if it's possible to detect that plain `make`
> > is being run from samples/bpf subdirectory, and if that's the case,
> > just running something like `make M=samples/bpf -C ../../`? If that's
> > not too hard, it would be a nice touch to still have it working old
> > (and intuitive) way, IMO.
>
> I think it's just the M= that's missing. Tentatively, the below seems to
> work for me (I get some other compile errors, but I think that is
> unrelated).
>
> -Toke
>
>

Thanks for the review!
Modifying the Makefile seems better solution!

Again, It's just the issue has been solved as Daniel Borkmann mentioned.
Thanks for the review!

Best,
Daniel

> diff --git a/samples/bpf/Makefile b/samples/bpf/Makefile
> index 8a9af3ab7769..48e7f1ff7861 100644
> --- a/samples/bpf/Makefile
> +++ b/samples/bpf/Makefile
> @@ -246,7 +246,7 @@ endif
>
>  # Trick to allow make to be run from this directory
>  all:
> -       $(MAKE) -C ../../ $(CURDIR)/ BPF_SAMPLES_PATH=$(CURDIR)
> +       $(MAKE) -C ../../ M=$(CURDIR) BPF_SAMPLES_PATH=$(CURDIR)
>
>  clean:
>         $(MAKE) -C ../../ M=$(CURDIR) clean
>

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] samples: bpf: fix outdated README build command
  2019-11-11 13:58 ` Daniel Borkmann
@ 2019-11-12 11:48   ` Daniel T. Lee
  0 siblings, 0 replies; 7+ messages in thread
From: Daniel T. Lee @ 2019-11-12 11:48 UTC (permalink / raw)
  To: Daniel Borkmann
  Cc: Alexei Starovoitov, Björn Töpel, Andrii Nakryiko, netdev, bpf

On Mon, Nov 11, 2019 at 10:58 PM Daniel Borkmann <daniel@iogearbox.net> wrote:
>
> On 11/10/19 9:19 AM, Daniel T. Lee wrote:
> > Currently, building the bpf samples under samples/bpf directory isn't
> > working. Running make from the directory 'samples/bpf' will just shows
> > following result without compiling any samples.
> >
> >   $ make
> >   make -C ../../ /git/linux/samples/bpf/ BPF_SAMPLES_PATH=/git/linux/samples/bpf
> >   make[1]: Entering directory '/git/linux'
> >     CALL    scripts/checksyscalls.sh
> >     CALL    scripts/atomic/check-atomics.sh
> >     DESCEND  objtool
> >   make[1]: Leaving directory '/git/linux'
> >
> > Due to commit 394053f4a4b3 ("kbuild: make single targets work more
> > correctly"), building samples/bpf without support of samples/Makefile
> > is unavailable. Instead, building the samples with 'make M=samples/bpf'
> > from the root source directory will solve this issue.[1]
> >
> > This commit fixes the outdated README build command with samples/bpf.
> >
> > [0]: https://patchwork.kernel.org/patch/11168393/
> >
> > Signed-off-by: Daniel T. Lee <danieltimlee@gmail.com>
>
> Thanks for the patch, Daniel! Looks like it's not rebased to the latest bpf-next
> tree and therefore doesn't apply cleanly.
>
> Meanwhile, https://patchwork.ozlabs.org/patch/1192639/ was sent which addresses
> the same issue.
>
> Best,
> Daniel

Thanks for the review.
Seems the issue has been already solved!

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2019-11-12 11:48 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-10  8:19 [PATCH] samples: bpf: fix outdated README build command Daniel T. Lee
2019-11-11  6:09 ` Andrii Nakryiko
2019-11-11  9:24   ` Toke Høiland-Jørgensen
2019-11-12 11:47     ` Daniel T. Lee
2019-11-12 11:45   ` Daniel T. Lee
2019-11-11 13:58 ` Daniel Borkmann
2019-11-12 11:48   ` Daniel T. Lee

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).