无法在 Windows 上编译 gstreamer,因为它缺少 glib-2.0

Cannot compile gstreamer on Windows because it is missing glib-2.0

我正在尝试构建一个在 Windows 上实现 gstreamer 的 Rust 程序,但我不知道如何获得正确的依赖项。我不断收到此错误:

--- stderr
`"pkg-config" "--libs" "--cflags" "glib-2.0" "glib-2.0 >= 2.42"` did not exit successfully: exit code: 1
--- stderr
Package glib-2.0 was not found in the pkg-config search path.
Perhaps you should add the directory containing `glib-2.0.pc'
to the PKG_CONFIG_PATH environment variable
No package 'glib-2.0' found
Package glib-2.0 was not found in the pkg-config search path.
Perhaps you should add the directory containing `glib-2.0.pc'
to the PKG_CONFIG_PATH environment variable
No package 'glib-2.0' found

Process finished with exit code 101

这是我在 Cargo.toml 中的依赖项:

[dependencies]
gstreamer = "0.16.1"

我通过 chocolatey pkgconfiglite 安装了 pkg-config。我不知道如何克服这个错误,我很困惑。

您需要将 C:\gstreamer.0\x86_64\lib\pkgconfig 添加到 PKG_CONFIG_PATH 以便 pkg-config 可以找到 GStreamer 的 .pc 文件。

(将提问者问题的实际解决方案从评论移到此处。原始答案在行下方,以便评论有意义。)


根据the gstreamer-rs README

pacman -S mingw-w64-x86_64-gstreamer mingw-w64-x86_64-gst-plugins-base \
      mingw-w64-x86_64-gst-plugins-good mingw-w64-x86_64-gst-plugins-bad \
      mingw-w64-x86_64-gst-plugins-ugly mingw-w64-x86_64-gst-libav \
      mingw-w64-x86_64-gst-rtsp-server

README 提到了 pkg-config 的问题并建议 pkg-config-lite,但您似乎已经有了,所以这应该不是问题。

Chocolatey gstreamer-devel package可能有类似的结果,但这不是(显然)官方方法。