Skip to contentSkip to conversation

trace-cmd: Add Requires: libtracefs to libtracecmd.pc file

PATCH In review Steven Rostedt 2 participants 5 messages Nov 9, 2021 – Nov 11, 2021

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 trace-cmd: Add Requires: libtracefs to libtracecmd.pc file

From: "Steven Rostedt (VMware)" <[email protected]>

In order to not have users of libtracecmd having to also include the includes and libraries for libtracefs and libraceevent, add a requires field for libtracefs to the libtracecmd.pc file. As libtracefs requires libtraceevent, it will pull that one in as well.

---
 libtracecmd.pc.template | 1 +
 scripts/utils.mk        | 1 +
 2 files changed, 2 insertions(+)
libtracecmd.pc.template +1 -0
index dc41076e..bcf4e39d 100644
@@ -6,5 +6,6 @@ Name: libtracecmd
 URL: https://git.kernel.org/pub/scm/utils/trace-cmd/trace-cmd.git/
 Description: Library for creating and reading trace-cmd data files
 Version: LIB_VERSION
+Requires: libtracefs >= LIBTRACEFS_MIN_VERSION
 Cflags: -I${includedir}
 Libs: -L${libdir} -ltracecmd
scripts/utils.mk +1 -0
index 237b2fc9..6865a746 100644
@@ -169,6 +169,7 @@ define do_make_pkgconfig_file
 	sed -i "s|INSTALL_PREFIX|${1}|g" ${PKG_CONFIG_FILE}; 		\
 	sed -i "s|LIB_VERSION|${LIBTRACECMD_VERSION}|g" ${PKG_CONFIG_FILE}; \
 	sed -i "s|LIB_DIR|$(libdir)|g" ${PKG_CONFIG_FILE}; \
+	sed -i "s|LIBTRACEFS_MIN_VERSION|$(LIBTRACEFS_MIN_VERSION)|g" ${PKG_CONFIG_FILE}; \
 	sed -i "s|HEADER_DIR|$(includedir)/trace-cmd|g" ${PKG_CONFIG_FILE};
 endef
 
Signature · 1 line
2.31.1
#1 lore raw
Quoted 18 lines · Steven Rostedt

From: "Steven Rostedt (VMware)" <[email protected]>

In order to not have users of libtracecmd having to also include the includes and libraries for libtracefs and libraceevent, add a requires field for libtracefs to the libtracecmd.pc file. As libtracefs requires libtraceevent, it will pull that one in as well.

---
  libtracecmd.pc.template | 1 +
  scripts/utils.mk        | 1 +
  2 files changed, 2 insertions(+)
libtracecmd.pc.template +0 -0
index dc41076e..bcf4e39d 100644

libtracecmd.pc.template Name: libtracecmd · line 9

Quoted 4 lines
libtracecmd.pc.template +1 -0
@@ -6,5 +6,6 @@ Name: libtracecmd
  URL: https://git.kernel.org/pub/scm/utils/trace-cmd/trace-cmd.git/
  Description: Library for creating and reading trace-cmd data files
  Version: LIB_VERSION
+Requires: libtracefs >= LIBTRACEFS_MIN_VERSION

BTW this works also without the 'lib' prefix:

Requires: tracefs >= LIBTRACEFS_MIN_VERSION

cheers,
Yordan

Quoted 15 lines
libtracecmd.pc.template +0 -0
  Cflags: -I${includedir}
  Libs: -L${libdir} -ltracecmd
scripts/utils.mk +1 -0
index 237b2fc9..6865a746 100644
@@ -169,6 +169,7 @@ define do_make_pkgconfig_file
  	sed -i "s|INSTALL_PREFIX|${1}|g" ${PKG_CONFIG_FILE}; 		\
  	sed -i "s|LIB_VERSION|${LIBTRACECMD_VERSION}|g" ${PKG_CONFIG_FILE}; \
  	sed -i "s|LIB_DIR|$(libdir)|g" ${PKG_CONFIG_FILE}; \
+	sed -i "s|LIBTRACEFS_MIN_VERSION|$(LIBTRACEFS_MIN_VERSION)|g" ${PKG_CONFIG_FILE}; \
  	sed -i "s|HEADER_DIR|$(includedir)/trace-cmd|g" ${PKG_CONFIG_FILE};
  endef
 
#2 lore raw
Quoted 26 lines · On Wed, 10 Nov 2021 16:12:12 +0200 Yordan Karadzhov <[email protected]> wrote:
Quoted 18 lines · Steven Rostedt

From: "Steven Rostedt (VMware)" <[email protected]>

In order to not have users of libtracecmd having to also include the includes and libraries for libtracefs and libraceevent, add a requires field for libtracefs to the libtracecmd.pc file. As libtracefs requires libtraceevent, it will pull that one in as well.

---
  libtracecmd.pc.template | 1 +
  scripts/utils.mk        | 1 +
  2 files changed, 2 insertions(+)
libtracecmd.pc.template +0 -0
index dc41076e..bcf4e39d 100644

libtracecmd.pc.template Name: libtracecmd · line 9

Quoted 4 lines
libtracecmd.pc.template +1 -0
@@ -6,5 +6,6 @@ Name: libtracecmd
  URL: https://git.kernel.org/pub/scm/utils/trace-cmd/trace-cmd.git/
  Description: Library for creating and reading trace-cmd data files
  Version: LIB_VERSION
+Requires: libtracefs >= LIBTRACEFS_MIN_VERSION  

BTW this works also without the 'lib' prefix:

Quoted 1 line

Requires: tracefs >= LIBTRACEFS_MIN_VERSION

I just tried that on Fedora, and get this:

# pkg-config --libs libtracecmd
Package tracefs was not found in the pkg-config search path.
Perhaps you should add the directory containing `tracefs.pc'
to the PKG_CONFIG_PATH environment variable
Package 'tracefs', required by 'libtracecmd', not found

-- Steve

#3 lore raw
Quoted 31 lines · Steven Rostedt
Quoted 26 lines · On Wed, 10 Nov 2021 16:12:12 +0200 Yordan Karadzhov <[email protected]> wrote:
Quoted 18 lines · Steven Rostedt

From: "Steven Rostedt (VMware)" <[email protected]>

In order to not have users of libtracecmd having to also include the includes and libraries for libtracefs and libraceevent, add a requires field for libtracefs to the libtracecmd.pc file. As libtracefs requires libtraceevent, it will pull that one in as well.

---
   libtracecmd.pc.template | 1 +
   scripts/utils.mk        | 1 +
   2 files changed, 2 insertions(+)
libtracecmd.pc.template +0 -0
index dc41076e..bcf4e39d 100644

libtracecmd.pc.template Name: libtracecmd · line 9

Quoted 4 lines
libtracecmd.pc.template +1 -0
@@ -6,5 +6,6 @@ Name: libtracecmd
   URL: https://git.kernel.org/pub/scm/utils/trace-cmd/trace-cmd.git/
   Description: Library for creating and reading trace-cmd data files
   Version: LIB_VERSION
+Requires: libtracefs >= LIBTRACEFS_MIN_VERSION

BTW this works also without the 'lib' prefix:

Quoted 1 line

Requires: tracefs >= LIBTRACEFS_MIN_VERSION

Quoted 7 lines

I just tried that on Fedora, and get this:

# pkg-config --libs libtracecmd
Package tracefs was not found in the pkg-config search path.
Perhaps you should add the directory containing `tracefs.pc'
to the PKG_CONFIG_PATH environment variable
Package 'tracefs', required by 'libtracecmd', not found

OK, it looks like what matters is really the name of the .pc file (and the 'Name: ...' line). I was confused because 'json-c.ps' has no 'lib' prefix. Looking into

/usr/local/lib/x86_64-linux-gnu/pkgconfig

I see that most of the configuration files do not have 'lib', however there is also a number of files starting with 'lib'. I wonder if there is some rule about using this 'lib' prefix.

Thanks!
Yordan

Quoted 3 lines

-- Steve

#4 lore raw
Quoted 6 lines · On Thu, 11 Nov 2021 10:12:46 +0200 Yordan Karadzhov <[email protected]> wrote:

. Looking into

/usr/local/lib/x86_64-linux-gnu/pkgconfig

I see that most of the configuration files do not have 'lib', however there is also a number of files starting with 'lib'. I wonder if there is some rule about using this 'lib' prefix.

Mostly just preference by those creating it. I used it to differentiate the terms. "tracefs" is the file system that "libtracefs" manipulates.

And libtraceevents is because it's always been that. I'm not even sure if I'm the one that called it.

It also should match the name of the repos. As we call the repos libtracefs and libtraceevent, we should have the pkgconfig files match it as well. And the name of the packages (.deb or .rpm) should match.

-- Steve