linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jesper Dangaard Brouer <brouer@redhat.com>
To: Arnaldo Carvalho de Melo <acme@redhat.com>,
	Jiri Olsa <jolsa@redhat.com>, LKML <linux-kernel@vger.kernel.org>
Cc: brouer@redhat.com, linux-kbuild@vger.kernel.org,
	BPF-dev-list <bpf@vger.kernel.org>
Subject: Tools build error due to "Auto-detecting system features" missing cleanup
Date: Tue, 18 Aug 2020 12:20:41 +0200	[thread overview]
Message-ID: <20200818122007.2d1cfe2d@carbon> (raw)


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


                 reply	other threads:[~2020-08-18 10:21 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200818122007.2d1cfe2d@carbon \
    --to=brouer@redhat.com \
    --cc=acme@redhat.com \
    --cc=bpf@vger.kernel.org \
    --cc=jolsa@redhat.com \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).