【问题标题】:OS X - PKG_CONFIG_PATH results in empty pc_path, package not foundOS X - PKG_CONFIG_PATH 导致空 pc_path,找不到包
【发布时间】:2015-05-29 08:08:57
【问题描述】:

首先:我使用 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 上,它使用相同的命令。

【问题讨论】:

    标签: build homebrew pkg-config


    【解决方案1】:

    问题在于 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 
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2016-02-05
      • 2019-08-07
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-08-08
      • 2012-02-21
      • 1970-01-01
      相关资源
      最近更新 更多