Received: by 2002:a05:7412:e794:b0:fa:551:50a7 with SMTP id o20csp2061634rdd; Thu, 11 Jan 2024 19:45:07 -0800 (PST) X-Google-Smtp-Source: AGHT+IHHF0gichU09OEDyOPRlsrQ5qKzr9WNT6tyHq/JyTFOUe6rUiSEMo9JTXj96gAYlsdR9xwP X-Received: by 2002:a05:6402:64d:b0:556:b324:40bd with SMTP id u13-20020a056402064d00b00556b32440bdmr313143edx.20.1705031107169; Thu, 11 Jan 2024 19:45:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1705031107; cv=none; d=google.com; s=arc-20160816; b=qYWVxAT9I1g+cyhE4XixcRtcnR9z0Dk2IIhzjwafqUcWi9mwtT6N5LsWSdWBmdddXK aOPSB9L8VySheEBgl1+tdEsVSbd3RK2WpDwEZCT5mscV7psVwE13gJ8EjtWU9Xjwhqkb qfrOydG8KR+z6JraC3lu4x8irAOS8ADbL58hnQlr+yeJtxSmynTJaMn6qwSQ4Zrhw2Ky BEDVV6TFQZNh8OK6L7FC6YnUzlicAImRgW3zEz16w/F7B6mAwx9I2X3WdPfrJCfLUHgK /bSdGvprLtl5VosGSTm9PEI/UeEhpuoSpchOs8w4USgPEiLCxwwvET6TpH3/W4NL3XLI nYnQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from; bh=6tDd+nrhsYPuIHIYbp1UySV3vHejBK3hSYLJkjkEj44=; fh=Bniw+6GSTGRfFyC55GB3Thz1GNqaKHZWIdADbDjMDXE=; b=aOJnFlzrJY0sIHci3pu6Qpj8a/NgQLJFgbx6jpDaDtKqAmEJIW52P8SeZ5g9zX+K8a MJqgHIl7CusW6/kgrWFP6uVaQxSt8VJ1UF9wJQyJ4j6wiwGrMwZG2m/QnWF9QZy1zA39 ZOHB0f/xgZM6CdOKC2XQS3mgbWDyiUJ/fJbHbNo2hhKHXB3DA6zLSQpGB2rVhpO3Dm5v BZZ8LQrKYLtU2E0nmWopBnWJFkXZUQaFVdFSpAI6lzm7CLTCUxwrWNVuV4OpcDTNjwZD tq3NNVZNrMF0qQbUHpE9/mRsLjlujpEqSMCbPq1Agv/TMNSE4ldi39SG5d/IUcqogiZR SMwg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-24272-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-24272-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id d12-20020a056402078c00b00556c421aa85si1044170edy.420.2024.01.11.19.45.07 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Jan 2024 19:45:07 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-24272-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-24272-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-24272-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id DC5B11F25F4F for ; Fri, 12 Jan 2024 03:45:06 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 24DCC1B282; Fri, 12 Jan 2024 03:44:57 +0000 (UTC) Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7FB8D1B27B; Fri, 12 Jan 2024 03:44:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Received: from mail.maildlp.com (unknown [172.19.88.105]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4TB6pf01FpzNkyp; Fri, 12 Jan 2024 11:44:09 +0800 (CST) Received: from kwepemm600003.china.huawei.com (unknown [7.193.23.202]) by mail.maildlp.com (Postfix) with ESMTPS id 93C29140555; Fri, 12 Jan 2024 11:44:34 +0800 (CST) Received: from ubuntu2204.huawei.com (10.67.174.22) by kwepemm600003.china.huawei.com (7.193.23.202) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Fri, 12 Jan 2024 11:44:33 +0800 From: Yang Jihong To: , , , , , , , , , , CC: Subject: [PATCH] perf build: Check whether pkg-config is installed when libtraceevent is linked Date: Fri, 12 Jan 2024 03:40:19 +0000 Message-ID: <20240112034019.3558584-1-yangjihong1@huawei.com> X-Mailer: git-send-email 2.34.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) To kwepemm600003.china.huawei.com (7.193.23.202) If pkg-config is not installed when libtraceevent is linked, the build fails. The error information is as follows: $ make In file included from /home/yjh/projects_linux/perf-tool-next/linux/tools/perf/util/evsel.c:43: /home/yjh/projects_linux/perf-tool-next/linux/tools/perf/util/trace-event.h:149:62: error: operator '&&' has no right operand 149 | #if defined(LIBTRACEEVENT_VERSION) && LIBTRACEEVENT_VERSION >= MAKE_LIBTRACEEVENT_VERSION(1, 5, 0) | ^~ error: command '/usr/bin/gcc' failed with exit code 1 cp: cannot stat 'python_ext_build/lib/perf*.so': No such file or directory make[2]: *** [Makefile.perf:668: python/perf.cpython-310-x86_64-linux-gnu.so] Error 1 make[2]: *** Waiting for unfinished jobs.... Because pkg-config is not installed, fail to get libtraceevent version in Makefile.config file. As a result, LIBTRACEEVENT_VERSION is empty. However, the preceding error information is not user-friendly. Identify errors in advance by checking that pkg-config is installed at compile time. The build results of various scenarios are as follows: 1. build successful when libtraceevent is not linked and pkg-config is not installed $ pkg-config --version -bash: /usr/bin/pkg-config: No such file or directory $ make clean >/dev/null $ make NO_LIBTRACEEVENT=1 >/dev/null Makefile.config:1133: No alternatives command found, you need to set JDIR= to point to the root of your Java directory PERF_VERSION = 6.7.rc6.gd988c9f511af $ echo $? 0 2. dummy pkg-config is missing when libtraceevent is linked $ pkg-config --version -bash: /usr/bin/pkg-config: No such file or directory $ make clean >/dev/null $ make >/dev/null Makefile.config:221: *** Error: pkg-config needed by libtraceevent is missing on this system, please install it. Stop. make[1]: *** [Makefile.perf:251: sub-make] Error 2 make: *** [Makefile:70: all] Error 2 $ echo $? 2 3. build successful when libtraceevent is linked and pkg-config is installed $ pkg-config --version 0.29.2 $ make clean >/dev/null $ make >/dev/null Makefile.config:1133: No alternatives command found, you need to set JDIR= to point to the root of your Java directory PERF_VERSION = 6.7.rc6.gd988c9f511af $ echo $? 0 Signed-off-by: Yang Jihong --- tools/perf/Makefile.config | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config index aa55850fbc21..70c33c935a98 100644 --- a/tools/perf/Makefile.config +++ b/tools/perf/Makefile.config @@ -216,6 +216,12 @@ ifeq ($(call get-executable,$(BISON)),) dummy := $(error Error: $(BISON) is missing on this system, please install it) endif +ifneq ($(NO_LIBTRACEEVENT),1) + ifeq ($(call get-executable,$(PKG_CONFIG)),) + dummy := $(error Error: $(PKG_CONFIG) needed by libtraceevent is missing on this system, please install it) + endif +endif + ifneq ($(OUTPUT),) ifeq ($(shell expr $(shell $(BISON) --version | grep bison | sed -e 's/.\+ \([0-9]\+\).\([0-9]\+\).\([0-9]\+\)/\1\2\3/g') \>\= 371), 1) BISON_FILE_PREFIX_MAP := --file-prefix-map=$(OUTPUT)= -- 2.34.1