Skip to content

Building GStreamer from Source on macOS with MacPorts

fduncanh edited this page Nov 18, 2024 · 21 revisions

This is useful because MacPorts does not currently supply a GStreamer that supports OpenGl.

GStreamer 1.24.9 (most recent stable release) can be successfully built from source on MacOS systems using MacPorts 2.10.4 (this was tested on macOS 14.7.1 Sonoma with Xcode 16.1 (Apple Silicon)):

  • install the build system:
sudo port install meson ninja bison flex cmake git pkgconfig
  • Optionally install some of the external libraries used by GStreamer:
sudo port install glib2 libvorbis libogg libopus libdv libjpeg-turbo flac

(This prevent these libraries from being downloaded and built: this reduces compile time and may be needed because if you let the GStreamer build process download and compile them itself, some may fail to build.)

  • now download GStreamer, build and install (this assumes v1.24.9; modify as needed, method is valid for 1.20.0 and later). This installs GStreamer in /usr/local/lib.
git clone https://gitlab.freedesktop.org/gstreamer/gstreamer
cd gstreamer
git checkout 1.24.9
export LIBRARY_PATH=/opt/local/lib:$LIBRARY_PATH
meson setup build -Dgst_plugins=base:gl_winsys=cocoa -Dqt5=disabled -Dqt6=disabled -Dpython=disabled
cd build
ninja
sudo ninja install

(the -D options above were to stop compilation of unnecessary components that failed to compile; you may have to identify and remove similar but different errors when you attempt your own GStreamer build).

On systems using MacPorts, it is important that LIBRARY_PATH points first to the MacPorts libraries in /opt/local/lib during compilation of GStreamer, because MacPorts has modified symbols in libiconv, and you must prevent the macOS version of libiconv in /usr/lib from being used. (This leads to build failures with the error "_iconv not found".)