Search code examples
windowsrustgstreamerchocolateypkg-config

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


I'm trying to build a Rust program that implements gstreamer on Windows, but I can't figure out how to get the dependencies right. I keep getting this error:

--- 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

Here are my dependencies in Cargo.toml:

[dependencies]
gstreamer = "0.16.1"

I installed pkg-config via chocolatey pkgconfiglite. I don't know how to get past this error and I'm stumped.


Solution

  • You need to add C:\gstreamer\1.0\x86_64\lib\pkgconfig to PKG_CONFIG_PATH so that pkg-config can find the .pc file for GStreamer.

    (Moved actual solution to asker's problem up here from comments. Original answer below the line so the comments make sense.)


    According to 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
    

    The README mentions issues with pkg-config and suggests pkg-config-lite, but you seem to already have that so it shouldn't be an issue.

    The Chocolatey gstreamer-devel package might have similar results, but it's not the (apparently) official method.