OS X - PKG_CONFIG_PATH 结果为空 pc_path,找不到包
OS X - PKG_CONFIG_PATH results in empty pc_path, package not found
首先:我使用 OS X 10.10 Yosemite 并且我从终端执行所有操作,不涉及 XCode IDE 或其他 GUI。我从 Homebrew 安装了 pkg-config 版本 0.28。
我想构建一些依赖于 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 上,它使用相同的命令。
问题是 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
首先:我使用 OS X 10.10 Yosemite 并且我从终端执行所有操作,不涉及 XCode IDE 或其他 GUI。我从 Homebrew 安装了 pkg-config 版本 0.28。
我想构建一些依赖于 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 上,它使用相同的命令。
问题是 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