From patchwork Tue Aug 18 10:20:41 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jesper Dangaard Brouer X-Patchwork-Id: 1346748 X-Patchwork-Delegate: bpf@iogearbox.net Return-Path: X-Original-To: incoming-bpf@patchwork.ozlabs.org Delivered-To: patchwork-incoming-bpf@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=23.128.96.18; helo=vger.kernel.org; envelope-from=bpf-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=XhBoK+z1; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by ozlabs.org (Postfix) with ESMTP id 4BW6Ps6lG6z9sTR for ; Tue, 18 Aug 2020 20:21:05 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726569AbgHRKUx (ORCPT ); Tue, 18 Aug 2020 06:20:53 -0400 Received: from us-smtp-1.mimecast.com ([207.211.31.81]:43164 "EHLO us-smtp-delivery-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726420AbgHRKUw (ORCPT ); Tue, 18 Aug 2020 06:20:52 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1597746050; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=pT1phLHGEAuANaEb5B3e0Ka/xZccNpYnDnuH62QNT9k=; b=XhBoK+z1+P573WUY38S/318z75JhO8xrCM3cm7zaBfGz+6YgCMBmXU46ZM1VbrHlpQV1wN va49hTpSxe18fRZ2AMK4jvexARBk1lzQMsGZKFBksWeARU3b5UoZzLpebFAyvaRUpQPtJD IMLMeqI7sdSk1N9eUKSfB0bu/PXDbww= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-219-V_4vSy4fMn6KdLHUfNulAA-1; Tue, 18 Aug 2020 06:20:48 -0400 X-MC-Unique: V_4vSy4fMn6KdLHUfNulAA-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 6193D100CF6A; Tue, 18 Aug 2020 10:20:47 +0000 (UTC) Received: from carbon (unknown [10.40.208.64]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4C8915C1DC; Tue, 18 Aug 2020 10:20:42 +0000 (UTC) Date: Tue, 18 Aug 2020 12:20:41 +0200 From: Jesper Dangaard Brouer To: Arnaldo Carvalho de Melo , Jiri Olsa , LKML Cc: brouer@redhat.com, linux-kbuild@vger.kernel.org, BPF-dev-list Subject: Tools build error due to "Auto-detecting system features" missing cleanup Message-ID: <20200818122007.2d1cfe2d@carbon> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 Sender: bpf-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: bpf@vger.kernel.org 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 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 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