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

How to install submodule Qtmultimedia on Fedora?



  • Environment:
    OS: Fedora,
    Qt: version 5.15.2

    Hello, I am struggling to install Qtmultimedia.

    I downloaded Qt binary from Open Source Qt Use and installed version 5.15.2 as Getting Started with Qt .

    After I coded something which uses Qtmultimedia, Qt creator said:
    Unknown module(s) in QT: multimedia

    I found this topic, Qt5 (How to install an addon/ module like Qt Location for instance, but I could not install Qtmultimedia.

    What I did 1:

    $ git clone git://code.qt.io/qt/qt5.git
    $ cd qt5/qtmultimedia
    $ 'pathToQt/5.15.2/gcc_64/bin/qmake' 
    $ make
    $make install
    

    This, however, did not help. The error message came again.

    What I did 2:

    $ git clone git://code.qt.io/qt/qt5.git
    $ cd qt5/
    $ ./init-repository --module-subset=qtbase,qtdeclarative,qtmultimedia
    $ cd ..
    $ mkdir qt5_build
    $ ./configure -developer-build -opensource -nomake examples -nomake tests
    $ make -j$(nproc)
    

    Unfortunately, this brought errors which related to gcc version, even though mine is latest gcc.

    So what can I do to install Qtmultimedia?

    Thank you for your time.


  • Lifetime Qt Champion

    Hi and welcome to devnet,

    Some maybe silly questions:

    • Did you check that your Kit is indeed using the pre-built binaries ?
    • Did you check the content of the lib folder in your Qt installation ?
    • Do you have the same issue if you build your application from the command line ?


  • Thank you for your reply.

    Did you check that your Kit is indeed using the pre-built binaries ?

    I am a newbie of Qt Creator, so I have no idea how to check my kit is using the pre-build binaries...

    Did you check the content of the lib folder in your Qt installation ?

    The lib folder does not exist under my Qt directory but there are some directories named lib under /5.15.2. Such as /android, /gcc_64, /wasm_32. Others are under qt5/gnuwin32, qt5/qtbase, qt5/qtmultimedia. And last, under Tools/QtCreator.

    -Qt/ 
     |--/ 5.15.2
        |-/android
        |-/gcc_64
        |-/wasm_32
    

    Do you have the same issue if you build your application from the command line ?

    Not same issue.
    After qmake and make, an error said:

    mainwindow.h:4:10: fatal error: QMainWindow: No such file or directory
        4 | #include <QMainWindow>
          |          ^~~~~~~~~~~~~
    compilation terminated.
    

  • Lifetime Qt Champion

    For verifying the kits go in the Qt Creator settings.

    Since you are using your desktop Qt build you should check the content that is in gcc_64.



  • @SGaist
    I checked Qt creator's setting.
    Kits:

    • Desktop Qt 5.15.2 GCC 64bit

    Qt Versions:

    • Qt 5.15.2GCC 64bit(/Qt/5.15.2/gcc_64/bin/qmake)

    Kits' compilers are
    C:

    • GCC (/usr/bin)
    • GCC (/usr/lib64/ccache)
    • list itemGCC (/Qt/Tools/QtCreator/libexec/qtcreator/clang/bin)

    C++:

    • GCC (/usr/bin)
    • GCC (/usr/lib64/ccache)

  • Lifetime Qt Champion

    That part looks good.

    What about the content of gcc_x64 lib and plugins folders ?



  • This is how I installed web engine module. It may be helpful for you.
    git clone ​https://code.qt.io/qt/qtwebengine.git
    cd qtwebengine
    git checkout 5.15.2 ==>match the Qt version installed
    git submodule update --init --recursive
    mkdir build
    cd build
    qmake ../qtwebengine.pro -- -no-build-qtwebengine-core ==>core engine build has been installed, no need to rebuild
    make -j4
    sudo make install ==>automatically to the installed location of Qt-5.15.2


  • Lifetime Qt Champion

    @JoeCFD it's not about QtWebEngine but QtMultimedia.

    However, one good point: checkout the branch matching your release. By default it's dev and that one contains Qt 6 code.



  • @SGaist I know that. Simply let him know how this is done.



  • @SGaist

    There are so many, about 600, files in the gcc_64 lib. What kind of files should be in the directory?

    Plugins folder has these folders:

    • assetimporters
    • audio
    • bearer
    • canbus
    • designer
    • egldeviceintegrations
    • gamepads
    • generic
    • geometryloaders
    • geoservices
    • iconengines
    • imageformats
    • mediaservice
    • platforminputcontexts
    • platforms
    • platformthemes
    • playlistformats
    • position
    • printsupport
    • qmltooling
    • renderers
    • renderplugins
    • sceneparsers
    • sensorgestures
    • sensors
    • sqldrivers
    • texttospeech
    • virtualkeyboard
    • wayland-decoration-client
    • wayland-graphics-integration-client
    • wayland-graphics-integration-server
    • wayland-shell-integration
    • webview
    • xcbglintegrations


  • @JoeCFD

    Thank you for your advice. I tried $ git clone git://code.qt.io/qt/qt5.git and $git checkout and so forth.
    At the point at make -j4 errors came, which said

    qt5/qtmultimedia/src/multimedia/qmediacontrol.cpp:136:10: fatal error: moc_qmediacontrol.cpp: No such file or directory
      136 | #include "moc_qmediacontrol.cpp"
    

    So I am doing $ https://code.qt.io/cgit/qt/qtmultimedia.git.


  • Lifetime Qt Champion

    The idea is that you look for the multimedia library and the plugins. The former should be something like libQt5Multimedia.so and you should have a subfolder named multimedia in the plugins folder.

    Note that if you do not have the GStreamer development libraries installed, you won't have much in the multimedia part.

    Did you do that from a clean state ?



  • @SGaist

    Now Qt folder has multimedia and the install done:

    $git clone https://code.qt.io/cgit/qt/qtmultimedia.git
    $cd qtmultimedia/
    $git checkout 5.15.2
    $git submodule update --init --recursive
    $cd ../qt_build
    $qmake ../qtmultimedia/qtmultimedia.pro --
    $make -j4
    $make install
    

    No error happened but still error: Qtmultimedia/QMediaPlayer: No such file or directory occured.

    Note that if you do not have the GStreamer development libraries installed, you won't have much in the multimedia part.

    No, I haven't installed GStreamer development yet...



  • @SGaist

    Did you do that from a clean state ?

    No, the Qt folder was not cleaned. Should I re install Qt creator and clone https://code.qt.io/cgit/qt/qtmultimedia.git?



  • After installation, you will be able to find this.
    5.15.2/gcc_64/include/QtMultimedia
    In the .pro file, add multimedia
    QT += core gui widgets xml multimedia



  • @JoeCFD

    Hello,

    After installation, you will be able to find this.
    5.15.2/gcc_64/include/QtMultimedia

    Yes, I can find it.

    I uninstalled Qt creator and reinstalled it. Then I did:

    $git clone https://code.qt.io/cgit/qt/qtmultimedia.git
    $cd qtmultimedia/
    $git checkout 5.15.2
    $git submodule update --init --recursive
    $cd ../qt_build
    $qmake ../qtmultimedia/qtmultimedia.pro --
    $make -j4
    $make install
    

    No error has come. I wrote

    QT += core gui widgets xml multimedia

    in .pro file and #include <Qtmultimedia/QMediaPlayer> into mainwindow.h file.
    But IDE says "Qtmultimedia/QMediaPlayer not found" and "You need to set an executable in the custom run configuration".

    What am I missing?


  • Lifetime Qt Champion

    It's QtMultimedia.

    However, the use of the module prefix recommandation has been dropped since Qt 5.0 if not before.



  • This post is deleted!


  • @SGaist
    Hello,

    I changed Qtmultimedia to QtMultimedia but it cannot find the file...



  • @nrml said in How to install submodule Qtmultimedia on Fedora?:

    QtMultimedia

    type:
    locate QtMultimedia

    to show what you see
    I have:
    /opt/thirdParties/Qt/5.15.2/gcc_64/include/QtMultimedia/5.15.2/QtMultimedia/



  • @nrml When Qt is installed, there is an option to select multimedia for installation. It is not necessary to install it separately. But now you know how to install a component which may be required in Qt6



  • @JoeCFD

    QT += core gui widgets xml multimedia

    If I add widgets xml to QT +=, at #include<QMainWindwow> and some others, errors as "Lexical or preprocessor issue" and "Parse issue" happen...

    type:
    locate QtMultimedia

    Okay, this is a result:

    /opt/Webex/qml/QtMultimedia
    /opt/Webex/qml/QtMultimedia/libdeclarative_multimedia.so
    /opt/Webex/qml/QtMultimedia/qmldir
    /var/lib/flatpak/runtime/org.fedoraproject.Platform/x86_64/f34/ca7d2818b9f0f5fb411ff4ac4a7c6bf3e0b404aa3623d674b547245c0902f10a/files/lib64/qt5/qml/QtMultimedia
    /var/lib/flatpak/runtime/org.fedoraproject.Platform/x86_64/f34/ca7d2818b9f0f5fb411ff4ac4a7c6bf3e0b404aa3623d674b547245c0902f10a/files/lib64/qt5/qml/QtMultimedia/Video.qml
    /var/lib/flatpak/runtime/org.fedoraproject.Platform/x86_64/f34/ca7d2818b9f0f5fb411ff4ac4a7c6bf3e0b404aa3623d674b547245c0902f10a/files/lib64/qt5/qml/QtMultimedia/libdeclarative_multimedia.so
    /var/lib/flatpak/runtime/org.fedoraproject.Platform/x86_64/f34/ca7d2818b9f0f5fb411ff4ac4a7c6bf3e0b404aa3623d674b547245c0902f10a/files/lib64/qt5/qml/QtMultimedia/plugins.qmltypes
    /var/lib/flatpak/runtime/org.fedoraproject.Platform/x86_64/f34/ca7d2818b9f0f5fb411ff4ac4a7c6bf3e0b404aa3623d674b547245c0902f10a/files/lib64/qt5/qml/QtMultimedia/qmldir
    

    When Qt is installed, there is an option to select multimedia for installation.

    I used an installer which is from Open Source Qt Use but there was no option to multimedia. There, however, is an option to "Additional libraries->Qt->Active Qt, Qt 3D, Qt Charts and so forth" in Maintain Qt.



  • @nrml download qt-unified-linux-x64-4.0.1-online.run from ​https://download.qt.io/official_releases/online_installers/
    use the latest one. Remove the old installation and try the new one. Install it in a location which can be found easily.
    Usually /opt is the right choice.



  • @JoeCFD

    Thank you for the link. I downloaded qt-unified-linux-x86_64-4.1.1-online.run and tried to run but there is no option to select multimedia in Select Components. I looked for it in Additional libraries, which has

    • italicised text
    • list item"Active Qt",
    • list item" Qt 3D" and so on,

    and Qt versions. Qt 6.1.0 has

    • list item"Desktop gcc 64-bit",
    • list item"Android",
    • list item"Sources"....
      Screenshot from 2021-06-04 01-54-42.png

    Also Qt 5.15.2 has some components like them. Is the multimedia included one of them?



  • @nrml this is the latest 6.0.4. Click Archives and select 5.15.2 may be 4


  • Lifetime Qt Champion

    QtMultimedia is not an optional package, it's part of the standard installation with Qt 5. For Qt 6, it shall be back for 6.2.

    If it's not there with 5.15.2, then try either with 5.15.1 or if you have a commercial license a later version.



  • @JoeCFD

    There is no Qt Multimedia package in both 5.15.2 and 5.15.1...

    0acdaabc-4198-4da9-8cdb-a809405bf461-image.png


  • Lifetime Qt Champion

    @nrml Because, as I wrote, it is part of the standard set of installed modules.



  • @SGaist

    Okay... so if I install Qt, it should be installed as default?
    Hmm... then why cannot my qt creator find the file?

    Path problem? I am installing qt in /opt directory and try run the code again once it done.



  • Once done installing Qt into /opt directory and git clone and qmake , make install and so forth, but it still says Unknown module(s) in QT: multimedia...

    What can I do anything else?



  • @nrml It is unnecessary to do git clone anymore after installation. Next step is to add qt bin and lib path in the shell.

    add the similar stuff somewhere in .bashrc
    export QT_DIR=/opt/thirdParties/Qt/5.15.2/gcc_64
    export PATH=$QT_DIR/bin:$PATH
    export LD_LIBRARY_PATH=$QT_DIR/lib:$LD_LIBRARY_PATH

    open another tab and launch your qtcreator.



  • @nrml

    I added

    export QT_DIR=/opt/Qt/5.15.2/gcc_64
    export PATH=$QT_DIR/bin:$PATH
    export LD_LIBRARY_PATH=$QT_DIR/lib:$LD_LIBRARY_PATH
    

    in .bashrc and logged out. Then launched qtcreator but the error was there...

    What I did is that I installed qtcreator in /opt/Qt/ and installed qtmultimedia which is cloned from git and qmake and so on. Then I added path above in my .bashrc.



  • @nrml PATH has to set first before clone. Actually cloning multimedia is not needed.
    in /opt/thirdParties/Qt/5.15.2/gcc_64/include, I have:
    drwxr-xr-x 3 root root 4096 Jan 12 11:29 QtKmsSupport/
    drwxr-xr-x 3 root root 4096 Jan 12 11:29 QtLinuxAccessibilitySupport/
    drwxr-xr-x 3 root root 4096 Jan 12 11:29 QtLocation/
    drwxr-xr-x 3 root root 12288 Jan 12 11:29 QtMultimedia/
    drwxr-xr-x 3 root root 4096 Jan 12 11:29 QtMultimediaGstTools/
    drwxr-xr-x 3 root root 4096 Jan 12 11:29 QtMultimediaQuick/
    drwxr-xr-x 3 root root 4096 Jan 12 11:29 QtMultimediaWidgets/
    drwxr-xr-x 3 root root 4096 Jan 12 11:29 QtNetwork/
    drwxr-xr-x 3 root root 4096 Jan 12 11:30 QtNetworkAuth/

    in /opt/thirdParties/Qt/5.15.2/gcc_64/lib, I have
    -rw-r--r-- 1 root root 1084 Jan 12 11:29 libQt5MultimediaGstTools.la
    -rw-r--r-- 1 root root 1999 Jan 12 11:29 libQt5MultimediaGstTools.prl
    lrwxrwxrwx 1 root root 34 Jan 12 11:29 libQt5MultimediaGstTools.so -> libQt5MultimediaGstTools.so.5.15.2*
    lrwxrwxrwx 1 root root 34 Jan 12 11:29 libQt5MultimediaGstTools.so.5 -> libQt5MultimediaGstTools.so.5.15.2*
    lrwxrwxrwx 1 root root 34 Jan 12 11:29 libQt5MultimediaGstTools.so.5.15 -> libQt5MultimediaGstTools.so.5.15.2*
    -rwxr-xr-x 1 root root 448160 Nov 6 2020 libQt5MultimediaGstTools.so.5.15.2*
    -rw-r--r-- 1 root root 13762056 Nov 6 2020 libQt5MultimediaGstTools.so.5.15.2.debug
    -rw-r--r-- 1 root root 773 Jan 12 11:29 libQt5Multimedia.la
    -rw-r--r-- 1 root root 1462 Jan 12 11:29 libQt5Multimedia.prl
    -rw-r--r-- 1 root root 929 Jan 12 11:29 libQt5MultimediaQuick.la
    -rw-r--r-- 1 root root 1786 Jan 12 11:29 libQt5MultimediaQuick.prl
    lrwxrwxrwx 1 root root 31 Jan 12 11:29 libQt5MultimediaQuick.so -> libQt5MultimediaQuick.so.5.15.2*
    lrwxrwxrwx 1 root root 31 Jan 12 11:29 libQt5MultimediaQuick.so.5 -> libQt5MultimediaQuick.so.5.15.2*
    lrwxrwxrwx 1 root root 31 Jan 12 11:29 libQt5MultimediaQuick.so.5.15 -> libQt5MultimediaQuick.so.5.15.2*
    -rwxr-xr-x 1 root root 175168 Nov 6 2020 libQt5MultimediaQuick.so.5.15.2*
    -rw-r--r-- 1 root root 4672384 Nov 6 2020 libQt5MultimediaQuick.so.5.15.2.debug
    lrwxrwxrwx 1 root root 26 Jan 12 11:29 libQt5Multimedia.so -> libQt5Multimedia.so.5.15.2*
    lrwxrwxrwx 1 root root 26 Jan 12 11:29 libQt5Multimedia.so.5 -> libQt5Multimedia.so.5.15.2*
    lrwxrwxrwx 1 root root 26 Jan 12 11:29 libQt5Multimedia.so.5.15 -> libQt5Multimedia.so.5.15.2*
    -rwxr-xr-x 1 root root 1421032 Nov 6 2020 libQt5Multimedia.so.5.15.2*
    -rw-r--r-- 1 root root 43392192 Nov 6 2020 libQt5Multimedia.so.5.15.2.debug
    -rw-r--r-- 1 root root 880 Jan 12 11:29 libQt5MultimediaWidgets.la
    -rw-r--r-- 1 root root 1584 Jan 12 11:29 libQt5MultimediaWidgets.prl
    lrwxrwxrwx 1 root root 33 Jan 12 11:29 libQt5MultimediaWidgets.so -> libQt5MultimediaWidgets.so.5.15.2*
    lrwxrwxrwx 1 root root 33 Jan 12 11:29 libQt5MultimediaWidgets.so.5 -> libQt5MultimediaWidgets.so.5.15.2*
    lrwxrwxrwx 1 root root 33 Jan 12 11:29 libQt5MultimediaWidgets.so.5.15 -> libQt5MultimediaWidgets.so.5.15.2*
    -rwxr-xr-x 1 root root 172184 Nov 6 2020 libQt5MultimediaWidgets.so.5.15.2*
    -rw-r--r-- 1 root root 2710760 Nov 6 2020 libQt5MultimediaWidgets.so.5.15.2.debug

    Do you have all of them?



  • @JoeCFD

    Thank you for showing your folders.
    I checked my /gcc_64/include and /gcc_64/lib. All folders and files you mentioned are in them.

    PATH has to set first before clone. Actually cloning multimedia is not needed.

    So, all I have to do was add PATH? No qmake or make install? Sorry I am a little confused...

    My qt creator's options:

    1feba256-33ac-46ff-a7ef-628bee0cb4cd-image.png

    c8ba6ce7-8c2d-4bbf-826f-7849c9b1ff59-image.png

    e7affb27-b360-4734-a2e8-f75ef023ba2d-image.png

    Are there any problems in these?


  • Lifetime Qt Champion

    Please do not modify the PATH environment variable like that for development tools.

    Beside being unnecessary, it will break as soon as you install a different Qt version and expect it to work automagically from the command line.

    As for your issue:

    • go to the terminal
    • create a dummy project there that uses QtMultimedia
    • use the full path to your Qt 5 installation's qmake to set it up
    • build from the command line

    What do you get ?

    I insist: use the full path to the qmake executable from your installation.



  • @SGaist

    Okay, so do you recommend not to edit .bashrc and to use absolute path when I make?

    What do you get ?

    I added QT += core gui multimedia line to my multimedia temp project's .pro file and #include <QtMultimedia/QMediaPlayer> to .h file. Also added a push button to play some .mp3 file into .ui file. Then from my console I did qmake, make and run.
    Wow, It worked!!
    Thank you :)

    But why does to build from Qt Creator make errors, which cannot find proper files? And this error is still there when I use qtcreator and I cannot build the project using it...



  • This post is deleted!


  • launch Qt creator ==>Tools==>Options==>Kits==>Versions
    switch to tab Kits and select 5.15.2 ( gcc_64 ) under Qt version for Kit: Desktop(click this); then click apply.
    Click Qbs==>Profiles==>ModuleProvides==>Qt==>qmakeFilePath and make sure it points to /opt/thirdParties/Qt/5.15.2/gcc_64/bin/qmake
    It will do it.

    Manual settings on Qt Versions tab can be created and deleted if qt is not automatically detected.



  • @JoeCFD

    Thanks to your advice, now my qt creator works well!!



  • @SGaist , @JoeCFD

    Thank you both @SGaist and @JoeCFD so much :)


Log in to reply