Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Problem in integration of the QT5GStreamer in the QT5



  • Hello,
    I'm trying to integrate the QT5GStreamer in my QT5.15.2 installed in a ubuntu machine. The QT5GStreamer was installed using the commands I got from here libqt5gstreamer-dev :

    sudo apt-get update
    sudo apt-get install libqt5gstreamer-dev
    

    After this step, i add the following definitions in my .pro file:

    unix:CONFIG += link_pkgconfig
    unix:PKGCONFIG += Qt5GStreamer-1.0
    

    Even do not using any function or header file inclusion of the Qt5GStreamer, I have several issues during the compilation process:
    Captura de ecrã 2021-09-29 124012.png

    Most of the issues are related to the QT5 libraries.
    Everything runs fine if i remove the unix:PKGCONFIG += Qt5GStreamer-1.0 from .pro file.

    What am I doing wrong?


  • Lifetime Qt Champion

    @Daniellopes said in Problem in integration of the QT5GStreamer in the QT5:

    sudo apt-get install libqt5gstreamer-dev

    You installed qt5gstreamer from your Linux distribution. Do you also use Qt provided by your Linux distribution?



  • @jsulm No, i got the QT5.15.2 from QT's website

    Captura de ecrã 2021-09-29 125210.png


  • Lifetime Qt Champion

    @Daniellopes Then sudo apt-get install libqt5gstreamer-dev is useless. Uninstall it.



  • @Daniellopes I think libqt5gstreamer has been compiled with the Qt from the repository (when you use apt-get only the binaries are downloaded). Try downloading the source code https://github.com/GStreamer/qt-gstreamer and compiling it with the Qt 5.15.2 you have installed.



  • @eyllanesc I will try. Thank you!



  • Sorry, I'm a noob in this kind of process. I've followed the instructions described in the link @eyllanesc had posted. I'm using the cmake to generate the libraries. After uninstalling the old libraries and perform the CMake install, the issues remain. Should I use the qmake instead?

    These are the executed commands:

    git clone https://github.com/GStreamer/qt-gstreamer.git
    cd qt-gstreamer
    mkdir build && cd build
    cmake .. -DQT_VERSION=5 -DQTGSTREAMER_EXAMPLES=ON -DUSE_QT_PLUGIN_DIR=ON 
    make
    make install
    
    

  • Lifetime Qt Champion

    Hi,

    Did you ensure that the build is using your Qt 5.15 installation ?



  • In fact, i do not know. This is the cmakelists file:

    project(QtGStreamer)
    cmake_minimum_required(VERSION 2.8.9)
    enable_testing()
    
    set(CMAKE_POSITION_INDEPENDENT_CODE ON)
    set(CMAKE_AUTOMOC ON)
    set(CMAKE_INCLUDE_CURRENT_DIR ON)
    set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules)
    
    set(QTGSTREAMER_VERSION 1.2.0)
    
    option(QTGSTREAMER_STATIC "Build QtGStreamer as a static library" OFF)
    option(QTGSTREAMER_TESTS "Build QtGStreamer's tests" OFF)
    option(QTGSTREAMER_EXAMPLES "Build QtGStreamer's examples" ON)
    option(QTGSTREAMER_CODEGEN "Build and use QtGStreamer's codegen" OFF)
    option(USE_GST_PLUGIN_DIR "Install gstreamer plugins at the system location" ON)
    option(USE_QT_PLUGIN_DIR "Install qt plugins at the system location" ON)
    
    include(GNUInstallDirs)
    include(MacroLogFeature)
    
    set(Qt4_MIN_VERSION 4.7)
    set(Qt5_MIN_VERSION 5.0.0)
    find_package(Qt4or5 COMPONENTS Core Gui Widgets OPTIONAL_COMPONENTS OpenGL Quick1 Quick2 Qml Test)
    macro_log_feature(Qt4or5_FOUND "Qt" "Required for building everything"
                                   "http://qt-project.org/" TRUE "${Qt4or5_MIN_VERSION}")
    macro_log_feature(Qt4or5_OpenGL_FOUND "QtOpenGL"
                                    "Required for OpenGL acceleration in qtvideosink and QtGStreamerUi"
                                    "http://qt-project.org/" FALSE "${Qt4or5_MIN_VERSION}")
    macro_log_feature(Qt4or5_Quick1_FOUND "QtQuick1 (QtDeclarative)"
                                    "Required for building QtQuick1 support"
                                    "http://qt-project.org/" FALSE "${Qt4or5_MIN_VERSION}")
    if (${QT_VERSION} STREQUAL "5")
        macro_log_feature(Qt4or5_Quick2_FOUND "QtQuick2 (QtQuick)"
                                    "Required for building QtQuick2 support"
                                    "http://qt-project.org/" TRUE "${Qt4or5_MIN_VERSION}")
        macro_log_feature(Qt4or5_Qml_FOUND "QtQml"
                                    "Required for building QtQuick2 support"
                                    "http://qt-project.org/" TRUE "${Qt4or5_MIN_VERSION}")
    endif()
    
    if (QTGSTREAMER_TESTS)
        macro_log_feature(Qt4or5_Test_FOUND "QtTest" "Required for building unit tests"
                                          "http://qt-project.org/" FALSE "${Qt4or5_MIN_VERSION}")
        if (NOT Qt4or5_Test_FOUND)
            set(QTGSTREAMER_TESTS OFF)
        endif()
    endif()
    
    find_package(Boost 1.39)
    macro_log_feature(Boost_FOUND "Boost" "Required for building QtGLib" "http://www.boost.org/" TRUE "1.39")
    
    # set the QTGSTREAMER_* cmake variables
    set(BUILDING_QTGSTREAMER TRUE)
    if (${QT_VERSION} STREQUAL "5")
        set(USE_QT5 TRUE)
        set(QTGLIB_LIBRARY Qt5GLib)
        set(QTGSTREAMER_LIBRARY Qt5GStreamer)
        set(QTGSTREAMER_QUICK_LIBRARY Qt5GStreamerQuick)
        set(QTGSTREAMER_UI_LIBRARY Qt5GStreamerUi)
        set(QTGSTREAMER_UTILS_LIBRARY Qt5GStreamerUtils)
        set(QTGSTREAMER_PACKAGE_NAME Qt5GStreamer)
        set(QTVIDEOSINK_NAME qt5videosink)
        set(QTGLVIDEOSINK_NAME qt5glvideosink)
        set(QWIDGETVIDEOSINK_NAME qwidget5videosink)
    elseif (${QT_VERSION} STREQUAL "4")
        set(USE_QT4 TRUE)
        set(QTGLIB_LIBRARY QtGLib)
        set(QTGSTREAMER_LIBRARY QtGStreamer)
        set(QTGSTREAMER_QUICK_LIBRARY "")
        set(QTGSTREAMER_UI_LIBRARY QtGStreamerUi)
        set(QTGSTREAMER_UTILS_LIBRARY QtGStreamerUtils)
        set(QTGSTREAMER_PACKAGE_NAME QtGStreamer)
        set(QTVIDEOSINK_NAME qtvideosink)
        set(QTGLVIDEOSINK_NAME qtglvideosink)
        set(QWIDGETVIDEOSINK_NAME qwidgetvideosink)
    endif()
    set(QTGSTREAMER_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/src)
    include(QtGStreamerConfigCommon)
    
    find_package(GStreamer 1.2.0 COMPONENTS base)
    macro_log_feature(GSTREAMER_FOUND "GStreamer" "Required to build QtGStreamer"
                                      "http://gstreamer.freedesktop.org/" TRUE "1.2.0")
    macro_log_feature(GSTREAMER_BASE_LIBRARY_FOUND "GStreamer base library"
                                                   "Used for building the ${QTVIDEOSINK_NAME} element"
                                                   "http://gstreamer.freedesktop.org/" FALSE "1.2.0")
    
    find_package(GStreamerPluginsBase 1.2.0 COMPONENTS app audio video pbutils)
    macro_log_feature(GSTREAMER_APP_LIBRARY_FOUND "GStreamer app library"
                                                  "Required to build QtGStreamerUtils"
                                                  "http://gstreamer.freedesktop.org/" TRUE "1.2.0")
    macro_log_feature(GSTREAMER_AUDIO_LIBRARY_FOUND "GStreamer audio library"
                                                    "Required to build QtGStreamer"
                                                    "http://gstreamer.freedesktop.org/" TRUE "1.2.0")
    macro_log_feature(GSTREAMER_VIDEO_LIBRARY_FOUND "GStreamer video library"
                                                    "Required to build QtGStreamer"
                                                    "http://gstreamer.freedesktop.org/" TRUE "1.2.0")
    macro_log_feature(GSTREAMER_PBUTILS_LIBRARY_FOUND "GStreamer pbutils library"
                                                    "Used for building the Discoverer API"
                                                    "http://gstreamer.freedesktop.org/" TRUE "1.2.0")
    
    find_package(GLIB2)
    macro_log_feature(GLIB2_FOUND "GLib" "Required to build QtGLib" "http://www.gtk.org/" TRUE)
    
    find_package(GObject)
    macro_log_feature(GOBJECT_FOUND "GObject" "Required to build QtGLib" "http://www.gtk.org/" TRUE)
    
    set(CMAKE_REQUIRED_INCLUDES ${QTGSTREAMER_INCLUDES})
    add_definitions(${GSTREAMER_DEFINITIONS})
    include(CheckCXXSourceCompiles)
    check_cxx_source_compiles("
    #include <QtCore/QtGlobal>
    #if !defined(QT_OPENGL_ES)
    #error \"No OpenGLES\"
    #endif
    int main() {}
    " USE_OPENGLES)
    
    if (USE_OPENGLES)
        find_package(OpenGLES2)
        macro_log_feature(OPENGLES2_FOUND "OpenGLES"
                              "Required for OpenGLES rendering support in ${QTVIDEOSINK_NAME}"
                              "http://www.opengl.org" FALSE "2.0")
    else()
        find_package(OpenGL)
        macro_log_feature(OPENGL_FOUND "OpenGL"
                              "Required for OpenGL rendering support in ${QTVIDEOSINK_NAME}"
                              "http://www.opengl.org" FALSE)
    endif()
    
    if (QTGSTREAMER_CODEGEN AND CMAKE_CROSSCOMPILING)
        message(WARNING "Codegen use requested, but we are crosscompiling. Disabling...")
        set(QTGSTREAMER_CODEGEN OFF)
    endif()
    
    if (QTGSTREAMER_CODEGEN)
        find_package(FLEX)
        macro_log_feature(FLEX_FOUND "Flex" "Required to build codegen, a helper code generator"
                                     "http://flex.sourceforge.net/" TRUE)
    
        find_package(BISON)
        macro_log_feature(BISON_FOUND "Bison" "Required to build codegen, a helper code generator"
                                      "http://www.gnu.org/software/bison/" TRUE)
    endif()
    
    
    if (CMAKE_COMPILER_IS_GNUCXX)
        set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wformat-security -Wundef -Wpointer-arith -fno-common")
    endif ()
    
    
    set(QTGSTREAMER_INSTALL_TARGET_DEFAULT_ARGS
            RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
            LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
            ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
    set(QTGSTREAMER_PC_INSTALL_DIR ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
    set(QTGSTREAMER_CMAKE_CONFIG_INSTALL_DIR ${CMAKE_INSTALL_LIBDIR}/cmake/${QTGSTREAMER_PACKAGE_NAME})
    set(QTGSTREAMER_INCLUDES_INSTALL_DIR ${CMAKE_INSTALL_INCLUDEDIR}/${QTGSTREAMER_PACKAGE_NAME})
    
    if (USE_GST_PLUGIN_DIR)
        set(QTGSTREAMER_GST_PLUGINS_INSTALL_DIR ${GSTREAMER_PLUGIN_DIR})
    else()
        set(QTGSTREAMER_GST_PLUGINS_INSTALL_DIR ${CMAKE_INSTALL_LIBDIR}/gstreamer-${GSTREAMER_ABI_VERSION})
    endif()
    
    if (USE_QT_PLUGIN_DIR)
        set(QTGSTREAMER_QTQUICK1_INSTALL_DIR ${QT_IMPORTS_DIR})
        set(QTGSTREAMER_QTQUICK2_INSTALL_DIR ${QT_QML_DIR})
    else()
        if (USE_QT5)
            set(QTGSTREAMER_QTQUICK1_INSTALL_DIR ${CMAKE_INSTALL_LIBDIR}/qt5/imports)
            set(QTGSTREAMER_QTQUICK2_INSTALL_DIR ${CMAKE_INSTALL_LIBDIR}/qt5/qml)
        else()
            set(QTGSTREAMER_QTQUICK1_INSTALL_DIR ${CMAKE_INSTALL_LIBDIR}/qt4/imports)
        endif()
    endif()
    
    
    if (QTGSTREAMER_CODEGEN AND FLEX_FOUND AND BISON_FOUND)
        add_subdirectory(codegen)
    endif()
    
    add_subdirectory(src)
    add_subdirectory(elements)
    
    if (QTGSTREAMER_TESTS)
        add_subdirectory(tests)
    endif()
    
    if (QTGSTREAMER_EXAMPLES)
        add_subdirectory(examples)
    endif()
    
    # Add uninstall target. Taken from the KDE4 scripts
    configure_file("${CMAKE_SOURCE_DIR}/cmake/modules/cmake_uninstall.cmake.in" "${CMAKE_BINARY_DIR}/cmake_uninstall.cmake" @ONLY)
    add_custom_target(uninstall "${CMAKE_COMMAND}" -P "${CMAKE_BINARY_DIR}/cmake_uninstall.cmake")
    
    # Add doc target
    include(UseDoxygen)
    macro_log_feature(DOXYGEN_FOUND "Doxygen" "Used to generate the API documentation"
                                    "http://www.doxygen.org/" FALSE)
    
    macro_display_feature_log()
    
    

    I guess the function find_package(Qt4or5 COMPONENTS Core Gui Widgets OPTIONAL_COMPONENTS OpenGL Quick1 Quick2 Qml Test) is getting all the dependencies. Some of those are the QT libraries, right? But I don't know how can i ensure that it is using the QT5.15 in the code compiling. Is not set by that "-DQT_VERSION=5" argument in the cmake command?

    cmake .. -DQT_VERSION=5 -DQTGSTREAMER_EXAMPLES=ON -DUSE_QT_PLUGIN_DIR=ON 
    

  • Lifetime Qt Champion

    You can use ccmake to check what was configured and modify there the paths to point to your ci custom Qt installation.

    Otherwise you have to check the Qt4or5 finder script to see how to feed it the proper path.



  • @SGaist said in Problem in integration of the QT5GStreamer in the QT5:

    Otherwise you have to check the Qt4or5 finder script to see how to feed it the proper path.

    Ok, I check the DIRS on ccmake and they were not using the Q5.15.2. However, the issues remain. This was the first state of the makeconfig file:
    Captura de ecrã 2021-10-01 092106.png

    Then I've changed some directories and the configurations is this now:
    Captura de ecrã 2021-10-01 104831.png

    Captura de ecrã 2021-10-01 104907.png

    Captura de ecrã 2021-10-01 104932.png

    Captura de ecrã 2021-10-01 104956.png

    When I press the "c" key to perform the configuration, the following message comes up:

    CMake Warning at cmake/modules/FindQt4or5.cmake:79 (find_package):
       By not providing "FindQt5Declarative.cmake" in CMAKE_MODULE_PATH this
       project has asked CMake to find a package configuration file provided by
       "Qt5Declarative", but CMake did not find one.
    
       Could not find a package configuration file provided by "Qt5Declarative"
       (requested version 5.0.0) with any of the following names:
    
         Qt5DeclarativeConfig.cmake
         qt5declarative-config.cmake
    
       Add the installation prefix of "Qt5Declarative" to CMAKE_PREFIX_PATH or set
       "Qt5Declarative_DIR" to a directory containing one of the above files.  If
       "Qt5Declarative" provides a separate development package or SDK, be sure it
       has been installed.
     Call Stack (most recent call first):
       CMakeLists.txt:24 (find_package)
    
    
    
     CMake Warning (dev) at /usr/share/cmake-3.16/Modules/FindOpenGL.cmake:275 (message):
       Policy CMP0072 is not set: FindOpenGL prefers GLVND by default when
       available.  Run "cmake --help-policy CMP0072" for policy details.  Use the
       cmake_policy command to set the policy and suppress this warning.
    
       FindOpenGL found both a legacy GL library:
    
         OPENGL_gl_LIBRARY: /usr/lib/x86_64-linux-gnu/libGL.so
    
       and GLVND libraries for OpenGL and GLX:
    
         OPENGL_opengl_LIBRARY: /usr/lib/x86_64-linux-gnu/libOpenGL.so
         OPENGL_glx_LIBRARY: /usr/lib/x86_64-linux-gnu/libGLX.so
    
       OpenGL_GL_PREFERENCE has not been set to "GLVND" or "LEGACY", so for
       compatibility with CMake 3.10 and below the legacy GL library will be used.
     Call Stack (most recent call first):
       CMakeLists.txt:125 (find_package)
     This warning is for project developers.  Use -Wno-dev to suppress it.
    
    
     CMake Warning at CMakeLists.txt:171 (message):
       DIR: /home/ubuntu/Qt/5.15.2/gcc_64/qml
    
    
    
     CMake Warning at CMakeLists.txt:172 (message):
       DIR: /home/ubuntu/Qt/5.15.2/gcc_64/imports
    
    CMake Warning (dev) at examples/CMakeLists.txt:13 (get_target_property):
       Policy CMP0045 is not set: Error on non-existent target in
       get_target_property.  Run "cmake --help-policy CMP0045" for policy details.
       Use the cmake_policy command to set the policy and suppress this warning.
    
       get_target_property() called with non-existent target "examples_distcheck".
     Call Stack (most recent call first):
       examples/CMakeLists.txt:22 (example_distcheck)
     This warning is for project developers.  Use -Wno-dev to suppress it.
    
    
    
     -----------------------------------------------------------------------------
     -- The following external packages were located on your system.
     -- This installation will have the extra features provided by these packages.
     -----------------------------------------------------------------------------
        * Qt - Required for building everything
        * QtOpenGL - Required for OpenGL acceleration in qtvideosink and QtGStreamerUi
        * QtQuick2 (QtQuick) - Required for building QtQuick2 support
        * QtQml - Required for building QtQuick2 support
        * Boost - Required for building QtGLib
        * GStreamer - Required to build QtGStreamer
        * GStreamer base library - Used for building the qt5videosink element
        * GStreamer app library - Required to build QtGStreamerUtils
        * GStreamer audio library - Required to build QtGStreamer
        * GStreamer video library - Required to build QtGStreamer
        * GStreamer pbutils library - Used for building the Discoverer API
        * GLib - Required to build QtGLib
        * GObject - Required to build QtGLib
        * OpenGL - Required for OpenGL rendering support in qt5videosink
    
     -----------------------------------------------------------------------------
     -- The following OPTIONAL packages could NOT be located on your system.
     -- Consider installing them to enable more features from this software.
     -----------------------------------------------------------------------------
        * QtQuick1 (QtDeclarative) (5.0.0 or higher)  <http://qt-project.org/>
          Required for building QtQuick1 support
        * Doxygen  <http://www.doxygen.org/>
          Used to generate the API documentation
    
    
     -----------------------------------------------------------------------------
    
    

    After it I execute the make -j8 and the make install. Unfortunately, the issues did not disappear.



  • add this -DCMAKE_INSTALL_PREFIX=/opt/thirdParties/QtGstreamer to build it. It is better to install it under /opt/ since it is a customized build. Purge your old installation. Then link it to your app. I did this without issues.


Log in to reply