We're hiring!

Getting started with GStreamer's gst-build

Stéphane Cerveau avatar

Stéphane Cerveau
March 19, 2020

Share this post:

GStreamer relies on multiple repositories such as base and good to build its ecosystem, and now owns more than 30 projects in Gitlab. So, a unified tool/build system has always been necessary to build a specified version.

For over a decade, a script named gst-uninstalled was present in the gstreamer/scripts directory to build the whole solution. Although this tool was not very flexible and was missing some options in the command line, it was good enough if you wanted to tackle a surprising bug in our favorite framework. But it was not as good at providing a real swiss-army knife approach to build GStreamer and its dependencies.

Another build system called cerbero, created a few years ago, provides a standalone solution to build GStreamer packages. This solution offers a wide range of options in addition to a proper sandbox to avoid system dependencies and to be able to prepare packages that include third party software dependencies for a given version. Cerbero is written in Python and can create builds for the host machine like gst-uninstalled but also for various common targets depending on the host. Indeed a Linux regular desktop host will be capable to cross-build GStreamer for x86(32/64bits) but also for architecture such ARM and system such as Microsoft Windows. It can also create builds for Android and iOS.

Despite a shell environment allowing artifacts testing, Cerbero is not really convenient for a day to day development related to GStreamer as a new plugin development or a bug fix as it is not easy to update to the last revision without loosing a current work, or to test another branch of GStreamer

The rise of gst-build:

In order to improve this situation, gst-build was born. Taking advantage of the flexibility of the rising Meson build system, gst-build has been implemented to replace gst-uninstalled and provide a quick and smooth environment to hack into GStreamer and its dependencies.

Autotools is dead, long live Meson

Since GStreamer 1.18, Meson has been chosen as the only build system for the official GStreamer repositories. For its simplicity, speed and flexibility, Meson replaced Autotools, so it is also perfect to use with gst-build. Indeed gst-build is just a Meson project including GStreamer sub-projects with options to enable/disable selected sub-projects.

Using gst-build for the first time

gst-build is mainly a meson.build project. It reads .wrap files which are located in the subprojects folder to determine the elements of the project such as gstreamer or gst-plugins-base. These subprojects use the meson build system as well. gst-build comes with the essential projects you need to start using GStreamer and build it almost without system dependencies. gst-build bundles libffi or glib in the subprojects directory. It can also gather dependencies using pkg-config from the system to build the GStreamer plugins such as flac, for example, which needs libflac to build.

So let's take a look on how to work with gst-build!


As we have to choose a specific development environment, a 64 bit machine has been selected:

  • Ubuntu 18.04
  • Bash Shell


  • build-essential (gcc)
  • python3
  • git
  • meson
  • ninja

Install meson and ninja

Here are the essential dependencies you need to install before running meson and ninja.

$ sudo apt install build-essential python3 git ninja-build python3-pip

You can now install meson from the pip repository

$ pip3 install --user meson

This will install meson into ~/.local/bin which may or may not be included automatically in your PATH by default.

Fetch and Configure

This step will download the GStreamer repositories including some dependencies such as glib etc. into the subprojects folder. Basically it tries to download as many mesonified third party libraries as possible, and breaking news the cmake ones, as a bridge has been implemented recently if necessary.

$ git clone https://gitlab.freedesktop.org/gstreamer/gst-build
$ cd gst-build
$ meson build --buildtype=debug



All GStreamer modules

                        FFmpeg: YES
                         dssim: YES
                    gl-headers: YES
                      graphene: YES
                  gst-devtools: YES
          gst-editing-services: YES
                  gst-examples: YES
    gst-integration-testsuites: YES
                     gst-libav: YES
                       gst-omx: YES
               gst-plugins-bad: YES
              gst-plugins-base: YES
              gst-plugins-good: YES
                gst-plugins-rs: NO
              gst-plugins-ugly: YES
                    gst-python: NO
               gst-rtsp-server: YES
                     gstreamer: YES
               gstreamer-sharp: Feature 'sharp' disabled
               gstreamer-vaapi: YES
                         gtest: NO
                   libmicrodns: YES
                       libnice: YES
                        libpsl: YES
                       libsoup: NO
                      openh264: YES
                           orc: YES
                     pygobject: NO
                        sqlite: YES
                      tinyalsa: NO
                          x264: YES
Option buildtype is: debug [default: debugoptimized]
Found ninja-1.8.2 at /usr/bin/ninja

After this step, a newly created folder named build should be ready to be used by ninja to build the binaries.

As you may notice, --buildtype=debug has been added to the command line to get a fully debugable result without optimization. I invite you to visit this page if you want to fine-tune the build.

Build gst-build

This step will build all GStreamer libraries in addition to the plugins from base/good/bad/ugly/libav if their dependencies have been met or built by gst-build (ie glib, openh264 etc.).

$ ninja -C build

Test gst-build

This command will create an environment where all tools and plugins built previously are available in the environment as a superset of the system environment with the right environment variables set.

$ ninja -C build devenv

A prefix to your prompt should be shown as

[gst-master] bash-prompt $


[gst-master] bash-prompt $ env | grep GST_

From this environment you are now ready to use the power of GStreamer, and even implement new features in it without the fear of using out of date version.

From this shell, you are also able to compile without exiting the environment except when a configure step is necessary. This feature is very convenient to test a branch or fix a bug. Go to the subprojects folder and modify the code directly and then call ninja -C ../../build.

[gst-master] bash-prompt $ gst-inspect-1.0

Let's add a log line in gst-plugins-base

In this tutorial, I will explain how to add a log line in videotestsrc element, gst-plugins-base's plugin, rebuild using gst-build and test that the new log is now displayed.

  1. Edit the file
    vim subprojects/gst-plugins-base/gst/videotestsrc/gstvideotestsrc.c

    Go to the method gst_video_test_src_start and add the line:

    GST_ERROR_OBJECT (src, ""Starting to debug videotestsrc, is there an error ?");

    This will add a runtime log with the ERROR level. For more information about debugging facilities in GStreamer, visit the following page.

    Then close the editor.

  2. Build with gst-build
    $ ninja -C build

    You should see that only the file gstvideotestsrc.c rebuilt.

  3. Test the changes

    In order to enable the logs, you have to export the environment variable GST_DEBUG.

    Let's start the playback and display the result in the terminal. The following command will display all the log from videotestsrc with the category ERROR(1).

    GST_DEBUG=videotestsrc:1 gst-launch-1.0 videotestsrc num-buffers=1 ! fakevideosink

    You should have this output:

    Setting pipeline to PAUSED ...
    0:00:00.225273663 21743 0x565528ab7100 ERROR           videotestsrc gstvideotestsrc.c:1216:gst_video_test_src_start: Starting to debug videotestsrc, is there an error ?
    Pipeline is PREROLLING ...
    Pipeline is PREROLLED ...
    Setting pipeline to PLAYING ...
    New clock: GstSystemClock
    Got EOS from element "pipeline0".
    Execution ended after 0:00:00.033464391
    Setting pipeline to PAUSED ...
    Setting pipeline to READY ...
    Setting pipeline to NULL ...
    Freeing pipeline ..
  4. Update gst-build

    This command will update all the repositories and will reissue a build.

    $ ninja -C build_dir update

Adding a new repository

Better to be outside of devenv env. If you want to add a new repository and work in this environment. Very simple and handy way, you'll have to:

$ cd subprojects
$ git clone my_subproject
$ cd ../build
$ rm -rf * && meson .. -Dcustom_subprojects=my_subproject

And then you can go in your subproject, edit, change, remove even stare at his beauty.

$ ninja -C ../../build
$ ninja -C ../../build devenv

Wrapping up

Voilà, you're done! Stay tuned for my next blog post, where we'll look at how to use gst-build to cross-compile GStreamer to run it on embedded platforms.

As usual, if you would like to learn more about meson, gst-build or any other parts of GStreamer, please contact us!

Comments (30)

  1. Leslaw:
    Apr 07, 2020 at 06:10 PM

    Could you provide step by step blog entry for compiling GStreamer using Visual Studio and Gst-build. I did follow all available tutorials online and could not get a workable GStreamer build which would work for Visual Studio 2019. I managed to get a wine 64 bit build using WSL and Ubuntu 18.04 - however static libraries produced (*.dll.a) were not suitable for writing Visual Studio C++ apps, as I got persistent linking errors (different C++ naming decoration).
    I know that there are available builds of GStreamer 1.16.2 for Windows Visual Studio, but there is no code base or CI log files on the internet which could provide information what needs to be installed on a Windows 10 Visual Studio 2020 machine.
    If you were to provide such article could you make it as verbose as possible with exact log files from builds and possibly ZIP files from the build?

    Kind Regards

    Reply to this comment

    Reply to this comment

      1. Leslaw:
        Apr 08, 2020 at 08:58 AM

        I know about this entry. But after following it I stumbled upon many errors, which I could not overcome. First one was that glib subproject did not compile because of lack of libffi present. It would be really helpful if you provided even over the top algorithm how to compile with all the output data, such as which version of gst-build you used, which version of Meson build system was used plus all the output from compilation process. This would allow comparison and see what I do differently to you guys, which would allow me to successfully accomplish the build on Windows using Visual Studio 2019 Enterprise edition.

        Reply to this comment

        Reply to this comment

        1. Olivier Crête:
          Apr 08, 2020 at 01:48 PM

          This is tested on every merge request to GStreamer as part of our CI. So this should be work fine in the git master as well as 1.16 branch. libffi should be pulled in as a dependency. And it should work with any recent version of meson.

          If you need assistance, I advise you to ask on the gstreamer-devel mailing list https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel

          Reply to this comment

          Reply to this comment

  2. Razvan G:
    Jun 26, 2020 at 02:08 PM


    does this also install the python bindings as it should? Can it conflict with the system-wide installed one?

    We followed the tutorial (thanks for that), it worked well, but by copying the libgstnvarguscamerasrc.so and libgstnvvideo4linux2.so we got bad linking to older gstreamer version.

    Any hints?

    Reply to this comment

    Reply to this comment

    1. Olivier Crete:
      Jul 17, 2020 at 06:17 PM

      In theory, you should be able to get the python bindings by configuring the meson build with "-Dpython=enabled".

      The plugins from NVidia are proprietary.. and I have no idea what they do exactly. But maybe if you post the missing symbols to the mailing list we can be able to give you a hint..

      Reply to this comment

      Reply to this comment

  3. Ben:
    Jul 17, 2020 at 04:52 PM

    I think it should be apt-get ninja-build on Ubuntu systems, not ninja.

    Reply to this comment

    Reply to this comment

    1. Mark Filion:
      Jul 17, 2020 at 06:15 PM

      Good catch, this has now been fixed. Thank you!

      Reply to this comment

      Reply to this comment

  4. Muckey:
    Dec 18, 2020 at 01:49 PM

    I have downloaded https://gstreamer.freedesktop.org/src/gstreamer/gstreamer-1.17.90.tar.xz but it only has som ~270 modules vs ~5,000 of the complete package downloaded by git clone https://gitlab.freedesktop.org/gstreamer/gst-build.

    I need to use nvidia's nvenc and nvdec which are included since version 1.17.1. How do I download version prior to 1.19.1 (which does not compile) to get it all ?

    Reply to this comment

    Reply to this comment

  5. Stéphane Cerveau:
    Dec 21, 2020 at 02:30 PM

    Following our discussion on https://gitlab.freedesktop.org/gstreamer/gst-build/-/issues/142, I suggests you to clone gst-build from the discussion's website and request a build with:

    # meson -C build -Dlibav=disabled && ninja -C build

    To avoid using ffmpeg from your system, we use the meson flag -Dlibav=disabled seen that you just want want to test GStreamer nvcodec element.

    The nvcodec should be built from gst-plugins-bad and can be tested with:

    # ninja -C build devenv
    # gst-inspect-1.0 nvcodec


    Reply to this comment

    Reply to this comment

  6. Mark:
    May 15, 2021 at 10:37 PM

    The final logging from Meson I get is this:

    All GStreamer modules

    FFmpeg : YES 3 warnings
    avtp : YES
    dssim : YES
    dv : YES
    gl-headers : YES
    gst-devtools : YES 1 warnings
    gst-editing-services : YES
    gst-examples : YES
    gst-integration-testsuites: YES
    gst-libav : YES
    gst-omx : NO Feature 'omx' disabled
    gst-plugins-bad : YES
    gst-plugins-base : YES
    gst-plugins-good : YES
    gst-plugins-rs : NO Feature 'rs' disabled
    gst-plugins-ugly : YES
    gst-python : YES
    gst-rtsp-server : YES
    gstreamer : YES
    gstreamer-sharp : NO Feature 'sharp' disabled
    gstreamer-vaapi : NO Feature 'vaapi' disabled
    json-glib : YES 1 warnings
    libmicrodns : YES
    libnice : YES
    libpsl : YES
    libsoup : YES 4 warnings
    libxml2 : YES
    opus : YES
    orc : YES
    pango : NO
    Dependency 'glib-2.0' was already checked and was not found
    pycairo : YES 2 warnings
    pygobject : YES 2 warnings
    sqlite : YES
    x264 : YES

    But when I run Ninja I don't seem to get much output:

    log: warning: no configuration file specified, using default values
    log: ninja version 0.1.3 initializing
    log: magic group: gid=0 (root)
    log: entering main loop
    log: generating initial pid array..
    log: now monitoring process activity

    This is the only gst-launch I see:


    Reply to this comment

    Reply to this comment

    1. Olivier Crête:
      May 16, 2021 at 01:43 AM

      That's the wrong ninja, the binary may be called ninja-build on older distributions.

      Reply to this comment

      Reply to this comment

      1. Mark:
        May 16, 2021 at 02:48 PM

        Actually all good now - thanks for the ninja tip :)

        Reply to this comment

        Reply to this comment

  7. Mark:
    May 16, 2021 at 05:14 AM

    Ok - looks like I had the wrong package installed, but now I get this:

    ninja: error: loading 'build.ninja': No such file or directory

    Reply to this comment

    Reply to this comment

    1. Olivier Crête:
      May 16, 2021 at 04:29 PM

      You need to run "ninja -C " which is the same directory you passed to meson (if you used "meson build", then "ninja -C build).

      Reply to this comment

      Reply to this comment

  8. Bistro:
    May 25, 2021 at 07:59 AM

    Thanks to your kind and detailed explanation, but I've got some errors in ninja.
    In raspberry pi, I've already installed gst 1.16 with autogen.sh(1.14 is the latest in raspberry repository). But an error occurred, so I needed to install latest version.
    After meson, I got such result :
    All GStreamer modules

    FFmpeg: YES 4 warnings
    avtp: YES
    dssim: YES
    gl-headers: YES
    gst-devtools: YES 1 warnings
    gst-editing-services: YES
    gst-examples: YES
    gst-integration-testsuites: YES
    gst-libav: YES
    gst-omx: NO Feature 'omx' disabled
    gst-plugins-bad: YES
    gst-plugins-base: YES 2 warnings
    gst-plugins-good: YES
    gst-plugins-rs: NO Feature 'rs' disabled
    gst-plugins-ugly: YES
    gst-python: YES
    gst-rtsp-server: YES
    gstreamer: YES 2 warnings
    gstreamer-sharp: NO Feature 'sharp' disabled
    gstreamer-vaapi: NO Feature 'vaapi' disabled
    json-glib: YES
    libdrm: YES
    libmicrodns: YES
    libnice: YES
    libopenjp2: YES 2 warnings
    openh264: NO Program 'nasm nasm.exe' not found
    orc: YES
    pycairo: YES 2 warnings
    pygobject: YES 2 warnings
    tinyalsa: NO
    Neither a subproject directory nor a tinyalsa.wrap file was found.
    Then I ran ninja, but I got this:
    FAILED: subprojects/gst-plugins-bad/ext/opencv/libgstopencv.so
    c++ -o subprojects/gst-plugins-bad/ext/opencv/libgstopencv.so subprojects/gst-plugins-bad/ext/opencv/libgstopencv.so.p/gstcvdilate.cpp.o subprojects/gst-plugins-bad/ext/opencv/libgstopencv.so.p/gstcvdilateerode.cpp.o subprojects/gst-plugins-bad/ext/opencv/libgstopencv.so.p/gstcvequalizehist.cpp.o subprojects/gst-plugins-bad/ext/opencv/libgstopencv.so.p/gstcverode.cpp.o subprojects/gst-plugins-bad/ext/opencv/libgstopencv.so.p/gstcvlaplace.cpp.o subprojects/gst-plugins-bad/ext/opencv/libgstopencv.so.p/gstcvsmooth.cpp.o subprojects/gst-plugins-bad/ext/opencv/libgstopencv.so.p/gstcvsobel.cpp.o subprojects/gst-plugins-bad/ext/opencv/libgstopencv.so.p/gstdisparity.cpp.o subprojects/gst-plugins-bad/ext/opencv/libgstopencv.so.p/gstedgedetect.cpp.o subprojects/gst-plugins-bad/ext/opencv/libgstopencv.so.p/gstfaceblur.cpp.o subprojects/gst-plugins-bad/ext/opencv/libgstopencv.so.p/gstfacedetect.cpp.o subprojects/gst-plugins-bad/ext/opencv/libgstopencv.so.p/gstgrabcut.cpp.o subprojects/gst-plugins-bad/ext/opencv/libgstopencv.so.p/gsthanddetect.cpp.o subprojects/gst-plugins-bad/ext/opencv/libgstopencv.so.p/gstmotioncells.cpp.o subprojects/gst-plugins-bad/ext/opencv/libgstopencv.so.p/gstopencv.cpp.o subprojects/gst-plugins-bad/ext/opencv/libgstopencv.so.p/gstretinex.cpp.o subprojects/gst-plugins-bad/ext/opencv/libgstopencv.so.p/gstsegmentation.cpp.o subprojects/gst-plugins-bad/ext/opencv/libgstopencv.so.p/gstskindetect.cpp.o subprojects/gst-plugins-bad/ext/opencv/libgstopencv.so.p/gsttemplatematch.cpp.o subprojects/gst-plugins-bad/ext/opencv/libgstopencv.so.p/gsttextoverlay.cpp.o subprojects/gst-plugins-bad/ext/opencv/libgstopencv.so.p/MotionCells.cpp.o subprojects/gst-plugins-bad/ext/opencv/libgstopencv.so.p/motioncells_wrapper.cpp.o subprojects/gst-plugins-bad/ext/opencv/libgstopencv.so.p/gstdewarp.cpp.o subprojects/gst-plugins-bad/ext/opencv/libgstopencv.so.p/camerautils.cpp.o subprojects/gst-plugins-bad/ext/opencv/libgstopencv.so.p/cameraevent.cpp.o subprojects/gst-plugins-bad/ext/opencv/libgstopencv.so.p/gstcameracalibrate.cpp.o subprojects/gst-plugins-bad/ext/opencv/libgstopencv.so.p/gstcameraundistort.cpp.o -Wl,--as-needed -Wl,--no-undefined -shared -fPIC -Wl,--start-group -Wl,-soname,libgstopencv.so subprojects/gstreamer/libs/gst/base/libgstbase-1.0.so.0.1900.0 subprojects/gstreamer/gst/libgstreamer-1.0.so.0.1900.0 subprojects/gst-plugins-base/gst-libs/gst/video/libgstvideo-1.0.so.0.1900.0 subprojects/orc/orc/liborc-0.4.so.0.32.0 subprojects/gst-plugins-bad/gst-libs/gst/opencv/libgstopencv-1.0.so.0.1900.0 /usr/lib/arm-linux-gnueabihf/libglib-2.0.so /usr/lib/arm-linux-gnueabihf/libgobject-2.0.so -Wl,--export-dynamic /usr/lib/arm-linux-gnueabihf/libgmodule-2.0.so -pthread -lm /usr/local/lib/libopencv_stitching.so /usr/local/lib/libopencv_superres.so /usr/local/lib/libopencv_videostab.so /usr/local/lib/libopencv_aruco.so /usr/local/lib/libopencv_bgsegm.so /usr/local/lib/libopencv_bioinspired.so /usr/local/lib/libopencv_ccalib.so /usr/local/lib/libopencv_dnn_objdetect.so /usr/local/lib/libopencv_dpm.so /usr/local/lib/libopencv_face.so /usr/local/lib/libopencv_photo.so /usr/local/lib/libopencv_freetype.so /usr/local/lib/libopencv_fuzzy.so /usr/local/lib/libopencv_hfs.so /usr/local/lib/libopencv_img_hash.so /usr/local/lib/libopencv_line_descriptor.so /usr/local/lib/libopencv_optflow.so /usr/local/lib/libopencv_reg.so /usr/local/lib/libopencv_rgbd.so /usr/local/lib/libopencv_saliency.so /usr/local/lib/libopencv_stereo.so /usr/local/lib/libopencv_structured_light.so /usr/local/lib/libopencv_phase_unwrapping.so /usr/local/lib/libopencv_surface_matching.so /usr/local/lib/libopencv_tracking.so /usr/local/lib/libopencv_datasets.so /usr/local/lib/libopencv_text.so /usr/local/lib/libopencv_dnn.so /usr/local/lib/libopencv_plot.so /usr/local/lib/libopencv_xfeatures2d.so /usr/local/lib/libopencv_shape.so /usr/local/lib/libopencv_video.so /usr/local/lib/libopencv_ml.so /usr/local/lib/libopencv_ximgproc.so /usr/local/lib/libopencv_xobjdetect.so /usr/local/lib/libopencv_objdetect.so /usr/local/lib/libopencv_calib3d.so /usr/local/lib/libopencv_features2d.so /usr/local/lib/libopencv_highgui.so /usr/local/lib/libopencv_videoio.so /usr/local/lib/libopencv_imgcodecs.so /usr/local/lib/libopencv_flann.so /usr/local/lib/libopencv_xphoto.so /usr/local/lib/libopencv_imgproc.so /usr/local/lib/libopencv_core.so -Wl,--end-group '-Wl,-rpath,$ORIGIN/../../../gstreamer/libs/gst/base:$ORIGIN/../../../gstreamer/gst:$ORIGIN/../../../gst-plugins-base/gst-libs/gst/video:$ORIGIN/../../../orc/orc:$ORIGIN/../../gst-libs/gst/opencv' -Wl,-rpath-link,/home/pi/gstreamer-src/gst-build/build/subprojects/gstreamer/libs/gst/base -Wl,-rpath-link,/home/pi/gstreamer-src/gst-build/build/subprojects/gstreamer/gst -Wl,-rpath-link,/home/pi/gstreamer-src/gst-build/build/subprojects/gst-plugins-base/gst-libs/gst/video -Wl,-rpath-link,/home/pi/gstreamer-src/gst-build/build/subprojects/orc/orc -Wl,-rpath-link,/home/pi/gstreamer-src/gst-build/build/subprojects/gst-plugins-bad/gst-libs/gst/opencv
    /usr/bin/ld: subprojects/gst-plugins-bad/ext/opencv/libgstopencv.so.p/gstfaceblur.cpp.o: in function `gst_face_blur_load_profile(_GstFaceBlur*, char*)':
    /home/pi/gstreamer-src/gst-build/build/../subprojects/gst-plugins-bad/ext/opencv/gstfaceblur.cpp:385: undefined reference to `cv::CascadeClassifier::CascadeClassifier(cv::String const&)'
    /usr/bin/ld: subprojects/gst-plugins-bad/ext/opencv/libgstopencv.so.p/gstfaceblur.cpp.o: in function `cv::String::String(char const*)':
    /usr/local/include/opencv2/core/cvstd.hpp:602: undefined reference to `cv::String::allocate(unsigned int)'
    /usr/bin/ld: subprojects/gst-plugins-bad/ext/opencv/libgstopencv.so.p/gstfaceblur.cpp.o: in function `cv::String::~String()':
    /usr/local/include/opencv2/core/cvstd.hpp:648: undefined reference to `cv::String::deallocate()'
    /usr/bin/ld: subprojects/gst-plugins-bad/ext/opencv/libgstopencv.so.p/gstfacedetect.cpp.o: in function `gst_face_detect_load_profile(_GstFaceDetect*, char*)':
    /home/pi/gstreamer-src/gst-build/build/../subprojects/gst-plugins-bad/ext/opencv/gstfacedetect.cpp:788: undefined reference to `cv::CascadeClassifier::CascadeClassifier(cv::String const&)'
    /usr/bin/ld: subprojects/gst-plugins-bad/ext/opencv/libgstopencv.so.p/gsthanddetect.cpp.o: in function `gst_handdetect_load_profile(_GstHanddetect*, char*)':
    /home/pi/gstreamer-src/gst-build/build/../subprojects/gst-plugins-bad/ext/opencv/gsthanddetect.cpp:622: undefined reference to `cv::CascadeClassifier::CascadeClassifier(cv::String const&)'
    /usr/bin/ld: subprojects/gst-plugins-bad/ext/opencv/libgstopencv.so.p/gstsegmentation.cpp.o: in function `find_connected_components(cv::Mat, int, float)':
    /home/pi/gstreamer-src/gst-build/build/../subprojects/gst-plugins-bad/ext/opencv/gstsegmentation.cpp:709: undefined reference to `cv::findContours(cv::_InputOutputArray const&, cv::_OutputArray const&, cv::_OutputArray const&, int, int, cv::Point_)'
    /usr/bin/ld: subprojects/gst-plugins-bad/ext/opencv/libgstopencv.so.p/gstsegmentation.cpp.o: in function `cv::Mat::Mat(int, int, int, void*, unsigned int)':
    /usr/local/include/opencv2/core/mat.inl.hpp:579: undefined reference to `cv::error(int, cv::String const&, char const*, char const*, int)'
    /usr/bin/ld: /usr/local/include/opencv2/core/mat.inl.hpp:592: undefined reference to `cv::error(int, cv::String const&, char const*, char const*, int)'
    /usr/bin/ld: subprojects/gst-plugins-bad/ext/opencv/libgstopencv.so.p/gsttemplatematch.cpp.o: in function `gst_template_match_load_template(_GstTemplateMatch*, char*)':
    /home/pi/gstreamer-src/gst-build/build/../subprojects/gst-plugins-bad/ext/opencv/gsttemplatematch.cpp:183: undefined reference to `cv::imread(cv::String const&, int)'
    /usr/bin/ld: subprojects/gst-plugins-bad/ext/opencv/libgstopencv.so.p/gsttextoverlay.cpp.o: in function `gst_opencv_text_overlay_transform_ip(_GstOpencvVideoFilter*, _GstBuffer*, cv::Mat)':
    /home/pi/gstreamer-src/gst-build/build/../subprojects/gst-plugins-bad/ext/opencv/gsttextoverlay.cpp:337: undefined reference to `cv::putText(cv::_InputOutputArray const&, cv::String const&, cv::Point_, int, double, cv::Scalar_, int, int, bool)'
    /usr/bin/ld: subprojects/gst-plugins-bad/ext/opencv/libgstopencv.so.p/camerautils.cpp.o: in function `cv::operator

    Reply to this comment

    Reply to this comment

    1. Bistro:
      May 26, 2021 at 11:43 AM

      Should I uninstall gstreamer1.16 first? Could you help me if you know why this error occurs?

      Reply to this comment

      Reply to this comment

    2. Stéphane Cerveau:
      May 26, 2021 at 02:27 PM


      According to my understanding, the opencv plugin fails to build correctly. If you dont need this plugin, you can either remove the dev package (apt remove libopencv-dev) to avoid gst-build to pickup the dependency or directly disable the opencv plugin by:

      $ meson build --reconfigure -Dgst-plugins-bad:opencv=disabled
      $ ninja -C build

      Otherwise you'll have to understand why the plugin fails to build with your RPI version of opencv.


      Reply to this comment

      Reply to this comment

      1. Bistro:
        May 26, 2021 at 03:58 PM

        Hello, thanks to kind reply. But I have to build python file with opencv and this file uses gstreamer pipeline in cv2.VideoCapture(). So in my opinion, I have to build with opencv plugins. Result of $ opencv_version : 4.5.2-dev, and I think opencv's version can be a cause... I really don't know why that "libgstopencv.so" makes trouble. TT


        Reply to this comment

        Reply to this comment

        1. Stéphane Cerveau:
          May 26, 2021 at 06:26 PM


          I gave it a try on ubuntu 20.04 with opencv4 4.2 and so far the plugin has been built successfully.

          Could you pastebin your build/meson-logs/meson-log.txt somewhere as we could check what's goin on ?

          Additionally you can pastebin your ninja error too.


          Reply to this comment

          Reply to this comment

          1. Bistro:
            May 26, 2021 at 07:20 PM

            Here's meson-log.txt's opencv part : https://pastebin.com/iQusrKpB
            I don't know what's the problem... Really thanks for your help.


            Reply to this comment

            Reply to this comment

            1. Stéphane Cerveau:
              May 27, 2021 at 10:07 AM

              According to the meson logs, the configure picks up opencv 3.4.4 but you mention a 4.5.2-dev version.

              From the failing build log I saw that opencv libs was taken from "/usr/local/" so I assume you are not using the version from your distrib. Maybe you are mixing versions causing gst-build to fail.

              Reply to this comment

              Reply to this comment

              1. Bistro:
                May 28, 2021 at 03:27 AM

                I heartily thank you. I've rebuilded opencv with 4.5.2-dev, and it worked!!! So I did : rebuilding opencv -> building gstreamer -> rebuilding opencv. Now it works very well! Thank you veeeery much!!

                Reply to this comment

                Reply to this comment

  9. Rajesh Chanda:
    Oct 05, 2021 at 11:02 AM


    We are looking to build gstreamer from source for android,

    We are trying to make few changes in gstahcsrc.c(gstahcsrc elemt), which is part of gst-bad plugin.

    We have followed below link

    When we are building, its taking default bad plugin from git instead of our change done locally.

    Could you help us in making our change in bad plugin and incorporate same android universal or how to integrate/compile custom bad plugin to android .

    Thanks and Regards
    Rajesh Chanda

    Reply to this comment

    Reply to this comment

    1. Stephane:
      Oct 05, 2021 at 05:11 PM

      Dear Rajesh,

      Indeed cerbero is not really convenient when you are making some changes into the source build directory. That's why you reach the right place, trying to build GStreamer with gst-build. You just need to follow this blog post to build the GStreamer framework with its base/good/bad plugins set.

      When you succeeded to configure with meson and build with Ninja the whole solution (see "Fetch and Configure section"). You can go into a devenv and then modify the code you'd like to improve and rebuild it as described in "Let's add a log line in gst-plugins-base".

      As you can see a clone of gst-plugins-bad is available in gst-build/subprojects/gst-plugins-bad/ where you can create your MR.

      Moreover since last week, a new approach can be experimented as now GStreamer "main" branch owns all the GStreamer framework (meson build system, plugins and applications) (see https://gstreamer.freedesktop.org/documentation/frequently-asked-questions/mono-repository.html?gi-language=c). This is very similar to gst-build but in one and single repository where you can create the merge request with your change.

      Reply to this comment

      Reply to this comment

      1. Rajesh Chanda:
        Oct 06, 2021 at 10:49 AM

        Hi Stephane,

        Thank you for reply.

        Seems above procedure works if its for linux target.

        Does it work for android also?, Because android needs Android Universal which is single packed gstreamer.

        As we need Android Universal to work with android target, we are suppose to compile android universal with our bad plugin changes.

        Could you suggest in this direction for android.

        Thanks and Regards
        Rajesh Chanda

        Reply to this comment

        Reply to this comment

  10. Stephane:
    Oct 06, 2021 at 06:33 PM

    Dear Rajesh,

    I'm sorry, I missed the Android part in your comment and indeed the cross android build is only supported by cerbero by now.

    FYI a work has been initiated on gst-build side but not ready to merge.


    Regarding cerbero, one option would be to complete an android build and then clone an instance of gst-plugins-bad in another folder.
    Then you can enter the cerbero shell with:

    $ ./cerbero-uninstalled -c config/cross-android-universal.cbc shell

    and go to your new gst-plugins-bad clone instance.

    $ cd /home/dev/DEV/gst-plugins-bad

    From here you can get the configure line for your target in "cerbero/build/logs/android_arm64/gst-plugins-bad-configure.log" in running command "/path_to/meson ....". if your target android device uses an arm64.

    You can run this command in your /home/dev/DEV/gst-plugins-bad in the cerbero shell. Then ninja -C build && ninja -C build install

    Then you can exit the shell and run;

    /cerbero-uninstalled -c config/cross-android-universal.cbc package gstreamer-1.0

    This is far from optimal but a typical way to develop with cerbero.

    Please let me know if you have any other questions.

    Reply to this comment

    Reply to this comment

    1. Rajesh Chanda:
      Oct 12, 2021 at 10:09 AM

      Hi Stephane,

      Thank you again for helping.

      I have followed below steps but getting build error during meson running command.

      rajesh@rajesh:~/myubuntuwork/gstreamer-related/cerbero$ ./cerbero-uninstalled -c config/cross-android-universal.cbc shell

      Step.2: cloned gst-plugins-bad plugin into other folder.

      Step.3: Entered into gst-plugins-bad folder
      [cerbero-android-universal] rajesh@rajesh:~/myubuntuwork/gstreamer-related/cerbero$ cd mygstbadplugin/gst-plugins-bad/

      Step.4: Checked the gst-plugins-bad-1.0-configure.log for running command.
      [cerbero-android-universal] rajesh@rajesh:~/myubuntuwork/gstreamer-related/cerbero/mygstbadplugin/gst-plugins-bad$ vi ../../build/logs/android_arm64/gst-plugins-bad-1.0-configure.log

      Step.5:Below is the command found in above configure.log file
      Running command '/home/rajesh/myubuntuwork/gstreamer-related/cerbero/build/build-tools/bin/meson --prefix=/home/rajesh/myubuntuwork/gstreamer-related/cerbero/build/dist/android_universal/arm64 --libdir=lib -Ddebug=true --default-library=both -Doptimization=s --backend=ninja --wrap-mode=nodownload --cross-file /home/rajesh/myubuntuwork/gstreamer-related/cerbero/build/sources/android_universal/arm64/gstreamer-1.0/subprojects/gst-plugins-bad/_builddir/meson-cross-file.txt --native-file /home/rajesh/myubuntuwork/gstreamer-related/cerbero/build/sources/android_universal/arm64/gstreamer-1.0/subprojects/gst-plugins-bad/_builddir/meson-native-file.txt -Dassrender=enabled -Dbz2=enabled -Dclosedcaption=enabled -Ddash=enabled -Ddecklink=enabled -Ddtls=enabled -Ddts=enabled -Dhls=enabled -Dhls-crypto=openssl -Dkate=enabled -Dladspa=auto -Dlibmms=enabled -Dnvcodec=disabled -Dopenh264=enabled -Dopenjpeg=enabled -Dopus=enabled -Drtmp=enabled -Drtmp2=enabled -Dsbc=enabled -Dsctp=enabled -Dsctp-internal-usrsctp=enabled -Dsoundtouch=enabled -Dsrt=enabled -Dspandsp=enabled -Dsrtp=enabled -Dresindvd=disabled -Drist=enabled -Drsvg=enabled -Dvoaacenc=enabled -Dvulkan=enabled -Dwebrtc=enabled -Dwebrtcdsp=enabled -Dzbar=enabled -Dcurl=disabled -Dcurl-ssh2=disabled -Ddc1394=disabled -Ddirectfb=disabled -Dfaac=disabled -Dfaad=disabled -Dfbdev=disabled -Dfestival=disabled -Dflite=disabled -Dgme=disabled -Dgsm=disabled -Dlibde265=disabled -Dlv2=disabled -Dmodplug=disabled -Dmpeg2enc=disabled -Dmplex=disabled -Dmusepack=disabled -Dneon=disabled -Dofa=disabled -Dopenal=disabled -Dopencv=disabled -Dsndfile=disabled -Dteletext=disabled -Dvoamrwbenc=disabled -Dwildmidi=disabled -Dmsdk=disabled -Dva=disabled -Dmediafoundation=disabled -Dintrospection=disabled -Dexamples=disabled'

      Step.6: created mybadbuild folder in gst-plugins-bad and executed below command
      [cerbero-android-universal] rajesh@rajesh:~/myubuntuwork/gstreamer-related/cerbero/mygstbadplugin/gst-plugins-bad$ /home/rajesh/myubuntuwork/gstreamer-related/cerbero/build/build-tools/bin/meson --prefix=/home/rajesh/myubuntuwork/gstreamer-related/cerbero/build/dist/android_universal/arm64 --libdir=lib -Ddebug=true --default-library=both -Doptimization=s --backend=ninja --wrap-mode=nodownload --cross-file /home/rajesh/myubuntuwork/gstreamer-related/cerbero/build/sources/android_universal/arm64/gstreamer-1.0/subprojects/gst-plugins-bad/_builddir/meson-cross-file.txt --native-file /home/rajesh/myubuntuwork/gstreamer-related/cerbero/build/sources/android_universal/arm64/gstreamer-1.0/subprojects/gst-plugins-bad/_builddir/meson-native-file.txt -Dassrender=enabled -Dbz2=enabled -Dclosedcaption=enabled -Ddash=enabled -Ddecklink=enabled -Ddtls=enabled -Ddts=enabled -Dhls=enabled -Dhls-crypto=openssl -Dkate=enabled -Dladspa=auto -Dlibmms=enabled -Dnvcodec=disabled -Dopenh264=enabled -Dopenjpeg=enabled -Dopus=enabled -Drtmp=enabled -Drtmp2=enabled -Dsbc=enabled -Dsctp=enabled -Dsctp-internal-usrsctp=enabled -Dsoundtouch=enabled -Dsrt=enabled -Dspandsp=enabled -Dsrtp=enabled -Dresindvd=disabled -Drist=enabled -Drsvg=enabled -Dvoaacenc=enabled -Dvulkan=enabled -Dwebrtc=enabled -Dwebrtcdsp=enabled -Dzbar=enabled -Dcurl=disabled -Dcurl-ssh2=disabled -Ddc1394=disabled -Ddirectfb=disabled -Dfaac=disabled -Dfaad=disabled -Dfbdev=disabled -Dfestival=disabled -Dflite=disabled -Dgme=disabled -Dgsm=disabled -Dlibde265=disabled -Dlv2=disabled -Dmodplug=disabled -Dmpeg2enc=disabled -Dmplex=disabled -Dmusepack=disabled -Dneon=disabled -Dofa=disabled -Dopenal=disabled -Dopencv=disabled -Dsndfile=disabled -Dteletext=disabled -Dvoamrwbenc=disabled -Dwildmidi=disabled -Dmsdk=disabled -Dva=disabled -Dmediafoundation=disabled -Dintrospection=disabled -Dexamples=disabled mybadbuild/

      Problem:But getting below error during above execution.

      DEPRECATION: c_args in the [properties] section of the machine file is deprecated, use the [built-in options] section.
      DEPRECATION: cpp_args in the [properties] section of the machine file is deprecated, use the [built-in options] section.
      DEPRECATION: objc_args in the [properties] section of the machine file is deprecated, use the [built-in options] section.
      DEPRECATION: objcpp_args in the [properties] section of the machine file is deprecated, use the [built-in options] section.
      DEPRECATION: c_link_args in the [properties] section of the machine file is deprecated, use the [built-in options] section.
      DEPRECATION: cpp_link_args in the [properties] section of the machine file is deprecated, use the [built-in options] section.
      DEPRECATION: objc_link_args in the [properties] section of the machine file is deprecated, use the [built-in options] section.
      DEPRECATION: objcpp_link_args in the [properties] section of the machine file is deprecated, use the [built-in options] section.
      The Meson build system
      Version: 0.58.1
      Source dir: /home/rajesh/myubuntuwork/gstreamer-related/cerbero/mygstbadplugin/gst-plugins-bad
      Build dir: /home/rajesh/myubuntuwork/gstreamer-related/cerbero/mygstbadplugin/gst-plugins-bad/mybadbuild
      Build type: cross build
      Project name: gst-plugins-bad
      Project version: 1.19.2
      C compiler for the host machine: /home/rajesh/myubuntuwork/gstreamer-related/cerbero/build/android-ndk-21/toolchains/llvm/prebuilt/linux-x86_64/bin/clang -target aarch64-none-linux-android --sysroot /home/rajesh/myubuntuwork/gstreamer-related/cerbero/build/android-ndk-21/platforms/android-21/arch-arm64 (clang 9.0.8 "Android (5900059 based on r365631c) clang version 9.0.8 (https://android.googlesource.com/toolchain/llvm-project 207d7abc1a2abf3ef8d4301736d6a7ebc224a290) (based on LLVM 9.0.8svn)")
      C linker for the host machine: /home/rajesh/myubuntuwork/gstreamer-related/cerbero/build/android-ndk-21/toolchains/llvm/prebuilt/linux-x86_64/bin/clang -target aarch64-none-linux-android --sysroot /home/rajesh/myubuntuwork/gstreamer-related/cerbero/build/android-ndk-21/platforms/android-21/arch-arm64 ld.bfd

      meson.build:1:0: ERROR: Unknown linker(s):
      The following exception(s) were encountered:
      Running "aarch64-linux-android-ar --version" gave "[Errno 2] No such file or directory: 'aarch64-linux-android-ar'"

      But i do not see such error in build/logs/android_arm64/gst-plugins-bad-1.0-configure.log for normal flow.

      Could you help me on this error.

      Thanks and Regards
      Rajesh Chanda

      Reply to this comment

      Reply to this comment

      1. Stephane:
        Oct 14, 2021 at 09:45 AM

        Dear Rajesh,

        The tool is available on my side:
        $ cd /myworkdir/cerbero_master
        ./cerbero-uninstalled -c config/cross-android-universal.cbc shell
        $ which aarch64-linux-android-ar

        I am sorry to hear you are having other issues with cerbero. But as its not related to gst-build, I would recommend you to
        continue sharing feedback directly on the GStreamer mailing list or on Gitlab for issues where others can help as well.

        Otherwise, you can also get in touch with us to look at setting up a proper support contract between your company and Collabora.

        Best regards.


        Reply to this comment

        Reply to this comment

      2. Stephane:
        Oct 14, 2021 at 11:31 AM

        Dear Rajesh,

        As 'android_universal' is a meta cerbero config which builds all the android target(x86,arm64), I would recommend you to perform the build and your test with 'config/cross-android-arm64.cbc' instead if you are targeting ARM64 Android for example.



        Reply to this comment

        Reply to this comment

Add a Comment

Allowed tags: <b><i><br>Add a new comment:

Search the newsroom

Latest Blog Posts

Venus on QEMU: Enabling the new virtual Vulkan driver


A step-by-step guide on how to enable 3D acceleration of Vulkan applications in QEMU through the new Venus experimental Vulkan driver for…

Run your own CI pipeline with GStreamer's new monorepo


Maintaining a non-trivial set of GStreamer patches can be tricky. Thanks to the recent move to a single, unified git repo, you can now easily…

Improving test coverage for cameras in KernelCI


Earlier this year, I joined Collabora as an intern to work on improving testing in libcamera and automating it through KernelCI. Having…

A tale of two toolchains and glibc


With the LLVM toolchain seeing increasing development and adoption alongside the older, more established GNU toolchain, projects needing…

An xrdesktop summer of code


This summer, Christoph Haag and I had the pleasure of taking part in Google Summer of Code as mentors for xrdesktop, the Open Source project…

Adding VP9 and MPEG2 stateless support in v4l2codecs for GStreamer


Earlier this year, from January to April 2021, I worked on adding support for stateless decoders for GStreamer as part of a multimedia internship…

Open Since 2005 logo

We use cookies on this website to ensure that you get the best experience. By continuing to use this website you are consenting to the use of these cookies. To find out more please follow this link.

Collabora Ltd © 2005-2021. All rights reserved. Privacy Notice. Sitemap.

Collabora Limited is registered in England and Wales. Company Registration number: 5513718. Registered office: The Platinum Building, St John's Innovation Park, Cambridge, CB4 0DS, United Kingdom. VAT number: 874 1630 19.