2015-05-29 15 views
0

首先:我使用OS X 10.10 Yosemite,並且我做了一切終端操作,沒有XCode IDE或其他涉及的GUI。我從Homebrew安裝了pkg-config版本0.28。OS X - PKG_CONFIG_PATH導致空的pc_path,未找到包

我想建立一些依賴於Ogre 1.8的軟件。我構建並安裝了OGRE(通過CMAKE_INSTALL_PREFIX)到我的主目錄中的一個自定義位置。

佈局如下:

~/install/bin    contains binaries 
~/install/include   contains OGRE include headers 
~/install/lib    contains static libraries, e.g. libOgreMainStatic.a 
~/install/lib/pkgconfig contains *.pc files for Ogre, e.g. OGRE.pc 

之前我想補充的路徑PKG_CONFIG_PATH我得到這個:

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

這是正常現象。然後我加入~/install/lib/pkgconfig我PKG_CONFIG_PATH這樣的:

$ export PKG_CONFIG_PATH=~/install/lib/pkgconfig 
$ echo $PKG_CONFIG_PATH 
/Users/myusername/install/lib/pkgconfig 

運行

$ pkg-config --variable pc_path OGRE 
    <empty line while I expected the path to OGRE.pc> 

再次只顯示一個空行,但沒有錯誤消息,但是。

當我現在我想建立它的軟件運行CMake的說:

$ cmake . 
<snip> 
-- checking for module 'OGRE' 
-- package 'OGRE' not found 

我在做什麼錯?在Linux上它使用相同的命令。

回答

0

問題是,OGRE.pc引用了Freetype和我從源代碼構建的一些其他需求。雖然Ogre能夠找到它們,因爲它們位於由CMAKE_INSTALL_PREFIX設置的路徑中,但pkgconfig並不是因爲它們沒有提供* .pc文件。

修復之前:

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

修復程序後:

$ pkg-config --libs OGRE 
-L/Users/myusername/install/lib -L/Users/myusername/install/lib/OGRE -lOgreMainStatic -lpthread -lboost-thread-mt -lfreeimage 

我用這個命令發現了這個

相關問題