2013-08-27 42 views
5

許多makefile使用pkg-config,但名稱與包管理器(例如yum/apt)無關。如何將pkg-config名稱映射到它們?有一個竅門嗎?如何將pkg-config名稱映射到yum/apt-get

例子:如果我做yum searchName - 期待通過名稱和近似於pkg配置的名稱

結果:

$ 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 

回答

1

的pkg配置文件通常由-devel包提供這樣在大多數情況下,foo.pc由libfoo-devel提供。這仍然是猜測,但有兩個快捷鍵:

安裝的路徑名,如果你知道在哪裏.PC文件最終會

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

,對於任何文件的工作,但你仍然需要猜出.pc文件是。最好的辦法是使用實​​際pkgconfig要求:

$> yum install "pkgconfig(foo)" 

使用引號,以避免外殼試圖解釋括號。

3

在的情況下易於得到,如果你有一些軟件,抱怨通過pkg配置這個缺失的軟件包,例如:

 
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 

那麼就意味着配置腳本尋找gtk+-2.0 pkgconfig包。

然後,你可以做的是這樣的:

 
$ 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 

這意味着你可以安裝包libgtk2.0-dev的

sudo apt-get install libgtk2.0-dev 

,而且依賴性會滿意。

在原來問題的具體情況:(DBUS,能說會道,0似乎是太舊了在我的系統會顯示)

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

相關問題