From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from wfhigh7-smtp.messagingengine.com (wfhigh7-smtp.messagingengine.com [64.147.123.158]) (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 611B07E9 for ; Wed, 29 May 2024 00:06:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=64.147.123.158 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716941175; cv=none; b=NayyobK1C4U6gV10CaFRWc/r2G6VNbdVrNGC/nqiHgpvPZO094+AgspDsSoAhQw+WIJwsjHPX2El3QAgc6OGWd3Lq2rL3rH2qDVyfmeOxx75ACkl27B47EdKy9rdP2AnMguJ98GlFQ8qPL61zBa1CLoxtXQ97xjcbZxO+YtlhSw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716941175; c=relaxed/simple; bh=GMt4BF/VcxrhnQ26QoYLyYrabMMDo70CMX5/79p/HKs=; h=MIME-Version:Message-Id:In-Reply-To:References:Date:From:To: Subject:Content-Type; b=Swz3g0aXEcokUwVMy2YoNT2QLP0GeHP/8N4aVswUXAZrRiHz2aQARCHr3VOkYznbgDzDmh6OsdXiPGwqEs6nz3vbkgCJWkJV21gwGK/hlN1o3cGYd+XCLhM0t57z3WeLno1W0e2abU2uPXqFDXO3f9pxcVIfk4VFsQeqNdNyPfo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=fuuzetsu.co.uk; spf=pass smtp.mailfrom=fuuzetsu.co.uk; dkim=pass (2048-bit key) header.d=fuuzetsu.co.uk header.i=@fuuzetsu.co.uk header.b=vjKE/FJQ; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=fpEuADax; arc=none smtp.client-ip=64.147.123.158 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=fuuzetsu.co.uk Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=fuuzetsu.co.uk Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=fuuzetsu.co.uk header.i=@fuuzetsu.co.uk header.b="vjKE/FJQ"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="fpEuADax" Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailfhigh.west.internal (Postfix) with ESMTP id 5CDB618000E8; Tue, 28 May 2024 20:06:12 -0400 (EDT) Received: from imap45 ([10.202.2.95]) by compute3.internal (MEProxy); Tue, 28 May 2024 20:06:12 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fuuzetsu.co.uk; h=cc:content-transfer-encoding:content-type:content-type:date :date:from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm3; t=1716941172; x=1717027572; bh=tbfA+5uedgNeH5uCrKI+0HcMGQuXqEm0VrIH0LFpxYo=; b= vjKE/FJQbRMGO++HvCCQVgcOkEgqCyvpr3C8Lhi+i21lvYl7j4rsbiO7YRKWr8W5 IC9alV4qFH/ZlnCZYjMdJRI7EPVIDf7yKKVDuSxJWok1TPK3XhwFL4iciyrdte16 uP7ZTwhGcx929uZW8gV7whzeXJazeFoIkuCZlGSvfLQpBgZOHEwZdKmu7TtVDO8z wAfXkHTgJA5BFpWHs9/d/E5NXld86YLIc3EaOejinxQKNNTNxayPkJ8ipRawleUL zAuXPnihZ21YjHxrcyDXm6K4QjRb99gQpOCgKFFIH1nCotBqUgWS4mvO38av+XSF OWr/jTpvYKbCi0GemA8Dcg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t=1716941172; x= 1717027572; bh=tbfA+5uedgNeH5uCrKI+0HcMGQuXqEm0VrIH0LFpxYo=; b=f pEuADaxeWKvpo/uq2hdp7aTWLEslserUm0fXnq+V8l1YR0LlluCL7tfzRCcyQHkH 9bUSoVSH2l+oI6IuDWfwR8DByG7AIKaq76DDJRKSqoDbU4HbyvsiHtdUOahwFQdV uwLiM7zHfSvvQTlJ0AF8S2KGBfteIpyKHY7nJCIVmxRUkrvdoB2YQKM/HfGHJaOu PvBAfKXny9CrUkgmvCfuK+TfApfoeZ3vBVkio/E8+Y2pla6nP89Cbt9/9b7tz56I /wD1NEwd27YZ011is4OHUoJvTJ+KfExIJ1sRxmXGWdp2bU0GrJP7paIjiE/lANRv CHQL0mzU8Z/Qki8HeU8lA== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvledrvdejledgfedtucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepofgfggfkjghffffhvffutgfgsehtqhertderreejnecuhfhrohhmpedfofgr thgvuhhsiicumfhofigrlhgtiiihkhdfuceofhhuuhiivghtshhusehfuhhuiigvthhsuh drtghordhukheqnecuggftrfgrthhtvghrnhepfffgffeiieeiffduudehuddutddvkedu keevhfevjefgudehgeetiedtffffkeeunecuvehluhhsthgvrhfuihiivgeptdenucfrrg hrrghmpehmrghilhhfrhhomhepfhhuuhiivghtshhusehfuhhuiigvthhsuhdrtghordhu kh X-ME-Proxy: Feedback-ID: ia5d440cb:Fastmail Received: by mailuser.nyi.internal (Postfix, from userid 501) id 9460D272007D; Tue, 28 May 2024 20:06:11 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.11.0-alpha0-491-g033e30d24-fm-20240520.001-g033e30d2 Precedence: bulk X-Mailing-List: linux-perf-users@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <198bd01f-ffa5-4f9e-9c03-a1193eec25e4@app.fastmail.com> In-Reply-To: <0e2d8cc4-420b-4387-9b26-2f00cbbc1a83@arm.com> References: <0e2d8cc4-420b-4387-9b26-2f00cbbc1a83@arm.com> Date: Wed, 29 May 2024 09:05:45 +0900 From: "Mateusz Kowalczyk" To: "James Clark" , linux-perf-users Subject: Re: Why does libtracevent pkg-config detection wipe PKG_CONFIG_PATH? Content-Type: text/plain;charset=utf-8 Content-Transfer-Encoding: quoted-printable On Wed, 29 May 2024, at 1:09 AM, James Clark wrote: > On 27/05/2024 01:56, Mateusz Kowalczyk wrote: >> Hi, >>=20 >> To build recent perf, I'm having to apply the below patch. >>=20 >> ```diff >> diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config >> index 7f1e016a9253..b70fef12a977 100644 >> --- a/tools/perf/Makefile.config >> +++ b/tools/perf/Makefile.config >> @@ -1181,7 +1181,7 @@ ifneq ($(NO_LIBTRACEEVENT),1) >> CFLAGS +=3D -DHAVE_LIBTRACEEVENT $(LIBTRACEEVENT_CFLAGS) >> LDFLAGS +=3D $(LIBTRACEEVENT_LDFLAGS) >> EXTLIBS +=3D ${TRACEEVENTLIBS} >> - LIBTRACEEVENT_VERSION :=3D $(shell PKG_CONFIG_PATH=3D$(LIBTRACEE= VENT_DIR) $(PKG_CONFIG) --modversion libtraceevent) >> + LIBTRACEEVENT_VERSION :=3D $(shell $(PKG_CONFIG) --modversion li= btraceevent) >> LIBTRACEEVENT_VERSION_1 :=3D $(word 1, $(subst ., ,$(LIBTRACEEVE= NT_VERSION))) >> LIBTRACEEVENT_VERSION_2 :=3D $(word 2, $(subst ., ,$(LIBTRACEEVE= NT_VERSION))) >> LIBTRACEEVENT_VERSION_3 :=3D $(word 3, $(subst ., ,$(LIBTRACEEVE= NT_VERSION))) >> ``` >>=20 >> I don't understand why `PKG_CONFIG_PATH` is overwritten this way. `gr= ep`ing for PKG_CONFIG_PATH reveals that this isn't done anywhere else in= the kernel tree. All other uses of `$(PKG_CONFIG)` in the file simply i= nvoke the tool. >>=20 > > Hi Mateusz, > > If PKG_CONFIG_PATH being overwritten is an issue, I'm assuming that you > have it set in your shell already? Is there a reason you aren't using > the default? Or is it that your version of pkg-config doesn't like that > var being set to an empty value? I have PKG_CONFIG_PATH set in my shell already. I don't have LIBTRACEEVE= NT_DIR set. I'm not sure if pkg-config version is relevant, presumably if PKG_CONFIG= _PATH is empty then no matter the version, it'll fail to resolve anythin= g? Maybe not. Either way, on my setup, PKG_CONFIG_PATH is set explicitly= and libtraceevent.pc is on it. ``` [shana@aya:~/programming/linux/tools/perf]$ echo $PKG_CONFIG_PATH=20 /nix/store/k3701zl6gmx3la7y4dnflcvf3xfy88kh-python3-3.11.9/lib/pkgconfig= :/nix/store/azfzvr6qa3680a8prh3xrpjfr26zmm59-libxslt-1.1.39-dev/lib/pkgc= onfig:/nix/store/z91sa53zd8iscw7bsjphdk8s5b84hwpg-audit-3.1.2-dev/lib/pk= gconfig:/nix/store/zk3sjrzfyjw14yy8jq9yn9nk41clf84q-elfutils-0.191-dev/l= ib/pkgconfig:/nix/store/hf0v7fphfvxrz8dvgv2fxh12vslwh9hs-newt-0.52.24/li= b/pkgconfig:/nix/store/gms9ygkqyhw74nrhxqcm0xf2gpnqbpss-slang-2.3.3-dev/= lib/pkgconfig:/nix/store/2nj2qa56cnq6shqskd9ixipc01s302wb-ncurses-6.4-de= v/lib/pkgconfig:/nix/store/i4w2yc2np0lw8plxri2s2n244ywm1wfy-libtraceeven= t-1.8.2-dev/lib/pkgconfig:/nix/store/m35h4lw1sslg0vdqw0bjkcx5nqlv4pl2-li= bunwind-1.8.1-dev/lib/pkgconfig:/nix/store/j93y8jkrqjy18njpnszvsk792hn1v= d89-xz-5.4.6-dev/lib/pkgconfig:/nix/store/wz1lmhhmvjxj2ipp2z5mvkydchhljg= gm-zlib-1.3.1-dev/lib/pkgconfig:/nix/store/0bp9inq3wd4car25n60idlfics6fa= jjv-openssl-3.0.13-dev/lib/pkgconfig:/nix/store/6a5ryz1dbq8n79qkgcvikgm3= c4fmkp05-numactl-2.0.18-dev/lib/pkgconfig:/nix/store/wwg6376ymkhpjxy6c3w= 9gkbhv6l2gmqy-libxcrypt-4.4.36/lib/pkgconfig:/nix/store/ijj4lm5k5vg7fzf3= w3cbpgfc98d1b01a-babeltrace-1.5.8/lib/pkgconfig:/nix/store/z2jqrpg85lkh7= v9bpz24nsmac1lhs5bs-zstd-1.5.6-dev/lib/pkgconfig:/nix/store/j3hdndafs2ix= bh1bhv95g6pj4bankd1i-libcap-2.69-dev/lib/pkgconfig:/nix/store/srmzd01br3= 9m4w52v9zb66v4ghlxsxfg-attr-2.5.2-dev/lib/pkgconfig [shana@aya:~/programming/linux/tools/perf]$ pkg-config --version 0.29.2 ``` >> Of course, I do actually have `libtraceevent.pc` available, it's just= that `LIBTRACEVENT_DIR` is empty which stops it from finding it. >>=20 >> ``` >> [shana@aya:~/programming/linux/tools/perf]$ pkg-config --modversion l= ibtraceevent >> 1.8.2 >> ``` >>=20 >> If I do not apply the patch, I'm getting the below errors during buil= d. >>=20 >> I'm not sure how others are getting it to build, maybe I'm doing some= thing wrong? Please let me know. If the diff is fine, it'd be great if a= nyone could apply it. >>=20 > > I think your diff needs a small change. I'm assuming it was done this > way to allow the custom libtraceevent path to be specified with > LIBTRACEEVENT_DIR. If you remove that then it can't be done anymore. > > Isn't the right change to set PKG_CONFIG_PATH if LIBTRACEEVENT_DIR is > set, but otherwise leave it unset? I think that sounds right. I'm not sure what that looks like in `Make` b= ut if no-one is up to making the change, I can attempt it at least... > But yes the build is working fine for me. How does it work? Presumably you either must have LIBTRACEEVENT_DIR set = or your pkg-config is able to find libraries even with empty PKG_CONFIG_= PATH. The latter would explain some things. On my setup at least, there = are no "global" default search locations and PKG_CONFIG_PATH basically d= etermines all the library locations. Maybe that's the difference. I gues= s it's easy to verify, if you run `PKG_CONFIG_PATH=3D pkg-config --modve= rsion libtraceevent` then I must assume that it returns something on you= r setup. > James > > >> Thanks! >>=20 >> ``` >> Perhaps you should add the directory containing `libtraceevent.pc' >> to the PKG_CONFIG_PATH environment variable >> No package 'libtraceevent' found >> expr: syntax error: unexpected argument =E2=80=98255=E2=80=99 >>=20 >> Auto-detecting system features: >> ... dwarf: [ on ] >> ... dwarf_getlocations: [ on ] >> ... glibc: [ on ] >> ... libbfd: [ on ] >> ... libbfd-buildid: [ on ] >> ... libcap: [ on ] >> ... libelf: [ on ] >> ... libnuma: [ on ] >> ... numa_num_possible_cpus: [ on ] >> ... libperl: [ on ] >> ... libpython: [ on ] >> ... libcrypto: [ on ] >> ... libunwind: [ on ] >> ... libdw-dwarf-unwind: [ on ] >> ... libcapstone: [ OFF ] >> ... zlib: [ on ] >> ... lzma: [ on ] >> ... get_cpuid: [ on ] >> ... bpf: [ on ] >> ... libaio: [ on ] >> ... libzstd: [ on ] >>=20 >> INSTALL libsubcmd_headers >> PERF_VERSION =3D 6.10.rc1.g1613e604df0c >> GEN perf-archive >> GEN perf-iostat >> INSTALL libsymbol_headers >> INSTALL libapi_headers >> INSTALL libperf_headers >> INSTALL libbpf_headers >> TEST pmu-events/metric_test.log >> CC builtin-bench.o >> CC builtin-annotate.o >> CC builtin-config.o >> CC builtin-diff.o >> CC builtin-evlist.o >> CC builtin-ftrace.o >> CC builtin-help.o >> CC builtin-buildid-list.o >> CC builtin-buildid-cache.o >> CC builtin-kallsyms.o >> CC builtin-list.o >> GEN pmu-events/pmu-events.c >> In file included from util/session.h:5, >> from builtin-buildid-list.c:17: >> util/trace-event.h:152:62: error: operator '&&' has no right operand >> 152 | #if defined(LIBTRACEEVENT_VERSION) && LIBTRACEEVENT_VERSION = >=3D MAKE_LIBTRACEEVENT_VERSION(1, 5, 0) >> | = ^~ >> In file included from util/session.h:5, >> from builtin-evlist.c:15: >> util/trace-event.h:152:62: error: operator '&&' has no right operand >> 152 | #if defined(LIBTRACEEVENT_VERSION) && LIBTRACEEVENT_VERSION = >=3D MAKE_LIBTRACEEVENT_VERSION(1, 5, 0) >> | = ^~ >> In file included from util/session.h:5, >> from builtin-buildid-cache.c:24: >> util/trace-event.h:152:62: error: operator '&&' has no right operand >> 152 | #if defined(LIBTRACEEVENT_VERSION) && LIBTRACEEVENT_VERSION = >=3D MAKE_LIBTRACEEVENT_VERSION(1, 5, 0) >> | = ^~ >> CC builtin-record.o >> In file included from util/session.h:5, >> from builtin-diff.c:15: >> util/trace-event.h:152:62: error: operator '&&' has no right operand >> 152 | #if defined(LIBTRACEEVENT_VERSION) && LIBTRACEEVENT_VERSION = >=3D MAKE_LIBTRACEEVENT_VERSION(1, 5, 0) >> | = ^~ >> CC builtin-report.o >> CC builtin-stat.o >> make[3]: *** [/home/shana/programming/linux/tools/build/Makefile.buil= d:105: builtin-buildid-list.o] Error 1 >> make[3]: *** Waiting for unfinished jobs.... >> make[3]: *** [/home/shana/programming/linux/tools/build/Makefile.buil= d:105: builtin-evlist.o] Error 1 >> In file included from util/session.h:5, >> from builtin-annotate.c:32: >> util/trace-event.h:152:62: error: operator '&&' has no right operand >> 152 | #if defined(LIBTRACEEVENT_VERSION) && LIBTRACEEVENT_VERSION = >=3D MAKE_LIBTRACEEVENT_VERSION(1, 5, 0) >> | = ^~ >> make[3]: *** [/home/shana/programming/linux/tools/build/Makefile.buil= d:105: builtin-buildid-cache.o] Error 1 >> make[3]: *** [/home/shana/programming/linux/tools/build/Makefile.buil= d:105: builtin-annotate.o] Error 1 >> make[3]: *** [/home/shana/programming/linux/tools/build/Makefile.buil= d:105: builtin-diff.o] Error 1 >> In file included from util/session.h:5, >> from builtin-record.c:27: >> util/trace-event.h:152:62: error: operator '&&' has no right operand >> 152 | #if defined(LIBTRACEEVENT_VERSION) && LIBTRACEEVENT_VERSION = >=3D MAKE_LIBTRACEEVENT_VERSION(1, 5, 0) >> | = ^~ >> In file included from util/session.h:5, >> from builtin-stat.c:60: >> util/trace-event.h:152:62: error: operator '&&' has no right operand >> 152 | #if defined(LIBTRACEEVENT_VERSION) && LIBTRACEEVENT_VERSION = >=3D MAKE_LIBTRACEEVENT_VERSION(1, 5, 0) >> | = ^~ >> In file included from util/session.h:5, >> from builtin-report.c:35: >> util/trace-event.h:152:62: error: operator '&&' has no right operand >> 152 | #if defined(LIBTRACEEVENT_VERSION) && LIBTRACEEVENT_VERSION = >=3D MAKE_LIBTRACEEVENT_VERSION(1, 5, 0) >> | = ^~ >> make[3]: *** [/home/shana/programming/linux/tools/build/Makefile.buil= d:105: builtin-record.o] Error 1 >> make[3]: *** [/home/shana/programming/linux/tools/build/Makefile.buil= d:105: builtin-report.o] Error 1 >> make[3]: *** [/home/shana/programming/linux/tools/build/Makefile.buil= d:105: builtin-stat.o] Error 1 >> make[2]: *** [Makefile.perf:727: perf-in.o] Error 2 >> make[2]: *** Waiting for unfinished jobs.... >> CC pmu-events/pmu-events.o >> LD pmu-events/pmu-events-in.o >> make[1]: *** [Makefile.perf:264: sub-make] Error 2 >> make: *** [Makefile:70: all] Error 2 >> perf version 6.10.rc1.g5f00d82dec63 >>=20 >> ``` >>=20 >> -- >> Mateusz K. Thanks! -- Mateusz K