Message ID | 20230110131805.16242-1-dwagner@suse.de |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp2744030wrt; Tue, 10 Jan 2023 05:24:42 -0800 (PST) X-Google-Smtp-Source: AMrXdXvcur3+3XpsKdt5xSmovoWZfvDqBA5GJ/hGhNvmFgkheD7fSE61h97a5zlE+1HviFXW2JkP X-Received: by 2002:a05:6402:538f:b0:45c:835c:1ebb with SMTP id ew15-20020a056402538f00b0045c835c1ebbmr69215295edb.9.1673357082821; Tue, 10 Jan 2023 05:24:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673357082; cv=none; d=google.com; s=arc-20160816; b=QX0uCgjvB8bi1VAyiQJJHsZwAnhY//w88Tc5y3QUCrQPhM98FajLdkcWZ0JqGSDCUZ zq/CMRvpxigs9PljMRSoAoSeTkOVqIurpYpnf9t4+9qzVTkEdn0hIhrbqmdChHU10i/C 1Dais5XbK1Zck/sXO0s2jv42RZjeHkdbYaYp+rZUNIGzefbwqNkUmqFQuovHLSXqAwFS ZyXBkT5QSWr+D2oQnDdJfAzfIt5iNCSsATsrkCP3Gk46gn3gkCTJsxACLp14gdYBnZNL XgCh5vCKkm7DmmCteM3kcuR7UAN7UYf6B8uYs0Rrj4gceDvVdOIiAqLHA6OZXC8jgO7j 9ufA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature:dkim-signature; bh=dZqqazlG3Y9JpfBvsAQu9itiq0NGswEh6VZzATNttmI=; b=L3AhU9eh8/5qnxsFmPDxwsEJfY60ZCUtfWwUFpFv02QfMhQF6dn/2nA4gSNhFOrsVO 0iSmUJd1LS6yJbUbm3tJZz5f9MarkdJI56ZvoCOnZ16j/MO2JCYVDkwGsTgj/DdKHs7X D8k4GC8zARV6vub6yqxDr0QgamecvR2LHa3o027/fBt8vcY8rSMR7rKwbar3cdZPdDSj QMN2UTnFSyOz4RXXuqrLeNayZHaMzAnYqUjgFqR1ytkfRocqG1QGNypeFI1jR4lt3BZP LeTR1gZb3wlMdQK2j4BDO0bBRMWjSrujJGeRUjSOCIZPIje/F3iW4o+s/0jQtVsG2r9z G3Og== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=XjSrUouD; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519 header.b=ycgqBNNZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i9-20020a05640242c900b00485fa68b06csi15148694edc.354.2023.01.10.05.24.16; Tue, 10 Jan 2023 05:24:42 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=XjSrUouD; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519 header.b=ycgqBNNZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231183AbjAJNSn (ORCPT <rfc822;syz17693488234@gmail.com> + 99 others); Tue, 10 Jan 2023 08:18:43 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45534 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231863AbjAJNSO (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Tue, 10 Jan 2023 08:18:14 -0500 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 44687615F; Tue, 10 Jan 2023 05:18:13 -0800 (PST) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id CF8E576049; Tue, 10 Jan 2023 13:18:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1673356691; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=dZqqazlG3Y9JpfBvsAQu9itiq0NGswEh6VZzATNttmI=; b=XjSrUouDnoHbLDwAdUKO1R/fssBxhAuYmeNEey/JJzfd7ox0E0URqSl9J+g6D0sMKy8pxH jzJt0MmBUuaHwrfQs5wOPsH80F+mtFIMpEubf+yExaAM+3sG0DGpy5lkmFGTZ1ZxbUPe9W zH/Pr/cAK94uns80mnBUduO/weIXDA0= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1673356691; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=dZqqazlG3Y9JpfBvsAQu9itiq0NGswEh6VZzATNttmI=; b=ycgqBNNZ4Z2y5izcR0QhfDh9ifbIrdfxQYtuv/PtZ0hIHB/7OwpTU9COIcbeHD3P2EXVy7 XJNhK7khO1Z96XBg== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id C0FD013338; Tue, 10 Jan 2023 13:18:11 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id syATL5NlvWPyNgAAMHmgww (envelope-from <dwagner@suse.de>); Tue, 10 Jan 2023 13:18:11 +0000 From: Daniel Wagner <dwagner@suse.de> To: Daniel Bristot de Oliveira <bristot@kernel.org>, Steven Rostedt <rostedt@goodmis.org> Cc: linux-trace-devel@vger.kernel.org, linux-kernel@vger.kernel.org, Daniel Wagner <dwagner@suse.de> Subject: [PATCH] tools/rtla: Explicitly list libtraceevent dependency Date: Tue, 10 Jan 2023 14:18:05 +0100 Message-Id: <20230110131805.16242-1-dwagner@suse.de> X-Mailer: git-send-email 2.39.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1754642076393722118?= X-GMAIL-MSGID: =?utf-8?q?1754642076393722118?= |
Series |
tools/rtla: Explicitly list libtraceevent dependency
|
|
Commit Message
Daniel Wagner
Jan. 10, 2023, 1:18 p.m. UTC
The current libtracefs.pkg file lists the dependency on
libtraceevent ("pkg-config --libs libtracefs" -> "-ltracefs
-ltraceevent").
Dan Nicholson's Guide to pkg-config[1] stats that "Libs: The link
flags specific to this package and any required libraries that don't
support pkg-config". Thus the current libtracefs.pkg is not correct.
rtla is depending on libtraceevent but it doesn't express this in
'pkg-config' part to retrieve the correct build flags.
In order to be able to update the "Libs:" section in the libtracefs
project we need to list the dependency explicitly to avoid future linker
failures.
[1] https://people.freedesktop.org/~dbn/pkg-config-guide.html
Signed-off-by: Daniel Wagner <dwagner@suse.de>
---
I've got this fallout with because I am using libtraceevent and libtracefs build
with Meson. Meson generates different pkg files which seems to align with Dan's
Guide.
tools/tracing/rtla/Makefile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Comments
On 1/10/23 14:18, Daniel Wagner wrote: > The current libtracefs.pkg file lists the dependency on > libtraceevent ("pkg-config --libs libtracefs" -> "-ltracefs > -ltraceevent"). > > Dan Nicholson's Guide to pkg-config[1] stats that "Libs: The link > flags specific to this package and any required libraries that don't > support pkg-config". Thus the current libtracefs.pkg is not correct. > > rtla is depending on libtraceevent but it doesn't express this in > 'pkg-config' part to retrieve the correct build flags. > > In order to be able to update the "Libs:" section in the libtracefs > project we need to list the dependency explicitly to avoid future linker > failures. I am ok with it. Steve? -- Daniel
On Tue, Jan 10, 2023 at 02:55:03PM +0100, Daniel Bristot de Oliveira wrote: > On 1/10/23 14:18, Daniel Wagner wrote: > > The current libtracefs.pkg file lists the dependency on > > libtraceevent ("pkg-config --libs libtracefs" -> "-ltracefs > > -ltraceevent"). > > > > Dan Nicholson's Guide to pkg-config[1] stats that "Libs: The link > > flags specific to this package and any required libraries that don't > > support pkg-config". Thus the current libtracefs.pkg is not correct. > > > > rtla is depending on libtraceevent but it doesn't express this in > > 'pkg-config' part to retrieve the correct build flags. > > > > In order to be able to update the "Libs:" section in the libtracefs > > project we need to list the dependency explicitly to avoid future linker > > failures. > > I am ok with it. Steve? FWIW, this is change is also backwards compatible, meaning if you have system which has a libtracefs.pkg installed which lists libtraceevent in its Libs: section the 'pkg-config --libs libtracefs libtraceevent' command will return the identically string which is '-ltracefs -ltraceevent'.
On 1/10/23 15:08, Daniel Wagner wrote: > On Tue, Jan 10, 2023 at 02:55:03PM +0100, Daniel Bristot de Oliveira wrote: >> On 1/10/23 14:18, Daniel Wagner wrote: >>> The current libtracefs.pkg file lists the dependency on >>> libtraceevent ("pkg-config --libs libtracefs" -> "-ltracefs >>> -ltraceevent"). >>> >>> Dan Nicholson's Guide to pkg-config[1] stats that "Libs: The link >>> flags specific to this package and any required libraries that don't >>> support pkg-config". Thus the current libtracefs.pkg is not correct. >>> >>> rtla is depending on libtraceevent but it doesn't express this in >>> 'pkg-config' part to retrieve the correct build flags. >>> >>> In order to be able to update the "Libs:" section in the libtracefs >>> project we need to list the dependency explicitly to avoid future linker >>> failures. >> >> I am ok with it. Steve? > > FWIW, this is change is also backwards compatible, meaning if you have system > which has a libtracefs.pkg installed which lists libtraceevent in its Libs: > section the 'pkg-config --libs libtracefs libtraceevent' command will return the > identically string which is '-ltracefs -ltraceevent'. Yeah, we know it. I've added both in the initial implementation, but Steven suggested using only libtracefs because it depends on libtraceevent anyways. That is why I am re-checking with him. -- Daniel
On Tue, Jan 10, 2023 at 03:19:25PM +0100, Daniel Bristot de Oliveira wrote: > FWIW, this is change is also backwards compatible, meaning if you have system > > which has a libtracefs.pkg installed which lists libtraceevent in its Libs: > > section the 'pkg-config --libs libtracefs libtraceevent' command will return the > > identically string which is '-ltracefs -ltraceevent'. > > Yeah, we know it. I've added both in the initial implementation, but Steven suggested > using only libtracefs because it depends on libtraceevent anyways. That is why > I am re-checking with him. Just to clarify, the generated pkg file by Meson is adding the libtraceevent dependency in the private section. So this part should be okay. I would be surprised if Meson would get this wrong at this point. $ cat .build/meson-private/libtracefs.pc prefix=/tmp/trace-cmd includedir=${prefix}/include libdir=${prefix}/lib64 Name: libtracefs Description: Manage trace fs URL: https://git.kernel.org/pub/scm/libs/libtrace/libtracefs.git/ Version: 1.6.3 Requires.private: libtraceevent >= 1.7.0 Libs: -L${libdir} -ltracefs Cflags: -I${includedir}/libtracefs
On Tue, 10 Jan 2023 14:18:05 +0100 Daniel Wagner <dwagner@suse.de> wrote: > The current libtracefs.pkg file lists the dependency on > libtraceevent ("pkg-config --libs libtracefs" -> "-ltracefs > -ltraceevent"). > > Dan Nicholson's Guide to pkg-config[1] stats that "Libs: The link > flags specific to this package and any required libraries that don't > support pkg-config". Thus the current libtracefs.pkg is not correct. > > rtla is depending on libtraceevent but it doesn't express this in > 'pkg-config' part to retrieve the correct build flags. > > In order to be able to update the "Libs:" section in the libtracefs > project we need to list the dependency explicitly to avoid future linker > failures. > > [1] https://people.freedesktop.org/~dbn/pkg-config-guide.html The Libs: field in tracefs only shows the -ltracefs and not -ltraceevent. It follows this rule. It's the "Requires:" tag that pulls in -ltraceevent, correctly. > > Signed-off-by: Daniel Wagner <dwagner@suse.de> > --- > > I've got this fallout with because I am using libtraceevent and libtracefs build > with Meson. Meson generates different pkg files which seems to align with Dan's > Guide. > > tools/tracing/rtla/Makefile | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/tools/tracing/rtla/Makefile b/tools/tracing/rtla/Makefile > index 22e28b76f800..0664e2db22c1 100644 > --- a/tools/tracing/rtla/Makefile > +++ b/tools/tracing/rtla/Makefile > @@ -32,7 +32,7 @@ TRACEFS_HEADERS := $$($(PKG_CONFIG) --cflags libtracefs) > > CFLAGS := -O -g -DVERSION=\"$(VERSION)\" $(FOPTS) $(MOPTS) $(WOPTS) $(TRACEFS_HEADERS) $(EXTRA_CFLAGS) > LDFLAGS := -ggdb $(EXTRA_LDFLAGS) > -LIBS := $$($(PKG_CONFIG) --libs libtracefs) > +LIBS := $$($(PKG_CONFIG) --libs libtracefs libtraceevent) I'm still confused as to why this is needed. According to Dan's document: Requires: A list of packages required by this package. The versions of these packages may be specified using the comparison operators =, <, >, <= or >=. Requires.private: A list of private packages required by this package but not exposed to applications. The version specific rules from the Requires field also apply here. The "Requires" is exported to other applications. It's the private that is not. What is this trying to fix? -- Steve > > SRC := $(wildcard src/*.c) > HDR := $(wildcard src/*.h)
On Tue, 10 Jan 2023 15:45:36 +0100 Daniel Wagner <dwagner@suse.de> wrote: > Just to clarify, the generated pkg file by Meson is adding the libtraceevent > dependency in the private section. So this part should be okay. I would be > surprised if Meson would get this wrong at this point. No that's incorrect. There's many interfaces that require the libtraceevent header files to work with libtracefs. Anything that uses libtracefs must also use libtraceevent, as libtracefs is really just an extension of libtraceevent. > > $ cat .build/meson-private/libtracefs.pc > prefix=/tmp/trace-cmd > includedir=${prefix}/include > libdir=${prefix}/lib64 > > Name: libtracefs > Description: Manage trace fs > URL: https://git.kernel.org/pub/scm/libs/libtrace/libtracefs.git/ > Version: 1.6.3 > Requires.private: libtraceevent >= 1.7.0 This is incorrect. -- Steve > Libs: -L${libdir} -ltracefs > Cflags: -I${includedir}/libtracefs
On Tue, 10 Jan 2023 09:51:37 -0500 Steven Rostedt <rostedt@goodmis.org> wrote: > There's many interfaces that require the libtraceevent header files to work > with libtracefs. Anything that uses libtracefs must also use libtraceevent, > as libtracefs is really just an extension of libtraceevent. Although, I will say, since I hate the libtraceevent interface so much, I may like to hide it via a fully functional libtracefs interface that hides it :-) In which case, this would be correct! -- Steve
On Tue, Jan 10, 2023 at 09:53:47AM -0500, Steven Rostedt wrote: > On Tue, 10 Jan 2023 09:51:37 -0500 > Steven Rostedt <rostedt@goodmis.org> wrote: > > > There's many interfaces that require the libtraceevent header files to work > > with libtracefs. Anything that uses libtracefs must also use libtraceevent, > > as libtracefs is really just an extension of libtraceevent. Okay, in this case I am going update the Meson build to add the necessary explicit dependency: ++ b/src/meson.build @@ -50,6 +50,7 @@ libtracefs_static = static_library( pkg = import('pkgconfig') pkg.generate( libtracefs, + libraries: [libtraceevent_dep], subdirs: 'libtracefs', filebase: meson.project_name(), name: meson.project_name(), $ cat /tmp/trace-cmd/lib64/pkgconfig/libtracefs.pc prefix=/tmp/trace-cmd includedir=${prefix}/include libdir=${prefix}/lib64 Name: libtracefs Description: Manage trace fs URL: https://git.kernel.org/pub/scm/libs/libtrace/libtracefs.git/ Version: 1.6.3 Requires: libtraceevent >= 1.7.0 Libs: -L${libdir} -ltracefs Cflags: -I${includedir}/libtracefs $ PKG_CONFIG_PATH=/tmp/trace-cmd $ pkg-config --libs libtracefs -L/tmp/trace-cmd/lib64 -ltracefs -ltraceevent
diff --git a/tools/tracing/rtla/Makefile b/tools/tracing/rtla/Makefile index 22e28b76f800..0664e2db22c1 100644 --- a/tools/tracing/rtla/Makefile +++ b/tools/tracing/rtla/Makefile @@ -32,7 +32,7 @@ TRACEFS_HEADERS := $$($(PKG_CONFIG) --cflags libtracefs) CFLAGS := -O -g -DVERSION=\"$(VERSION)\" $(FOPTS) $(MOPTS) $(WOPTS) $(TRACEFS_HEADERS) $(EXTRA_CFLAGS) LDFLAGS := -ggdb $(EXTRA_LDFLAGS) -LIBS := $$($(PKG_CONFIG) --libs libtracefs) +LIBS := $$($(PKG_CONFIG) --libs libtracefs libtraceevent) SRC := $(wildcard src/*.c) HDR := $(wildcard src/*.h)