selftests/bpf : Clean up feature/ when make clean
Subsystems (5)
PATCH 1/1 selftests/bpf : Clean up feature/ when make clean
I got an error when compiling selftests/bpf:
libbpf.c:411:10: error: implicit declaration of function 'reallocarray'; did you mean 'realloc'? [-Werror=implicit-function-declaration]
progs = reallocarray(progs, nr_progs + 1, sizeof(progs[0]));
It was caused by feature-reallocarray=1 in FEATURE-DUMP.libbpf and it was fixed by manually removing feature/ folder. This diff adds feature/ to EXTRA_CLEAN to avoid this problem.
--- tools/testing/selftests/bpf/Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
tools/testing/selftests/bpf/Makefile +2 -1
@@ -279,4 +279,5 @@ $(OUTPUT)/verifier/tests.h: $(VERIFIER_TESTS_DIR) $(VERIFIER_TEST_FILES) ) > $(VERIFIER_TESTS_H)) EXTRA_CLEAN := $(TEST_CUSTOM_PROGS) $(ALU32_BUILD_DIR) \ - $(VERIFIER_TESTS_H) $(PROG_TESTS_H) $(MAP_TESTS_H) + $(VERIFIER_TESTS_H) $(PROG_TESTS_H) $(MAP_TESTS_H) \ + feature
Signature · 1 line
2.17.1
Quoted 7 lines · Hechao Li
I got an error when compiling selftests/bpf:
libbpf.c:411:10: error: implicit declaration of function 'reallocarray'; did you mean 'realloc'? [-Werror=implicit-function-declaration]
progs =reallocarray(progs, nr_progs + 1, sizeof(progs[0]));
Quoted 6 lines
It was caused by feature-reallocarray=1 in FEATURE-DUMP.libbpf and it was fixed by manually removing feature/ folder. This diff adds feature/ to
EXTRA_CLEANto avoid this problem.Signed-off-by Hechao Li <[email protected]>---
There is no need to include v1 into patch prefix for a first version of a patch. Only v2 and further versions are added.
Quoted 8 lines
tools/testing/selftests/bpf/Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)tools/testing/selftests/bpf/Makefile +0
-0
tools/testing/selftests/bpf/Makefile $(OUTPUT)/verifier/tests.h: $(VERIFIER_TESTS_DIR) $(VERIFIER_TEST_FILES) · line 283
Quoted 6 lines
tools/testing/selftests/bpf/Makefile +2
-1@@ -279,4 +279,5 @@ $(OUTPUT)/verifier/tests.h: $(VERIFIER_TESTS_DIR) $(VERIFIER_TEST_FILES) ) > $(VERIFIER_TESTS_H)) EXTRA_CLEAN := $(TEST_CUSTOM_PROGS) $(ALU32_BUILD_DIR) \ - $(VERIFIER_TESTS_H) $(PROG_TESTS_H) $(MAP_TESTS_H) + $(VERIFIER_TESTS_H) $(PROG_TESTS_H) $(MAP_TESTS_H) \ + feature
It doesn't seem any of linux's Makefile do that. From brief reading of build/Makefile.feature, it seems like it is supposed to handle transparently the case where environment changes and thus a set of supported features changes. I also verified that FEATURE-DUMP.libbpf is re-generated every single time I run make in tools/testing/selftests/bpf, even if nothing changed at all. So I don't think this patch is necessary.
I'm not sure what was the cause of your original problem, though.
Quoted 3 lines
--
2.17.1
Andrii Nakryiko <[email protected]> wrote on Mon [2019-Jun-10 11:05:28 -0700]:
Quoted 42 lines · Hechao Li
Quoted 7 lines
I got an error when compiling selftests/bpf:
libbpf.c:411:10: error: implicit declaration of function 'reallocarray'; did you mean 'realloc'? [-Werror=implicit-function-declaration]
progs =reallocarray(progs, nr_progs + 1, sizeof(progs[0]));Quoted 6 lines
It was caused by feature-reallocarray=1 in FEATURE-DUMP.libbpf and it was fixed by manually removing feature/ folder. This diff adds feature/ to
EXTRA_CLEANto avoid this problem.Signed-off-by Hechao Li <[email protected]>---
There is no need to include v1 into patch prefix for a first version of a patch. Only v2 and further versions are added.
Quoted 8 lines
tools/testing/selftests/bpf/Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)tools/testing/selftests/bpf/Makefile +0
-0tools/testing/selftests/bpf/Makefile $(OUTPUT)/verifier/tests.h: $(VERIFIER_TESTS_DIR) $(VERIFIER_TEST_FILES) · line 283
Quoted 6 lines
tools/testing/selftests/bpf/Makefile +2
-1@@ -279,4 +279,5 @@ $(OUTPUT)/verifier/tests.h: $(VERIFIER_TESTS_DIR) $(VERIFIER_TEST_FILES) ) > $(VERIFIER_TESTS_H)) EXTRA_CLEAN := $(TEST_CUSTOM_PROGS) $(ALU32_BUILD_DIR) \ - $(VERIFIER_TESTS_H) $(PROG_TESTS_H) $(MAP_TESTS_H) + $(VERIFIER_TESTS_H) $(PROG_TESTS_H) $(MAP_TESTS_H) \ + featureIt doesn't seem any of linux's
Makefiledo that. From brief reading of build/Makefile.feature, it seems like it is supposed to handle transparently the case where environment changes and thus a set of supported features changes. I also verified that FEATURE-DUMP.libbpf is re-generated every single time I run make intools/testing/selftests/bpf, even if nothing changed at all. So I don't think this patch is necessary.
Quoted 5 lines
I'm not sure what was the cause of your original problem, though.
Quoted 3 lines
--
2.17.1
# Background:
My default GCC version is 4.8.5, which caused the following error when I run make under selftests/bpf:
libbpf.c:39:10: fatal error: libelf.h: No such file or directory
To fix it, I have to run:
make CC=<Path to GCC 7.x>
The I got reallocarray not found error. By deleting feature/ folder under selftests/bpf, it was fixed.
# Root Cause:
Now I found the root cause. When I run "make", which uses GCC 4.8.5, it generates feature/test-reallocarray.d which indicates reallocarray is enabled. However, when I switched to GCC 7.0, this file was not re-generated and thus even FEATURE-DUMP.libbpf was re-generated, feature-reallocarray is still 1 in it.
This can be reproduced by the following steps:
$ cd tools/testing/selftests/bpf $ make clean && make CC=<Path to GCC 4.8.5> (Fail due to libelf.h not found) $ make clean && make CC=<Path to GCC 7.x> (Should succeed but actually fail with reallocarray not defined)
If adding feature to EXTRA_CLEAN is not the way to go, do you have any suggestion to fix such problem? I spent some time debugging this and I hope to fix it so that other people with similar situation won't have to waste time on this issue.
Thanks,
Hechao
Quoted 34 lines · Hechao Li
Andrii Nakryiko <[email protected]> wrote on Mon [2019-Jun-10 11:05:28 -0700]:
Quoted 29 lines · Hechao Li
Quoted 7 lines
I got an error when compiling selftests/bpf:
libbpf.c:411:10: error: implicit declaration of function 'reallocarray'; did you mean 'realloc'? [-Werror=implicit-function-declaration]
progs =reallocarray(progs, nr_progs + 1, sizeof(progs[0]));Quoted 6 lines
It was caused by feature-reallocarray=1 in FEATURE-DUMP.libbpf and it was fixed by manually removing feature/ folder. This diff adds feature/ to
EXTRA_CLEANto avoid this problem.Signed-off-by Hechao Li <[email protected]>---
There is no need to include v1 into patch prefix for a first version of a patch. Only v2 and further versions are added.
Quoted 10 lines
tools/testing/selftests/bpf/Makefile| 3 ++-1 file changed, 2 insertions(+), 1 deletion(-)tools/testing/selftests/bpf/Makefile +0
-0@@ -279,4 +279,5 @@ $(OUTPUT)/verifier/tests.h: $(VERIFIER_TESTS_DIR) $(VERIFIER_TEST_FILES) ) > $(VERIFIER_TESTS_H))
Quoted 4 lines
Quoted 4 lines
tools/testing/selftests/bpf/Makefile $(OUTPUT)/verifier/tests.h: $(VERIFIER_TESTS_DIR) $(VERIFIER_TEST_FILES) · line 283
Quoted 4 lines
tools/testing/selftests/bpf/Makefile +2
-1EXTRA_CLEAN := $(TEST_CUSTOM_PROGS) $(ALU32_BUILD_DIR) \ - $(VERIFIER_TESTS_H) $(PROG_TESTS_H) $(MAP_TESTS_H) + $(VERIFIER_TESTS_H) $(PROG_TESTS_H) $(MAP_TESTS_H) \ + feature
I think this makes sense (before we find a better solution). Folder feature is already in .gitignore, we know it can be removed.
Thanks,
Song
Quoted 50 lines
Quoted 9 lines
It doesn't seem any of linux's
Makefiledo that. From brief reading of build/Makefile.feature, it seems like it is supposed to handle transparently the case where environment changes and thus a set of supported features changes. I also verified that FEATURE-DUMP.libbpf is re-generated every single time I run make intools/testing/selftests/bpf, even if nothing changed at all. So I don't think this patch is necessary.Quoted 5 lines
I'm not sure what was the cause of your original problem, though.
Quoted 3 lines
--
2.17.1# Background:
My default GCC version is 4.8.5, which caused the following error when I run make under selftests/bpf:
libbpf.c:39:10: fatal error:libelf.h: No such file or directoryTo fix it, I have to run:
make CC=<Path to GCC 7.x>
The I got reallocarray not found error. By deleting feature/ folder under selftests/bpf, it was fixed.
# Root Cause:
Now I found the root cause. When I run "make", which uses GCC 4.8.5, it generates feature/test-reallocarray.d which indicates reallocarray is enabled. However, when I switched to GCC 7.0, this file was not re-generated and thus even FEATURE-DUMP.libbpf was re-generated, feature-reallocarray is still 1 in it.
This can be reproduced by the following steps:
$ cd tools/testing/selftests/bpf $ make clean && make CC=<Path to GCC 4.8.5> (Fail due to libelf.h not found) $ make clean && make CC=<Path to GCC 7.x> (Should succeed but actually fail with reallocarray not defined)If adding feature to
EXTRA_CLEANis not the way to go, do you have any suggestion to fix such problem? I spent some time debugging this and I hope to fix it so that other people with similar situation won't have to waste time on this issue.Thanks,
Hechao
Andrii Nakryiko
Acked-byQuoted 78 lines · Hechao Li
Andrii Nakryiko <[email protected]> wrote on Mon [2019-Jun-10 11:05:28 -0700]:
Quoted 42 lines · Hechao Li
Quoted 7 lines
I got an error when compiling selftests/bpf:
libbpf.c:411:10: error: implicit declaration of function 'reallocarray'; did you mean 'realloc'? [-Werror=implicit-function-declaration]
progs =reallocarray(progs, nr_progs + 1, sizeof(progs[0]));Quoted 6 lines
It was caused by feature-reallocarray=1 in FEATURE-DUMP.libbpf and it was fixed by manually removing feature/ folder. This diff adds feature/ to
EXTRA_CLEANto avoid this problem.Signed-off-by Hechao Li <[email protected]>---
There is no need to include v1 into patch prefix for a first version of a patch. Only v2 and further versions are added.
Quoted 8 lines
tools/testing/selftests/bpf/Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)tools/testing/selftests/bpf/Makefile +0
-0tools/testing/selftests/bpf/Makefile $(OUTPUT)/verifier/tests.h: $(VERIFIER_TESTS_DIR) $(VERIFIER_TEST_FILES) · line 283
Quoted 6 lines
tools/testing/selftests/bpf/Makefile +2
-1@@ -279,4 +279,5 @@ $(OUTPUT)/verifier/tests.h: $(VERIFIER_TESTS_DIR) $(VERIFIER_TEST_FILES) ) > $(VERIFIER_TESTS_H)) EXTRA_CLEAN := $(TEST_CUSTOM_PROGS) $(ALU32_BUILD_DIR) \ - $(VERIFIER_TESTS_H) $(PROG_TESTS_H) $(MAP_TESTS_H) + $(VERIFIER_TESTS_H) $(PROG_TESTS_H) $(MAP_TESTS_H) \ + featureIt doesn't seem any of linux's
Makefiledo that. From brief reading of build/Makefile.feature, it seems like it is supposed to handle transparently the case where environment changes and thus a set of supported features changes. I also verified that FEATURE-DUMP.libbpf is re-generated every single time I run make intools/testing/selftests/bpf, even if nothing changed at all. So I don't think this patch is necessary.Quoted 5 lines
I'm not sure what was the cause of your original problem, though.
Quoted 3 lines
--
2.17.1# Background:
My default GCC version is 4.8.5, which caused the following error when I run make under selftests/bpf:
libbpf.c:39:10: fatal error:libelf.h: No such file or directoryTo fix it, I have to run:
make CC=<Path to GCC 7.x>
The I got reallocarray not found error. By deleting feature/ folder under selftests/bpf, it was fixed.
# Root Cause:
Now I found the root cause. When I run "make", which uses GCC 4.8.5, it generates feature/test-reallocarray.d which indicates reallocarray is enabled. However, when I switched to GCC 7.0, this file was not re-generated and thus even FEATURE-DUMP.libbpf was re-generated, feature-reallocarray is still 1 in it.
This can be reproduced by the following steps:
$ cd tools/testing/selftests/bpf $ make clean && make CC=<Path to GCC 4.8.5> (Fail due to libelf.h not found) $ make clean && make CC=<Path to GCC 7.x> (Should succeed but actually fail with reallocarray not defined)
Quoted 4 lines
If adding feature to
EXTRA_CLEANis not the way to go, do you have any suggestion to fix such problem? I spent some time debugging this and I hope to fix it so that other people with similar situation won't have to waste time on this issue.
I think adding feature to EXTRA_CLEAN is just fine. I was hesitant without understanding how this happened. Maybe condense this explanation as part of commit message, I think it's useful, thanks for explaining!
Quoted 3 lines
Thanks,
Hechao