Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to map pkg-config names to yum/apt-get

Lots of makefiles use pkg-config but the names don't relate to package managers (e.g. yum / apt). How to map pkg-config names to them? is there a trick?

Example: if I do yum searchName -- look through the name and approximate to pkg-config's name

Result:

$ pkg-config --libs dbus-glib-0
Package dbus-glib-0 was not found in the pkg-config search path.
Perhaps you should add the directory containing `dbus-glib-0.pc'
to the PKG_CONFIG_PATH environment variable
No package 'dbus-glib-0' found

$ sudo yum install dbus-glib
Loaded plugins: langpacks, refresh-packagekit
Package dbus-glib-0.100-5.fc19.i686 already installed and latest version
Nothing to do

$ sudo yum install dbus-glib-0
Loaded plugins: langpacks, refresh-packagekit
No package dbus-glib-0 available.
Error: Nothing to do
like image 459
resultsway Avatar asked Aug 27 '13 21:08

resultsway


People also ask

What is pkg-config search path?

This variable is used to augment pkg-config's search path. On a typical Unix system, it will search in the directories /usr/lib/pkgconfig and /usr/share/pkgconfig. This will usually cover system installed modules. However, some local modules may be installed in a different prefix such as /usr/local.

How do I use yum instead of apt-get?

Installing is basically the same, you do 'yum install package' or 'apt-get install package' you get the same result. Yum automatically refreshes the list of packages, whilst with apt-get you must execute a command 'apt-get update' to get the fresh packages. Another difference is upgrading all the packages.

Does Debian use yum or apt-get?

apt is the newest tool of the APT package manager. It's often a source of confusion because users are not sure whether using apt or apt-get for their operations and which are the differences. Let's clear them out here: apt is the right tool when manually handling a Debian-based system.

What is Linux pkg-config?

pkg-config is a helper tool that mainly collects the metadata about installed libraries on computer systems and provides them to a user for easy assembling and integration. Each system has different libraries installed and to compile and link the libraries requires using pkg-config.


2 Answers

In the case of apt-get, if you have some software that complains about this missing package via pkg-config, for instance:

configure: error: Package requirements (gtk+-2.0 >= 2.8) were not met:

No package 'gtk+-2.0' found

Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix.

Alternatively, you may set the environment variables GTK_CFLAGS
and GTK_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.
Error: Could not run ./configure, which is required to configure banshee

Then it means that the configure script is looking for the gtk+-2.0 pkgconfig package.

Then, what you can do is this:

$ sudo apt-get install apt-file
...
$ apt-file update
...
$ apt-file search gtk+-2.0 | grep "\.pc"
libgtk2.0-dev: /usr/lib/x86_64-linux-gnu/pkgconfig/gtk+-2.0.pc

Which means you can install package libgtk2.0-dev:

sudo apt-get install libgtk2.0-dev

And the dependency would be satisfied.

In the particular case of the original question:

$ apt-file search --package-only dbus-glib-1.pc
libdbus-glib-1-dev

(dbus-glib-0 seems to be too old to show up in my system.)

like image 95
knocte Avatar answered Sep 28 '22 09:09

knocte


The pkg-config files are usually provided by the -devel package so in most cases foo.pc is provided by libfoo-devel. That's still guesswork, but there are two shortcuts:

Installing by path name, if you know where the .pc file will end up

 $> yum install /usr/lib64/pkgconfig/foo.pc

That works for any file, but you still need to guess where the .pc file is. The best approach is using the actual pkgconfig requirement:

$> yum install "pkgconfig(foo)"

Use the quotes to avoid the shell trying to interpret the parenthesis.

like image 28
whot Avatar answered Sep 28 '22 11:09

whot