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

微笑、不失礼 提交于 2019-12-05 05:34:37

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.)

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.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!