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

Install Gstreamer 1.18.3 on Qt 5.15, Win7, Mingw 8.1



  • For the last week i have been trying to install/run the Gstreamer library on Qt.

    The Gstreamer instructions say that they recommend Visual Studio, but i would like to install it on Qt, so i eloquently jumped over all Visual Studio instructions, installed gstreamer-1.0-devel-mingw-x86_64-1.18.3.msi and gstreamer-1.0-mingw-x86_64-1.18.3.msi, added

    INCLUDEPATH += "C:\gstreamer\1.0\mingw_x86_64\include\gstreamer-1.0"
    INCLUDEPATH += "C:\gstreamer\1.0\mingw_x86_64\include\glib-2.0"
    INCLUDEPATH += "C:\gstreamer\1.0\mingw_x86_64\lib\glib-2.0\include"
    
    
    LIBS += "C:/gstreamer/1.0/mingw_x86_64/lib/gstreamer-1.0.lib"
    LIBS += "C:/gstreamer/1.0/mingw_x86_64/lib/glib-2.0.lib" #Not necessary, but added nevertheless
    

    to qmake and hoped for the best. The compiler doesnt complain, but at runtime the program crashes before main, as long as you include gst_init somwhere in the code. Looks like a dynamic linking upsie.
    Specifications are Windows 7, compiler is mingw 8.1, qt is qt 5.15/5.12, i have tried in both.

    I simply dont know how to troubleshoot this on my own. I require assistance.

    Unecessary things i tried: Somebody on the internet suggested that the binary of gstreamer was built with mscv, and might not be compatible with Mingw, so i though i just recompile gstreamer from source. Gstreamer from source requires meson. The latest meson build no longer supports win7 because python 3.9 no longer supports win7. I thought ok, just build meson from scratch. How to do that ? Than i thought of a different solution and to install the 2019 mscv build tools directly. I got teh compiler to show up in qt, but it still get a crash before main, as well as the mscv compiler not working even if you remove the gst_init, even though it works for projects which dont have gstreamer in it. Im unsure if i installed mscv 2019 correctly, but that some other applications compile means that it should work generally, but like i said, no difference in the crash before main.
    code:

    #include <iostream>
    #include <gst/gst.h>
    #include <windows.h>
    
    using std::cout;
    using std::endl;
    using std::cin;
    
    void TestStop()
    {
        cout << "TestStop" << endl;
        getchar();
    }
    
    int main(int argc, char *argv[])
    {
        TestStop();
    
        GstElement *pipeline;
        GstBus *bus;
        GstMessage *msg;
    
        TestStop();
    
        /* Initialize GStreamer */
        gst_init (&argc, &argv);
    
        /* Build the pipeline */
        pipeline =
            gst_parse_launch
            ("playbin uri=https://www.freedesktop.org/software/gstreamer-sdk/data/media/sintel_trailer-480p.webm",
            NULL);
    
        TestStop();
    
        /* Start playing */
        gst_element_set_state (pipeline, GST_STATE_PLAYING);
    
        /* Wait until error or EOS */
        bus = gst_element_get_bus (pipeline);
        msg =
            gst_bus_timed_pop_filtered( bus, GST_CLOCK_TIME_NONE,
            (GstMessageType)(GST_MESSAGE_ERROR | GST_MESSAGE_EOS));
    
        /* Free resources */
        if (msg != NULL)
          gst_message_unref (msg);
        gst_object_unref (bus);
        gst_element_set_state (pipeline, GST_STATE_NULL);
        gst_object_unref (pipeline);
        return 0;
    }
    

  • Lifetime Qt Champion

    Hi and welcome to devnet,

    Did you unsure that the GStreamer dlls are found at run time ?



  • @SGaist Hi and thanks for answering.

    I dont even know how i can test if the application can find the libraries at runtime. As far as i understood it for qt its enough to add the libraries to qmake, and it will look there.
    Deployment obviously is a totally different story.


  • Lifetime Qt Champion

    The .pro file part is to link the libraries.

    When you run your application, the standard Windows rule apply: either the .dlls are in the same folder as the application binary or they should be in one of the folders listed in the PATH environment variable.

    To ensure that, go to the Run part of the Project panel and adjust the PATH environment variable there.



  • @SGaist
    Additional info: The application simply exits with this code.

    19:42:24: C:\Users\Name\Desktop\Neuer Ordner\build-Test-Desktop_Qt_5_15_2_MinGW_64_bit-Debug\debug\Test.exe exited with code -1073741515
    

    i have added C:\gstreamer\1.0\mingw_x86_64\lib now to the windiws PATH variable with the same result.
    Whats the ... oh, wow, never seen the run part of qt.
    Unbenannt.png
    Still same result.


  • Lifetime Qt Champion

    @Charon117 said in Install Gstreamer 1.18.3 on Qt 5.15:

    1073741515

    Do you also have the corresponding runtime libraries accessible ?

    If you use something like Dependency Walker on the executable and add the same folder to the list to search, what do you get ?



  • @SGaist said in Install Gstreamer 1.18.3 on Qt 5.15:

    f you use something like Dependency Walker on the executable and add the same folder to the list to search, what do you get ?

    Thats exactly the debugging step i am currently at. I will get back to you with my findings with the dependency walker.

    Ok, back with the preliminary results. I fed the C:\Users\Name\Desktop\Neuer Ordner\build-Test-Desktop_Qt_5_15_2_MinGW_64_bit-Debug\debug\test.exe to teh dependency walker.

    Error: At least one required implicit or forwarded dependency was not found.
    Error: At least one module has an unresolved import due to a missing export function in an implicitly dependent module.
    Error: Modules with different CPU types were found.
    Warning: At least one delay-load dependency module was not found.
    Warning: At least one module has an unresolved import due to a missing export function in a delay-load dependent module.
    

    Unbenannt2.png

    Though it shows exactly the same errors for when i only write

    int main(int argc, char *argv[])
    {
        TestStop();
    
        TestStop();
        return 0;
    }
    

    I have run a simple hello world programm, and i get these errors:
    Unbenannt3.png
    As you can see, the windows errors are mostly the same, and for deployment i know i have to add libgcc_5_seh and qt5core.
    Here is an example of an application that i shipped and know that works.
    Unbenannt10.png
    So ... unsure how i should interprete the walkder dependency finds. The 4 API + DCOMP +IESHIM seem to be missing on all applications. Libgcc_s_seh is the c++ standart. Which leaves the libgstreamer-1.0.0.dll which is obviously not there.
    Note that we are talking about deployment here already, and all of this has nothing to do with what qt creator has or hasnt access to at compile time.

    Solution ?: I hope its not too early to call it, but my mistake seems to have been to write the wrong path into the PATH. /lib instead of /bin ( where the dll resides ). Writing the path into the windows environment PATH doesnt seem to work as long as you run in debug mode over the qt creator, but adding the correct path in projects > PATH seems to have solved the issue. At least it finds the dll, and it runs the video, which the code was all about. Fingers crossed that this is the actual solution. I will update this once i think the issue is completely solved.


  • Lifetime Qt Champion

    So yes fixing the wrong path to the .dlls is the correct solution.

    The .dll debugging done here, while looking related to deployment, was to ensure that the correct paths were added to PATH in order to get GStreamer's .dlls properly loaded when you hit run in Qt Creator.



  • I slightly tested it, and the library seems to work as intended. You will have to refactor tutorial examples into C++, as gstreamer is written in C. Again, here are the installation steps for gstreamer 1.18.3 for Qt 5.15 on win7 64 bit with mingw 8.1:

    • Download and install
      gstreamer-1.0-devel-mingw-x86_64-1.18.3.msi and
      gstreamer-1.0-mingw-x86_64-1.18.3.msi.
    • Add
    INCLUDEPATH += "C:\gstreamer\1.0\mingw_x86_64\include\gstreamer-1.0"
    INCLUDEPATH += "C:\gstreamer\1.0\mingw_x86_64\include\glib-2.0"
    INCLUDEPATH += "C:\gstreamer\1.0\mingw_x86_64\lib\glib-2.0\include"
    
    
    LIBS += "C:/gstreamer/1.0/mingw_x86_64/lib/gstreamer-1.0.lib"
    

    to your qmake (.pro) file.

    • Add the C:\gstreamer\1.0\mingw_x86_64\bin path to the projects > Run > Environment > PATH variable in qt creator.

    That looks like a working setup for me.

    Thanks to @SGaist for helping solving this problem for me, all props to him :). Thank you very much.


Log in to reply