Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Use forked QtMultimedia with Qt 6.2.3
Forum Updated to NodeBB v4.3 + New Features

Use forked QtMultimedia with Qt 6.2.3

Scheduled Pinned Locked Moved Solved General and Desktop
4 Posts 2 Posters 958 Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    paulmasri
    wrote on last edited by
    #1

    I want to see if I can adapt QAudioSink (from QtMultimedia) to allow me to run it in a separate thread. (Why? See here.)

    To this end, I have created a fork of QtMultimedia and cloned it.
    I also have Qt 6.2.3 installed (via Maintenance Tool) without the QtMultimedia module.
    And I have a simple application that uses QAudioSink.

    What steps do I need to take to get these working with each other?

    1 Reply Last reply
    0
    • P Offline
      P Offline
      paulmasri
      wrote on last edited by
      #4

      I have now managed to get QtMultimedia to build and install. For future reference, here are the steps that worked for me:

      1. Update XCode (via App Store)
      2. Ensure command-line tools are installed. You can do this by opening terminal and entering gcc. This starts the C++ compiler without any arguments. If the tools are not installed, it should prompt for installation. If they are, you'll just get an error: no input files. (In my case I had a conflict between multiple versions of various tools, which was solved by resetting XCode to use its default ones: sudo xcode-select -r)
      3. Install Conan (C++ package manager). I did this using Homebrew (brew install conan) which placed it at /opt/homebrew/Cellar/conan/1.45.0.
      4. Add the Conan plugin to Qt Creator. According to the Setting up Conan page, within Qt Creator, go to Qt Creator > About plugins... and find Utilities > Conan. Tick 'Load' and Close which forces a restart.
      5. This ought to have done the job but I kept getting errors. I solved this by manually injecting the Conan path into the Qt Creator ini file. On my system, this is at ~/Qt/Qt\ Creator.app/Contents/Resources/QtProject/QtCreator.ini. See snippet below.
      6. Set up Conan remote following the instructions in Using Conan for Qt6 paying particular attention to 'Conan configuration' and 'Connecting to Conan remote' and 'Build profiles' section. For the latter I updated it for Qt 6.2.3: conan install qtbuildprofiles/6.2.3@qt/everywhere --update -r qt.
      7. Ensure Ninja is installed via MaintenanceTool.
      8. The build process looks for MacOSX11.1.sdk and gave a warning that it failed to find it because I have MacOSX12.1.sdk installed. I tried providing MacOSX11.1.sdk by downloading from https://github.com/phracker/MacOSX-SDKs and (sudo) copying the folder MacOSX11.1.sdk into /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs. Although this removed the warning, I ended up with a link error (see below). Instead what worked for me was to find where the error message was generated and hack the file so that it would use the current SDK. See the edit to ~/Qt/Tools/CMake/CMake.app/Contents/share/cmake-3.21/Modules/Platform/Darwin-Initialize.cmake below. The warning still gets output but the problem is solved.
      9. Build in Qt Creator.
      10. At the command line run cmake --install .

      The only thing to note is that this links against MacOS 12.1 instead of the intended 11.1 and results in a linker warning when it is used. However I haven't encountered any issues as a result of this.

      I appreciate that this is not the right solution, but one that did the job for me.

      Edit to QtCreator.ini

      I added

      [ConanPlugin]
      ConanFilePath=/opt/homebrew/Cellar/conan/1.45.0/bin/conan
      

      because the make file looks for ConanFilePath=

      Edit to Darwin-Initialize.cmake

      In the first macro, macro(qtc_auto_setup_conan), there is the error message command

            message(WARNING "Ignoring CMAKE_OSX_SYSROOT value:\n ${CMAKE_OSX_SYSROOT}\n"
              "because the directory does not exist.")
      

      Immediately following this, I replaced

            set(CMAKE_OSX_SYSROOT "")
      

      with

            set(CMAKE_OSX_SYSROOT "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk")
      

      Attempting to use MacOSX11.1.sdk

      In step 8 above, I tried installing MacOSX11.1.sdk. This is the error that resulted:

      [ 86%] Linking CXX shared library ../../lib/QtMultimedia.framework/QtMultimedia
      ' in YAML file '/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.1.sdk/System/Library/Frameworks//CoreAudio.framework/CoreAudio.tbd' for architecture arm64
      clang: error: linker command failed with exit code 1 (use -v to see invocation)
      make[2]: *** [lib/QtMultimedia.framework/Versions/A/QtMultimedia] Error 1
      make[1]: *** [src/multimedia/CMakeFiles/Multimedia.dir/all] Error 2
      make: *** [all] Error 2
      
      1 Reply Last reply
      2
      • P Offline
        P Offline
        paulmasri
        wrote on last edited by
        #2

        Whether right or not, the steps I have taken are:

        1. In qtmultimedia repo, checkout branch 6.2.3.
          This avoids CMake error attempting to find Qt 6.4.0 (required by dev branch).
        2. In Maintenance Tool, install Qt Shader Tools.
          This avoids CMake error too.
        3. In Qt Creator, open qtmultimedia/CMakeLists.txt
        4. Configure project for MacOS desktop (my dev platform)
          I tried Debug configuration but got the error:
          No "Debug" CMake configuration found. Available configuration: "RelWithDebInfo". Make sure that CMAKE_BUILD_TYPE variable matches the "Build type" field.
          So I switched to 'Release with debug information' configuration and the project configured correctly although with the warning:
          Qt Creator: conan executable not found. Package manager auto-setup will be skipped. To disable this warning set QT_CREATOR_SKIP_CONAN_SETUP to ON.
          I ignored this warning.
        5. In Qt Creator, build.
          This was successful, though with a number of warnings. A few were clang warnings about unused arguments, e.g.
          clang: warning: argument unused during compilation: '-msse2' [-Wunused-command-line-argument]
          and the rest were about deprecated functions for MacOS, e.g.
          'AVCaptureStillImageOutput' is deprecated: first deprecated in macOS 10.15 - Use AVCapturePhotoOutput instead. [-Wdeprecated-declarations]
        6. On command line, in the build folder, I ran cmake --install .
          This installed many items but failed with the following error:
          CMake Error at src/multimedia/cmake_install.cmake:127 (file): file INSTALL cannot find "/Users/me/Code/build-qtmultimedia-Qt_6_2_3_for_macOS-RelWithDebInfo/mkspecs/modules/qt_lib_multimedia_private.pri": No such file or directory. Call Stack (most recent call first): src/cmake_install.cmake:42 (include) cmake_install.cmake:42 (include)

        Is this my mistake or an issue with the code in this branch?

        (If I've understood right, that final step should have installed QtMultimedia so that I can use it in a project as if I'd installed it via the Maintenance Tool.)

        1 Reply Last reply
        0
        • kshegunovK Offline
          kshegunovK Offline
          kshegunov
          Moderators
          wrote on last edited by
          #3

          This used to be easy with Qt5, but I honestly don't know how it works with Qt6. I haven't tried it. Perhaps is worth asking on the mailing list, where people that actually develop Qt can answer/give advice.

          Read and abide by the Qt Code of Conduct

          1 Reply Last reply
          0
          • P Offline
            P Offline
            paulmasri
            wrote on last edited by
            #4

            I have now managed to get QtMultimedia to build and install. For future reference, here are the steps that worked for me:

            1. Update XCode (via App Store)
            2. Ensure command-line tools are installed. You can do this by opening terminal and entering gcc. This starts the C++ compiler without any arguments. If the tools are not installed, it should prompt for installation. If they are, you'll just get an error: no input files. (In my case I had a conflict between multiple versions of various tools, which was solved by resetting XCode to use its default ones: sudo xcode-select -r)
            3. Install Conan (C++ package manager). I did this using Homebrew (brew install conan) which placed it at /opt/homebrew/Cellar/conan/1.45.0.
            4. Add the Conan plugin to Qt Creator. According to the Setting up Conan page, within Qt Creator, go to Qt Creator > About plugins... and find Utilities > Conan. Tick 'Load' and Close which forces a restart.
            5. This ought to have done the job but I kept getting errors. I solved this by manually injecting the Conan path into the Qt Creator ini file. On my system, this is at ~/Qt/Qt\ Creator.app/Contents/Resources/QtProject/QtCreator.ini. See snippet below.
            6. Set up Conan remote following the instructions in Using Conan for Qt6 paying particular attention to 'Conan configuration' and 'Connecting to Conan remote' and 'Build profiles' section. For the latter I updated it for Qt 6.2.3: conan install qtbuildprofiles/6.2.3@qt/everywhere --update -r qt.
            7. Ensure Ninja is installed via MaintenanceTool.
            8. The build process looks for MacOSX11.1.sdk and gave a warning that it failed to find it because I have MacOSX12.1.sdk installed. I tried providing MacOSX11.1.sdk by downloading from https://github.com/phracker/MacOSX-SDKs and (sudo) copying the folder MacOSX11.1.sdk into /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs. Although this removed the warning, I ended up with a link error (see below). Instead what worked for me was to find where the error message was generated and hack the file so that it would use the current SDK. See the edit to ~/Qt/Tools/CMake/CMake.app/Contents/share/cmake-3.21/Modules/Platform/Darwin-Initialize.cmake below. The warning still gets output but the problem is solved.
            9. Build in Qt Creator.
            10. At the command line run cmake --install .

            The only thing to note is that this links against MacOS 12.1 instead of the intended 11.1 and results in a linker warning when it is used. However I haven't encountered any issues as a result of this.

            I appreciate that this is not the right solution, but one that did the job for me.

            Edit to QtCreator.ini

            I added

            [ConanPlugin]
            ConanFilePath=/opt/homebrew/Cellar/conan/1.45.0/bin/conan
            

            because the make file looks for ConanFilePath=

            Edit to Darwin-Initialize.cmake

            In the first macro, macro(qtc_auto_setup_conan), there is the error message command

                  message(WARNING "Ignoring CMAKE_OSX_SYSROOT value:\n ${CMAKE_OSX_SYSROOT}\n"
                    "because the directory does not exist.")
            

            Immediately following this, I replaced

                  set(CMAKE_OSX_SYSROOT "")
            

            with

                  set(CMAKE_OSX_SYSROOT "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk")
            

            Attempting to use MacOSX11.1.sdk

            In step 8 above, I tried installing MacOSX11.1.sdk. This is the error that resulted:

            [ 86%] Linking CXX shared library ../../lib/QtMultimedia.framework/QtMultimedia
            ' in YAML file '/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.1.sdk/System/Library/Frameworks//CoreAudio.framework/CoreAudio.tbd' for architecture arm64
            clang: error: linker command failed with exit code 1 (use -v to see invocation)
            make[2]: *** [lib/QtMultimedia.framework/Versions/A/QtMultimedia] Error 1
            make[1]: *** [src/multimedia/CMakeFiles/Multimedia.dir/all] Error 2
            make: *** [all] Error 2
            
            1 Reply Last reply
            2

            • Login

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved