linux-kselftest.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] tools: bpf: Use !building_out_of_srctree to determine srctree
@ 2019-09-27  1:13 Shuah Khan
  2019-09-27 18:44 ` Song Liu
  2019-09-30  8:58 ` Daniel Borkmann
  0 siblings, 2 replies; 7+ messages in thread
From: Shuah Khan @ 2019-09-27  1:13 UTC (permalink / raw)
  To: ast, daniel, kafai, songliubraving, yhs
  Cc: Shuah Khan, netdev, bpf, linux-kernel, linux-kselftest

make TARGETS=bpf kselftest fails with:

Makefile:127: tools/build/Makefile.include: No such file or directory

When the bpf tool make is invoked from tools Makefile, srctree is
cleared and the current logic check for srctree equals to empty
string to determine srctree location from CURDIR.

When the build in invoked from selftests/bpf Makefile, the srctree
is set to "." and the same logic used for srctree equals to empty is
needed to determine srctree.

Check building_out_of_srctree undefined as the condition for both
cases to fix "make TARGETS=bpf kselftest" build failure.

Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
---
 tools/bpf/Makefile     | 6 +++++-
 tools/lib/bpf/Makefile | 6 +++++-
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/tools/bpf/Makefile b/tools/bpf/Makefile
index fbf5e4a0cb9c..5d1995fd369c 100644
--- a/tools/bpf/Makefile
+++ b/tools/bpf/Makefile
@@ -12,7 +12,11 @@ INSTALL ?= install
 CFLAGS += -Wall -O2
 CFLAGS += -D__EXPORTED_HEADERS__ -I$(srctree)/include/uapi -I$(srctree)/include
 
-ifeq ($(srctree),)
+# This will work when bpf is built in tools env. where srctree
+# isn't set and when invoked from selftests build, where srctree
+# is set to ".". building_out_of_srctree is undefined for in srctree
+# builds
+ifndef building_out_of_srctree
 srctree := $(patsubst %/,%,$(dir $(CURDIR)))
 srctree := $(patsubst %/,%,$(dir $(srctree)))
 endif
diff --git a/tools/lib/bpf/Makefile b/tools/lib/bpf/Makefile
index c6f94cffe06e..20772663d3e1 100644
--- a/tools/lib/bpf/Makefile
+++ b/tools/lib/bpf/Makefile
@@ -8,7 +8,11 @@ LIBBPF_MAJOR_VERSION := $(firstword $(subst ., ,$(LIBBPF_VERSION)))
 
 MAKEFLAGS += --no-print-directory
 
-ifeq ($(srctree),)
+# This will work when bpf is built in tools env. where srctree
+# isn't set and when invoked from selftests build, where srctree
+# is a ".". building_out_of_srctree is undefined for in srctree
+# builds
+ifndef building_out_of_srctree
 srctree := $(patsubst %/,%,$(dir $(CURDIR)))
 srctree := $(patsubst %/,%,$(dir $(srctree)))
 srctree := $(patsubst %/,%,$(dir $(srctree)))
-- 
2.20.1


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

* Re: [PATCH] tools: bpf: Use !building_out_of_srctree to determine srctree
  2019-09-27  1:13 [PATCH] tools: bpf: Use !building_out_of_srctree to determine srctree Shuah Khan
@ 2019-09-27 18:44 ` Song Liu
  2019-09-27 19:03   ` Shuah Khan
  2019-09-30  8:58 ` Daniel Borkmann
  1 sibling, 1 reply; 7+ messages in thread
From: Song Liu @ 2019-09-27 18:44 UTC (permalink / raw)
  To: Shuah Khan
  Cc: Alexei Starovoitov, Daniel Borkmann, Martin KaFai Lau, Song Liu,
	Yonghong Song, Networking, bpf, open list, linux-kselftest

On Thu, Sep 26, 2019 at 6:14 PM Shuah Khan <skhan@linuxfoundation.org> wrote:
>
> make TARGETS=bpf kselftest fails with:
>
> Makefile:127: tools/build/Makefile.include: No such file or directory
>
> When the bpf tool make is invoked from tools Makefile, srctree is
> cleared and the current logic check for srctree equals to empty
> string to determine srctree location from CURDIR.
>
> When the build in invoked from selftests/bpf Makefile, the srctree
> is set to "." and the same logic used for srctree equals to empty is
> needed to determine srctree.
>
> Check building_out_of_srctree undefined as the condition for both
> cases to fix "make TARGETS=bpf kselftest" build failure.
>
> Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>

The fix looks reasonable. Thanks!

However, I am still seeing some failure:

make TARGETS=bpf kselftest
[...]
test_verifier.c
/data/users/songliubraving/kernel/linux-git/tools/testing/selftests/bpf/test_stub.o
/data/users/songliubraving/kernel/linux-git/tools/testing/selftests/bpf/libbpf.a
-lcap -lelf -lrt -lpthread -o
/data/users/songliubraving/kernel/linux-git/tools/testing/selftests/bpf/test_verifier
make[3]: test_verifier.c: Command not found

Is this just a problem with my setup?

Thanks,
Song

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

* Re: [PATCH] tools: bpf: Use !building_out_of_srctree to determine srctree
  2019-09-27 18:44 ` Song Liu
@ 2019-09-27 19:03   ` Shuah Khan
  2019-09-27 21:15     ` Song Liu
  0 siblings, 1 reply; 7+ messages in thread
From: Shuah Khan @ 2019-09-27 19:03 UTC (permalink / raw)
  To: Song Liu
  Cc: Alexei Starovoitov, Daniel Borkmann, Martin KaFai Lau, Song Liu,
	Yonghong Song, Networking, bpf, open list, linux-kselftest,
	Shuah Khan

On 9/27/19 12:44 PM, Song Liu wrote:
> On Thu, Sep 26, 2019 at 6:14 PM Shuah Khan <skhan@linuxfoundation.org> wrote:
>>
>> make TARGETS=bpf kselftest fails with:
>>
>> Makefile:127: tools/build/Makefile.include: No such file or directory
>>
>> When the bpf tool make is invoked from tools Makefile, srctree is
>> cleared and the current logic check for srctree equals to empty
>> string to determine srctree location from CURDIR.
>>
>> When the build in invoked from selftests/bpf Makefile, the srctree
>> is set to "." and the same logic used for srctree equals to empty is
>> needed to determine srctree.
>>
>> Check building_out_of_srctree undefined as the condition for both
>> cases to fix "make TARGETS=bpf kselftest" build failure.
>>
>> Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
> 
> The fix looks reasonable. Thanks!
> 
> However, I am still seeing some failure:
> 
> make TARGETS=bpf kselftest
> [...]
> test_verifier.c
> /data/users/songliubraving/kernel/linux-git/tools/testing/selftests/bpf/test_stub.o
> /data/users/songliubraving/kernel/linux-git/tools/testing/selftests/bpf/libbpf.a
> -lcap -lelf -lrt -lpthread -o
> /data/users/songliubraving/kernel/linux-git/tools/testing/selftests/bpf/test_verifier
> make[3]: test_verifier.c: Command not found
> 
> Is this just a problem with my setup?
> 

You are running into the second bpf failure because of the dependency
on the latest llvm. This is known issue with bpf test and it doesn't
compile on 5.4 and maybe even 5.3

You have upgrade to the bleeding edge llvm.

thanks,
-- Shuah


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

* Re: [PATCH] tools: bpf: Use !building_out_of_srctree to determine srctree
  2019-09-27 19:03   ` Shuah Khan
@ 2019-09-27 21:15     ` Song Liu
  0 siblings, 0 replies; 7+ messages in thread
From: Song Liu @ 2019-09-27 21:15 UTC (permalink / raw)
  To: Shuah Khan
  Cc: Song Liu, Alexei Starovoitov, Daniel Borkmann, Martin Lau,
	Yonghong Song, Networking, bpf, open list, linux-kselftest



> On Sep 27, 2019, at 12:03 PM, Shuah Khan <skhan@linuxfoundation.org> wrote:
> 
> On 9/27/19 12:44 PM, Song Liu wrote:
>> On Thu, Sep 26, 2019 at 6:14 PM Shuah Khan <skhan@linuxfoundation.org> wrote:
>>> 
>>> make TARGETS=bpf kselftest fails with:
>>> 
>>> Makefile:127: tools/build/Makefile.include: No such file or directory
>>> 
>>> When the bpf tool make is invoked from tools Makefile, srctree is
>>> cleared and the current logic check for srctree equals to empty
>>> string to determine srctree location from CURDIR.
>>> 
>>> When the build in invoked from selftests/bpf Makefile, the srctree
>>> is set to "." and the same logic used for srctree equals to empty is
>>> needed to determine srctree.
>>> 
>>> Check building_out_of_srctree undefined as the condition for both
>>> cases to fix "make TARGETS=bpf kselftest" build failure.
>>> 
>>> Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
>> The fix looks reasonable. Thanks!
>> However, I am still seeing some failure:
>> make TARGETS=bpf kselftest
>> [...]
>> test_verifier.c
>> /data/users/songliubraving/kernel/linux-git/tools/testing/selftests/bpf/test_stub.o
>> /data/users/songliubraving/kernel/linux-git/tools/testing/selftests/bpf/libbpf.a
>> -lcap -lelf -lrt -lpthread -o
>> /data/users/songliubraving/kernel/linux-git/tools/testing/selftests/bpf/test_verifier
>> make[3]: test_verifier.c: Command not found
>> Is this just a problem with my setup?
> 
> You are running into the second bpf failure because of the dependency
> on the latest llvm. This is known issue with bpf test and it doesn't
> compile on 5.4 and maybe even 5.3
> 

Thanks for the clarification. 

Acked-by: Song Liu <songliubraving@fb.com>




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

* Re: [PATCH] tools: bpf: Use !building_out_of_srctree to determine srctree
  2019-09-27  1:13 [PATCH] tools: bpf: Use !building_out_of_srctree to determine srctree Shuah Khan
  2019-09-27 18:44 ` Song Liu
@ 2019-09-30  8:58 ` Daniel Borkmann
  2019-09-30 14:16   ` Shuah Khan
  1 sibling, 1 reply; 7+ messages in thread
From: Daniel Borkmann @ 2019-09-30  8:58 UTC (permalink / raw)
  To: Shuah Khan
  Cc: ast, kafai, songliubraving, yhs, netdev, bpf, linux-kernel,
	linux-kselftest

On Thu, Sep 26, 2019 at 07:13:44PM -0600, Shuah Khan wrote:
> make TARGETS=bpf kselftest fails with:
> 
> Makefile:127: tools/build/Makefile.include: No such file or directory
> 
> When the bpf tool make is invoked from tools Makefile, srctree is
> cleared and the current logic check for srctree equals to empty
> string to determine srctree location from CURDIR.
> 
> When the build in invoked from selftests/bpf Makefile, the srctree
> is set to "." and the same logic used for srctree equals to empty is
> needed to determine srctree.
> 
> Check building_out_of_srctree undefined as the condition for both
> cases to fix "make TARGETS=bpf kselftest" build failure.
> 
> Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>

Applied, thanks!

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

* Re: [PATCH] tools: bpf: Use !building_out_of_srctree to determine srctree
  2019-09-30  8:58 ` Daniel Borkmann
@ 2019-09-30 14:16   ` Shuah Khan
  2019-09-30 18:23     ` Daniel Borkmann
  0 siblings, 1 reply; 7+ messages in thread
From: Shuah Khan @ 2019-09-30 14:16 UTC (permalink / raw)
  To: Daniel Borkmann
  Cc: ast, kafai, songliubraving, yhs, netdev, bpf, linux-kernel,
	linux-kselftest, Shuah Khan

On 9/30/19 2:58 AM, Daniel Borkmann wrote:
> On Thu, Sep 26, 2019 at 07:13:44PM -0600, Shuah Khan wrote:
>> make TARGETS=bpf kselftest fails with:
>>
>> Makefile:127: tools/build/Makefile.include: No such file or directory
>>
>> When the bpf tool make is invoked from tools Makefile, srctree is
>> cleared and the current logic check for srctree equals to empty
>> string to determine srctree location from CURDIR.
>>
>> When the build in invoked from selftests/bpf Makefile, the srctree
>> is set to "." and the same logic used for srctree equals to empty is
>> needed to determine srctree.
>>
>> Check building_out_of_srctree undefined as the condition for both
>> cases to fix "make TARGETS=bpf kselftest" build failure.
>>
>> Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
> 
> Applied, thanks!
> 

Hi Daniel!

Is the tree the patch went into included in the linux-next?

thanks,
-- Shuah

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

* Re: [PATCH] tools: bpf: Use !building_out_of_srctree to determine srctree
  2019-09-30 14:16   ` Shuah Khan
@ 2019-09-30 18:23     ` Daniel Borkmann
  0 siblings, 0 replies; 7+ messages in thread
From: Daniel Borkmann @ 2019-09-30 18:23 UTC (permalink / raw)
  To: Shuah Khan
  Cc: ast, kafai, songliubraving, yhs, netdev, bpf, linux-kernel,
	linux-kselftest

On Mon, Sep 30, 2019 at 08:16:55AM -0600, Shuah Khan wrote:
> On 9/30/19 2:58 AM, Daniel Borkmann wrote:
> > On Thu, Sep 26, 2019 at 07:13:44PM -0600, Shuah Khan wrote:
> > > make TARGETS=bpf kselftest fails with:
> > > 
> > > Makefile:127: tools/build/Makefile.include: No such file or directory
> > > 
> > > When the bpf tool make is invoked from tools Makefile, srctree is
> > > cleared and the current logic check for srctree equals to empty
> > > string to determine srctree location from CURDIR.
> > > 
> > > When the build in invoked from selftests/bpf Makefile, the srctree
> > > is set to "." and the same logic used for srctree equals to empty is
> > > needed to determine srctree.
> > > 
> > > Check building_out_of_srctree undefined as the condition for both
> > > cases to fix "make TARGETS=bpf kselftest" build failure.
> > > 
> > > Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
> > 
> > Applied, thanks!
> 
> Hi Daniel!
> 
> Is the tree the patch went into included in the linux-next?

Yes, both bpf and bpf-next are included in linux-next.

Thanks,
Daniel

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

end of thread, other threads:[~2019-09-30 20:40 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-27  1:13 [PATCH] tools: bpf: Use !building_out_of_srctree to determine srctree Shuah Khan
2019-09-27 18:44 ` Song Liu
2019-09-27 19:03   ` Shuah Khan
2019-09-27 21:15     ` Song Liu
2019-09-30  8:58 ` Daniel Borkmann
2019-09-30 14:16   ` Shuah Khan
2019-09-30 18:23     ` Daniel Borkmann

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