【问题标题】:Finding Libraries using pkg-config in Windows在 Windows 中使用 pkg-config 查找库
【发布时间】:2012-06-04 08:00:31
【问题描述】:

我正在尝试使用 pkg-config 在 windows (msvc) 中找到 gstreamer 库

pkg-config gstreamer-0.10 --cflags --libs

但是我得到了这样的结果

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

在安装库时会创建一个 .pc 之类的文件(通过使用 RPM、deb 或其他二进制打包系统或通过从源代码编译自动创建)。我在我的 gstreamer 中找不到 .pc 文件目录。

我应该只创建一个包含所有必要详细信息的 .pc 文件吗?

prefix=C:\Program Files (x86)\OSSBuild\GStreamer\v0.10.7
exec_prefix=${prefix}
libdir=${exec_prefix}\lib
includedir=${prefix}\sdk\include\gstreamer-0.10
toolsdir=${exec_prefix}\bin
pluginsdir=${exec_prefix}\lib\gstreamer-0.10
datarootdir=${prefix}\share
datadir=${datarootdir}
girdir=${datadir}/gir-1.0
typelibdir=${libdir}/girepository-1.0

Name: GStreamer
Description: Streaming media framework
Requires: glib-2.0, gobject-2.0, gmodule-no-export-2.0, gthread-2.0, libxml-2.0
Version: 0.10.35
Libs: -L${libdir} -lgstreamer-0.10
Cflags: -I${includedir}

或者还有其他方法可以做到这一点还是我错过了什么?

希望您能提供帮助。感谢您花时间阅读问题。

好吧,我这样做是为了找到解决方案,为什么我在为 gstreamer 配置的 waf 中收到 not found 消息

conf.check_cfg(atleast_pkgconfig_version='0.0.0') 
conf.check_cfg(package='gstreamer-0.10', uselib_store='GSTREAMER', args='--cflags --libs', mandatory=True)

代码在 linux 中运行,应该也可以在 windows 中运行。


稍后添加

制作 .pc 并将 .pc 目录的路径设置为 PKG_CONFIG_PATH 环境变量就可以了。这并不难

签出this。感谢您阅读并帮助我..:)

【问题讨论】:

  • 意思是。我只是想知道如何使用 pkconfig 在 Windows 中找到某些库。
  • 嗯,安装了吗? mingw 还是 cygwin?它安装在哪里?试试configure --help
  • @sehe 感谢您回复 .pk-config 已安装并正常工作。我在 Environment 添加了一个变量 PKG_CONFIG_PATH 并在名为 gstreamer-0.10.pc 的路径目录中创建了一些 .pc 文件。
  • 你是如何安装 gstreamer - pkg_config 仅在 Unixy 安装过程完成后才有意义
  • @Mark 我从 src 编译了 gstreamer。 code.google.com/p/ossbuild。好吧,我没有找到任何其他方法,我不得不为它制作 pc 文件。:(...但它工作正常..:)

标签: windows waf pkg-config


【解决方案1】:

pkg-config 是一个很棒的工具,但不幸的是在 Windows(与 UNIX 相比)上没有标准的可执行 PATH 或 PKG_CONFIG_PATH。

虽然您可以恢复为定义选项 --with-gstreamer-include-dir ... --with-gstreamer-lib-dir ... 并避免 pkg-config 依赖,但您也可以使用 --pkgconfig- exe c:\path\to\pkg-config.exe --pkgconfig-path c:\path\to\gstreamer;c:\path\to\otherlib,这将有助于获得好看的 wscript,尤其是在使用很多 pkg-config 库。

典型的 Win32 用户可能在直接设置 PKG_CONFIG_PATH 和 PATH 时遇到问题,或者偶然发现一个神秘的“未找到”错误,然后检查 config.log。

如果您确实添加了特定于 Windows 的 pkg-config 选项,那么每个人都可能会感兴趣。 您可以编写一个 pkgconfig_opts 工具并将其作为 waf extra 提交。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2023-03-17
    • 1970-01-01
    • 1970-01-01
    • 2011-04-27
    • 1970-01-01
    • 2018-11-12
    • 2013-02-13
    • 2020-07-21
    相关资源
    最近更新 更多