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!

Environment

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

  • Ubuntu 18.04
  • Bash Shell

Prerequisites

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

  Subprojects
                        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 (23)

  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
    Leslaw

    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

    Hey,

    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

    Regards.

    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 1.19.0.1

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

    /subprojects/gstreamer/data/bash-completion/completions/gst-launch-1.0

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

    Subprojects
    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

      Hello,

      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.

      Regards.

      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

        Regards.

        Reply to this comment

        Reply to this comment

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

          Hello,

          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.

          Regards.

          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.

            Regards.

            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


Add a Comment






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


Search the newsroom

Latest Blog Posts

Adding VP9 and MPEG2 stateless support in v4l2codecs for GStreamer

23/06/2021

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

Bag of Freebies for XR Hand Tracking: Machine Learning & OpenXR

17/06/2021

In our previous post, we presented a project backed by INVEST-AI which introduces a multi-stage neural network-based solution. Now let's…

Testing cameras with lc-compliance on KernelCI

15/06/2021

Initiated as a joint effort by the Google Chrome OS team and Collabora, the recent KernelCI hackfest brought the addition of new tests including…

Zink: Summer 2021 update

14/06/2021

There's a lot that has happened in the world of Zink since my last update, so let's see if I can bring you up to date on the most important…

Open Source OpenGL ES 3.1 on Mali GPUs with Panfrost

11/06/2021

Panfrost, the open source driver for Arm Mali, now supports OpenGL ES 3.1 on both Midgard (Mali T760 and newer) and Bifrost (Mali G31, G52,…

Optimizing 3D performance with virglrenderer

17/05/2021

Collabora has been investing into Perfetto to enable driver authors & users to get deep insights into driver internals and GPU performance.…

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.