Tools build error due to "Auto-detecting system features" missing cleanup

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

 



Started as a build error for bpftool. On latest DaveM net-git tree
(06a4ec1d9dc652), I got this build error, when building the bpftool:

 cd tools/bpf/bpftool
 $ make
 
 Auto-detecting system features:
 ...                        libbfd: [ on  ]
 ...        disassembler-four-args: [ on  ]
 ...                          zlib: [ on  ]
 ...                        libcap: [ on  ]
 ...               clang-bpf-co-re: [ on  ]
 
   CC       map_perf_ring.o
 In file included from main.h:15,
                  from map_perf_ring.c:27:
 /home/jbrouer/git/kernel/net/tools/include/tools/libc_compat.h:11:21: error: static declaration of ‘reallocarray’ follows non-static declaration
    11 | static inline void *reallocarray(void *ptr, size_t nmemb, size_t size)
       |                     ^~~~~~~~~~~~
 In file included from map_perf_ring.c:14:
 /usr/include/stdlib.h:559:14: note: previous declaration of ‘reallocarray’ was here
   559 | extern void *reallocarray (void *__ptr, size_t __nmemb, size_t __size)
       |              ^~~~~~~~~~~~
 make: *** [Makefile:177: map_perf_ring.o] Error 1

This were related to tools/build/feature ("Auto-detecting system features")
that had a stalled version of the test-reallocarray.d file:

In /home/jbrouer/git/kernel/net/tools/build/feature:

 $ ll *realloc*
 -rw-rw-r--. 1 jbrouer jbrouer  152 Oct 30  2019 test-reallocarray.c
 -rw-rw-r--. 1 jbrouer jbrouer 1156 Oct 30  2019 test-reallocarray.d
 -rw-rw-r--. 1 jbrouer jbrouer  321 Oct 30  2019 test-reallocarray.make.output

The 'make clean' target doesn't cleanup enough for the feature-test to be
compiled again. (Tested both make clean in tools/build/ and tools/bpf/bpftool).

If I delete test-reallocarray.d, then the feature-test is recompiled and I don't
get the error (as reallocarray is avail on this system). Files avail now:

In /home/jbrouer/git/kernel/net/tools/build/feature:

 $ ll *realloc*
 -rwxrwxr-x. 1 jbrouer jbrouer 21992 Aug 18 11:29 test-reallocarray.bin
 -rw-rw-r--. 1 jbrouer jbrouer   152 Oct 30  2019 test-reallocarray.c
 -rw-rw-r--. 1 jbrouer jbrouer  1398 Aug 18 11:29 test-reallocarray.d
 -rw-rw-r--. 1 jbrouer jbrouer     0 Aug 18 11:29 test-reallocarray.make.output

Thus, given test-reallocarray.bin exist the compile test was success. This
indicate that my Fedora system in Oct 2019 didn't support reallocarray and
needed the workaround in tools/include/tools/libc_compat.h. I likely did some
upgrade or install some RPM in the meanwhile that changed the situation.
Regardless of how this got stalled, this needs to be fixed.

I propose that the make clean target should cause the feature tests to be
recompiled. Below change to tools/build/Makefile solves the issue locally in
tools/build/, but this isn't triggered when calling make clean in other tools
directories that use the feature tests.

What is the correct make clean fix?
- - 
Best regards,
  Jesper Dangaard Brouer
  MSc.CS, Principal Kernel Engineer at Red Hat
  LinkedIn: http://www.linkedin.com/in/brouer

diff --git a/tools/build/Makefile b/tools/build/Makefile
index 727050c40f09..a59e60ecf5ad 100644
--- a/tools/build/Makefile
+++ b/tools/build/Makefile
@@ -37,6 +37,7 @@ all: $(OUTPUT)fixdep
 clean:
        $(call QUIET_CLEAN, fixdep)
        $(Q)find $(if $(OUTPUT),$(OUTPUT),.) -name '*.o' -delete -o -name '\.*.cmd' -delete -o -name '\.*.d' -delete
+       $(Q)find $(if $(OUTPUT),$(OUTPUT),.)/feature -name '*.d' -delete -o -name '*.make.output' -delete
        $(Q)rm -f $(OUTPUT)fixdep
 
 $(OUTPUT)fixdep-in.o: FORCE




My distro:

$ lsb_release  -a
LSB Version:	:core-4.1-amd64:core-4.1-noarch
Distributor ID:	Fedora
Description:	Fedora release 31 (Thirty One)
Release:	31
Codename:	ThirtyOne





[Index of Archives]     [Linux&nblp;USB Development]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite Secrets]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux