From patchwork Fri Jan 12 03:40:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yang Jihong X-Patchwork-Id: 187560 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:2411:b0:101:2151:f287 with SMTP id m17csp1886102dyi; Thu, 11 Jan 2024 19:45:59 -0800 (PST) X-Google-Smtp-Source: AGHT+IGnrfJUCZLYPIImLB8YxrVRv4BTWxvqBKG+wDzV30b5HQpvrvudNbCkS0xvfZiOXqI6hnOZ X-Received: by 2002:a05:6a20:816:b0:19a:46b8:fd1e with SMTP id z22-20020a056a20081600b0019a46b8fd1emr269412pza.43.1705031159739; Thu, 11 Jan 2024 19:45:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1705031159; cv=none; d=google.com; s=arc-20160816; b=g/3lJpkoKyI5P3EQYfpp2t09PkWSJYtFJHT2lE2NBoS7EgtMV1J4QoHfGflp+2Bokh g/SX2cVxXAFnY2JOVoyR2sTV4xKjNwsyvzf3ksrg1HsXtct3Xs2hXBotdcGRxVrEmHAs PObfha8PHz+1dxp7jZugCB8hLGsfi/m1uNj/oM9cvSmuWmHe1RhkLuWBCyqnMWqnHWlg BavblcBriOBriHCtBPjJxuHjuqUtBDTBhbau+eIbR90Z0vE5GDY81zmc6JwARX9LiSar qv6YB6Cg8MA93ZUTrkeeJNA5kWbMbzV2F5o7MpHuoiHF17gXU/pgBBuoUyG1iPBSFnz8 GT/g== 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-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-24272-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id kc12-20020a17090333cc00b001d50895d963si2367368plb.524.2024.01.11.19.45.59 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Jan 2024 19:45:59 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-24272-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-24272-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-24272-ouuuleilei=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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 1E9D22871C6 for ; Fri, 12 Jan 2024 03:45:14 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 274DF1B298; Fri, 12 Jan 2024 03:44:58 +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 X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) To kwepemm600003.china.huawei.com (7.193.23.202) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1787854752936213588 X-GMAIL-MSGID: 1787854752936213588 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 Acked-by: Namhyung Kim --- 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)=