How to install rust plugins compatible with version 1.16.3

Hello, looking for some info about how to build specific version of gst-plugin-rs to be compatible with specific version of GStreamer ?
Currently I am using GStreamer 1.16.3 and I can’t manage the installation of gst-plugin-rs. I get this error :

error: failed to run custom build command for `gstreamer-sys v0.24.0 (https://gitlab.freedesktop.org/gstreamer/gstreamer-rs?branch=main#5c395003)`

Caused by:
  process didn't exit successfully: `/gst-plugins-rs/target/release/build/gstreamer-sys-73ca47d224fa0cb8/build-script-build` (exit status: 1)
  --- stdout
  cargo:rerun-if-changed=/root/.cargo/git/checkouts/gstreamer-rs-79e52a2d27eb91a3/5c39500/gstreamer/sys/Cargo.toml
  cargo:rerun-if-env-changed=GSTREAMER_1.0_NO_PKG_CONFIG
  cargo:rerun-if-env-changed=PKG_CONFIG_aarch64-unknown-linux-gnu
  cargo:rerun-if-env-changed=PKG_CONFIG_aarch64_unknown_linux_gnu
  cargo:rerun-if-env-changed=HOST_PKG_CONFIG
  cargo:rerun-if-env-changed=PKG_CONFIG
  cargo:rerun-if-env-changed=PKG_CONFIG_PATH_aarch64-unknown-linux-gnu
  cargo:rerun-if-env-changed=PKG_CONFIG_PATH_aarch64_unknown_linux_gnu
  cargo:rerun-if-env-changed=HOST_PKG_CONFIG_PATH
  cargo:rerun-if-env-changed=PKG_CONFIG_PATH
  cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_aarch64-unknown-linux-gnu
  cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_aarch64_unknown_linux_gnu
  cargo:rerun-if-env-changed=HOST_PKG_CONFIG_LIBDIR
  cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR
  cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_aarch64-unknown-linux-gnu
  cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_aarch64_unknown_linux_gnu
  cargo:rerun-if-env-changed=HOST_PKG_CONFIG_SYSROOT_DIR
  cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR
  cargo:warning=
  pkg-config exited with status code 1
  > PKG_CONFIG_PATH=/usr/lib/aarch64-linux-gnu/pkgconfig:/usr/local/lib/pkgconfig:/usr/lib/pkgconfig PKG_CONFIG_ALLOW_SYSTEM_CFLAGS=1 pkg-config --libs --cflags gstreamer-1.0 gstreamer-1.0 >= 1.24

  The system library `gstreamer-1.0` required by crate `gstreamer-sys` was not found.
  The file `gstreamer-1.0.pc` needs to be installed and the PKG_CONFIG_PATH environment variable must contain its parent directory.
  PKG_CONFIG_PATH contains the following:
      - /usr/lib/aarch64-linux-gnu/pkgconfig
      - /usr/local/lib/pkgconfig
      - /usr/lib/pkgconfig

  HINT: you may need to install a package such as gstreamer-1.0, gstreamer-1.0-dev or gstreamer-1.0-devel.

warning: build failed, waiting for other jobs to finish...

You will need to install the package that contains the GStreamer library header files. On debian/ubuntu that would be sudo apt install libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev libgstreamer-plugins-bad1.0-dev.

If you installed GStreamer yourself into a different prefix you may need to set PKG_CONFIG_PATH to the pkgconfig directory in the prefix.

I download that and I get the following :

cargo:rerun-if-env-changed=GSTREAMER_1.0_NO_PKG_CONFIG                                   
  cargo:rerun-if-env-changed=PKG_CONFIG_aarch64-unknown-linux-gnu                          
  cargo:rerun-if-env-changed=PKG_CONFIG_aarch64_unknown_linux_gnu                          
  cargo:rerun-if-env-changed=HOST_PKG_CONFIG                                               
  cargo:rerun-if-env-changed=PKG_CONFIG                                                    
  cargo:rerun-if-env-changed=PKG_CONFIG_PATH_aarch64-unknown-linux-gnu                     
  cargo:rerun-if-env-changed=PKG_CONFIG_PATH_aarch64_unknown_linux_gnu                     
  cargo:rerun-if-env-changed=HOST_PKG_CONFIG_PATH                                          
  cargo:rerun-if-env-changed=PKG_CONFIG_PATH                                               
  cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_aarch64-unknown-linux-gnu                   
  cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_aarch64_unknown_linux_gnu                   
  cargo:rerun-if-env-changed=HOST_PKG_CONFIG_LIBDIR                                        
  cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR                                             
  cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_aarch64-unknown-linux-gnu              
  cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_aarch64_unknown_linux_gnu              
  cargo:rerun-if-env-changed=HOST_PKG_CONFIG_SYSROOT_DIR                                   
  cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR                                        
  cargo:warning=                                                                           
  pkg-config exited with status code 1    
  > PKG_CONFIG_ALLOW_SYSTEM_CFLAGS=1 pkg-config --libs --cflags gstreamer-1.0 gstreamer-1.0
 >= 1.24                                                                                   

  The system library `gstreamer-1.0` required by crate `gstreamer-sys` was not found.
  The file `gstreamer-1.0.pc` needs to be installed and the PKG_CONFIG_PATH environment var
iable must contain its parent directory.     
  The PKG_CONFIG_PATH environment variable is not set.

It seems it looks for version 1.24 even though I have version 1.16.3 installed…

It seems this is the specific line that is causing a problem :

  pkg-config exited with status code 1    
  > PKG_CONFIG_ALLOW_SYSTEM_CFLAGS=1 pkg-config --libs --cflags gstreamer-1.0 gstreamer-1.0
 >= 1.24    

Also It seems that the package are not available on Ubuntu :

Step 6/10 : RUN apt-get install libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev       gstreamer1.0-plugins-base gstreamer1.0-plugins-good       gstreamer1.0-plugins-bad gstreamer1.0-plugins-ugly       gstreamer1.0-libav libgstrtspserver-1.0-dev libges-1.0-dev
 ---> Running in 6b794f5983ed
Reading package lists...
Building dependency tree...
Reading state information...
E: Unable to locate package libgstreamer1.0-dev
E: Couldn't find any package by glob 'libgstreamer1.0-dev'
E: Couldn't find any package by regex 'libgstreamer1.0-dev'
E: Unable to locate package libgstreamer-plugins-base1.0-dev
E: Couldn't find any package by glob 'libgstreamer-plugins-base1.0-dev'
E: Couldn't find any package by regex 'libgstreamer-plugins-base1.0-dev'
E: Unable to locate package gstreamer1.0-plugins-base
E: Couldn't find any package by glob 'gstreamer1.0-plugins-base'
E: Couldn't find any package by regex 'gstreamer1.0-plugins-base'
E: Unable to locate package gstreamer1.0-plugins-good
E: Couldn't find any package by glob 'gstreamer1.0-plugins-good'
E: Couldn't find any package by regex 'gstreamer1.0-plugins-good'
E: Unable to locate package gstreamer1.0-plugins-bad
E: Couldn't find any package by glob 'gstreamer1.0-plugins-bad'
E: Couldn't find any package by regex 'gstreamer1.0-plugins-bad'
E: Unable to locate package gstreamer1.0-plugins-ugly
E: Couldn't find any package by glob 'gstreamer1.0-plugins-ugly'
E: Couldn't find any package by regex 'gstreamer1.0-plugins-ugly'
E: Unable to locate package gstreamer1.0-libav
E: Couldn't find any package by glob 'gstreamer1.0-libav'
E: Couldn't find any package by regex 'gstreamer1.0-libav'
E: Unable to locate package libgstrtspserver-1.0-dev
E: Couldn't find any package by glob 'libgstrtspserver-1.0-dev'
E: Couldn't find any package by regex 'libgstrtspserver-1.0-dev'
E: Unable to locate package libges-1.0-dev
E: Couldn't find any package by glob 'libges-1.0-dev'
E: Couldn't find any package by regex 'libges-1.0-dev'

How do you build the plugins?

That looks like a problem on your side, see e.g. libgstreamer1.0-dev. Did you forget to run apt update before and don’t have any package index inside your container?

I managed to fix the problem by using the version where the plugin I need was introduced, so on branch 0.9 if I’m not mistaken. And building GStreamer from source.
Then I use cargo cbuild -p for the specific plugin I need and I specify with the prefix the path where my gstreamer is installed and it seems to work.
However the version I am currently using GStreamer which is v1.16 is not compatible with v0.9 of rust plugins. So I plan to move to version 1.20 which is on Jetpack 6 and for the moment I will use it on a docker.

Version 1.20 of GStreamer seems to be compatible up to v0.11 of the rust plugins so I will be using both of those.
However I have trouble installing version1.20 of GStreamer with all the plugins.
Here’s my dockerfile :

# Use a base image with the necessary dependencies
FROM ubuntu:20.04

# Set environment variables
ENV DEBIAN_FRONTEND=noninteractive
ENV RUSTUP_HOME=/usr/local/rustup
ENV CARGO_HOME=/usr/local/cargo
ENV PATH=$CARGO_HOME/bin:$PATH

# Install dependencies
RUN apt-get update && apt-get install -y \
    build-essential \
    ninja-build \
    libtool \
    autoconf \
    automake \
    pkg-config \
    bison \
    flex \
    gtk-doc-tools \
    python3 \
    python3-pip \
    python3-setuptools \
    libglib2.0-dev \
    libgstreamer1.0-dev \
    libgstreamer-plugins-base1.0-dev \
    git \
    curl \
    sudo \
    ca-certificates \
    libssl-dev \
    libxml2-dev \
    libharfbuzz-dev \
    libopenjp2-7-dev \
    && apt-get clean

RUN pip install meson

# Install Rust and Cargo
RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain stable
RUN $CARGO_HOME/bin/rustup update
RUN $CARGO_HOME/bin/cargo install cargo-c

# Clone the gst-build repository
RUN git clone --recurse-submodules https://gitlab.freedesktop.org/gstreamer/gstreamer.git

# Set the working directory
WORKDIR /gstreamer

# Optionally checkout a specific branch or version, like 1.20
RUN git checkout 1.20

# Configure and build GStreamer with all plugins
RUN meson setup builddir && meson subprojects update && meson compile -C builddir && meson install -C builddir
# Set entry point (optional)
ENTRYPOINT ["/bin/bash"]

To solve it I tried to install some libraries it didn’t work :

    libxml2-dev \
    libharfbuzz-dev \
    libopenjp2-7-dev \

And I get this error :

  -> 4a28ebb (HEAD -> meson, origin/meson, origin/HEAD) quant: Fix buffer overflow detected by ASAN [Nirbheek Chauhan]
Updating cairo...
  -> a04786b (grafted, HEAD) Merge branch 'ci-update-windows-image-2' into 'master' [Tim-Philipp Müller]
Updating fribidi...
  -> 247fddc (grafted, HEAD, tag: v1.0.11) Bumped version to 1.0.11 [Khaled Hosny]
Updating FFmpeg...
  -> f1414b0848 (HEAD -> meson-4.4.2, origin/meson-4.4.2) meson: bump version to 4.4.2 [Tim-Philipp Müller]
Updating gperf...
  -> c24359b (HEAD -> meson, origin/meson, origin/HEAD) Merge branch 'meson' into 'meson' [Tim-Philipp Müller]
WARNING: Please check logs above as command failed in some subprojects which could have been left in conflict state: fdk-aac, ogg, vorbis, sqlite3, libdrm, pygobject, libjpeg-turbo, pango, lame, libpng
The command '/bin/sh -c meson setup builddir && meson subprojects update && meson compile -C builddir && meson install -C builddir' returned a non-zero code: 10

Also I tried to clone recursively, and it didn’t fix anything.

Most plugins in gst-plugins-rs up to git main are compatible with GStreamer 1.14 and newer. Some require a newer version of GStreamer, some can optionally make use of a newer version.

From your description it’s not clear how you’re building gst-plugins-rs exactly, and which plugin(s) you need.

I need the webrtc and the webrtchttp plugin.

I just retried the steps one by one on my jetson with 1.16.

I did cargo cbuild -p gst-plugin-webrtc --prefix=/usr
on /net/webrtc/

I get this error:

  pkg-config exited with status code 1
  > PKG_CONFIG_ALLOW_SYSTEM_CFLAGS=1 pkg-config --libs --cflags gstreamer-1.0 gstreamer-1.0 >= 1.22

  The system library `gstreamer-1.0` required by crate `gstreamer-sys` was not found.
  The file `gstreamer-1.0.pc` needs to be installed and the PKG_CONFIG_PATH environment variable must contain its parent directory.
  The PKG_CONFIG_PATH environment variable is not set.

  HINT: if you have installed the library, try setting PKG_CONFIG_PATH to the directory containing `gstreamer-1.0.pc`.

warning: build failed, waiting for other jobs to finish...
The following warnings were emitted during compilation:

warning: gstreamer-base-sys@0.24.0: 

error: failed to run custom build command for `gstreamer-base-sys v0.24.0 (https://gitlab.freedesktop.org/gstreamer/gstreamer-rs?branch=main#df52948b)`

Caused by:
  process didn't exit successfully: `/home/janice/gst-rs/target/debug/build/gstreamer-base-sys-e9591a8ba9501008/build-script-build` (exit status: 1)
  --- stdout
  cargo:rerun-if-changed=/home/janice/.cargo/git/checkouts/gstreamer-rs-79e52a2d27eb91a3/df52948/gstreamer-base/sys/Cargo.toml
  cargo:rerun-if-env-changed=GSTREAMER_BASE_1.0_NO_PKG_CONFIG
  cargo:rerun-if-env-changed=PKG_CONFIG_aarch64-unknown-linux-gnu
  cargo:rerun-if-env-changed=PKG_CONFIG_aarch64_unknown_linux_gnu
  cargo:rerun-if-env-changed=HOST_PKG_CONFIG
  cargo:rerun-if-env-changed=PKG_CONFIG
  cargo:rerun-if-env-changed=PKG_CONFIG_PATH_aarch64-unknown-linux-gnu
  cargo:rerun-if-env-changed=PKG_CONFIG_PATH_aarch64_unknown_linux_gnu
  cargo:rerun-if-env-changed=HOST_PKG_CONFIG_PATH
  cargo:rerun-if-env-changed=PKG_CONFIG_PATH
  cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_aarch64-unknown-linux-gnu
  cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_aarch64_unknown_linux_gnu
  cargo:rerun-if-env-changed=HOST_PKG_CONFIG_LIBDIR
  cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR
  cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_aarch64-unknown-linux-gnu
  cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_aarch64_unknown_linux_gnu
  cargo:rerun-if-env-changed=HOST_PKG_CONFIG_SYSROOT_DIR
  cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR
  cargo:warning=
  pkg-config exited with status code 1
  > PKG_CONFIG_ALLOW_SYSTEM_CFLAGS=1 pkg-config --libs --cflags gstreamer-base-1.0 gstreamer-base-1.0 >= 1.22

  The system library `gstreamer-base-1.0` required by crate `gstreamer-base-sys` was not found.
  The file `gstreamer-base-1.0.pc` needs to be installed and the PKG_CONFIG_PATH environment variable must contain its parent directory.
  The PKG_CONFIG_PATH environment variable is not set.

  HINT: if you have installed the library, try setting PKG_CONFIG_PATH to the directory containing `gstreamer-base-1.0.pc`.

Error: CliError { error: Some(2 jobs failed), exit_code: 101 }

Then I try to use tpm advice:

webrtc git:(main) sudo apt update
Hit:2 https://repo.download.nvidia.com/jetson/common r35.5 InRelease                     
Hit:3 http://ports.ubuntu.com/ubuntu-ports focal InRelease                               
Hit:4 http://ports.ubuntu.com/ubuntu-ports focal-updates InRelease                                              
Hit:5 http://ports.ubuntu.com/ubuntu-ports focal-backports InRelease                                            
Hit:6 http://ports.ubuntu.com/ubuntu-ports focal-security InRelease                                           
Hit:1 https://packages.microsoft.com/repos/code stable InRelease                                              
Hit:7 https://repo.download.nvidia.com/jetson/t234 r35.5 InRelease
Hit:8 https://repo.download.nvidia.com/jetson/ffmpeg r35.5 InRelease
Reading package lists... Done
Building dependency tree       
Reading state information... Done
76 packages can be upgraded. Run 'apt list --upgradable' to see them.
➜  webrtc git:(main) sudo apt install libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev libgstreamer-plugins-bad1.0-dev.
Reading package lists... Done
Building dependency tree       
Reading state information... Done
E: Unable to locate package libgstreamer-plugins-bad1.0-dev.
E: Couldn't find any package by glob 'libgstreamer-plugins-bad1.0-dev.'

Yes that plugin requires 1.22, and you’re generally not going to have a lot of fun with webrtcbin before 1.22. Better to update to at least 1.22, even better 1.24.

Unfortunately NVIDIA (looks like you’re doing this on some NVIDIA Jetson?) doesn’t provide up to date GStreamer packages, so you’ll have to build it yourself.

Yes I’m using Nvidia Jetson. I will have to use a Docker with GStreamer 1.24 I believe.

I’m wondering how can I have access to the C/C++ API to build an application with the webrtc ? Or if it is not possible is there another way to do this ?