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. How to correctly build Qt 6.9.1 from source on macOS with imageformat and style plugins?
Qt 6.11 is out! See what's new in the release blog

How to correctly build Qt 6.9.1 from source on macOS with imageformat and style plugins?

Scheduled Pinned Locked Moved Solved General and Desktop
16 Posts 4 Posters 4.3k Views 1 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.
  • Christian EhrlicherC Christian Ehrlicher

    Please start over with a clean source dir and an out of source build. Also post the output of the configure call.

    K Offline
    K Offline
    Kevin Hoang
    wrote on last edited by Kevin Hoang
    #3

    @Christian-Ehrlicher Thank you for your reply.

    I have downloaded a fresh copy of the Qt 6.9.1 sources and tried to run ./configure again, but the output is only the following:

    ./configure -feature-imageformat_png -feature-imageformat_jpeg -feature-imageformatplugin -submodules qtimageformats -opensource -confirm-license -debug
    + /qt-everywhere-src-6.9.2/qtbase/configure -top-level -feature-imageformat_png -feature-imageformat_jpeg -feature-imageformatplugin -opensource -confirm-license -debug -submodules qtimageformats -- -DBUILD_qtimageformats=ON
    '/usr/local/bin/cmake' '-DQT_BUILD_SUBMODULES=qtimageformats' '-DBUILD_qtimageformats=ON' '-DQT_INTERNAL_CALLED_FROM_CONFIGURE:BOOL=TRUE' '-DFEATURE_imageformat_png=ON' '-DFEATURE_imageformat_jpeg=ON' '-DFEATURE_imageformatplugin=ON' '-DCMAKE_BUILD_TYPE=Debug' '-G' 'Ninja' '/qt-everywhere-src-6.9.2'
    -- The CXX compiler identification is AppleClang 17.0.0.17000013
    -- The C compiler identification is AppleClang 17.0.0.17000013
    -- Detecting CXX compiler ABI info
    -- Detecting CXX compiler ABI info - done
    -- Check for working CXX compiler: /usr/bin/c++ - skipped
    -- Detecting CXX compile features
    -- Detecting CXX compile features - done
    -- Detecting C compiler ABI info
    -- Detecting C compiler ABI info - done
    -- Check for working C compiler: /usr/bin/cc - skipped
    -- Detecting C compile features
    -- Detecting C compile features - done
    -- The ASM compiler identification is AppleClang
    -- Found assembler: /usr/bin/cc
    -- Checking dependencies of submodule 'qtbase'
    -- Checking dependencies of submodule 'qtimageformats'
    -- Configuring submodule 'qtbase'
    -- [QtBase] CMAKE_BUILD_TYPE was already explicitly set to: 'Debug'
    -- Configuring submodule 'qtimageformats'
    
    -- Configuration summary has been written to /qt-everywhere-src-6.9.2/config.summary
    
    -- 
    
    Qt is now configured for building. Just run 'cmake --build . --parallel'
    
    Once everything is built, you must run 'cmake --install .'
    Qt will be installed into '/usr/local/Qt-6.9.2'
    
    To configure and build other Qt modules, you can use the following convenience script:
            /usr/local/Qt-6.9.2/bin/qt-configure-module
    
    If reconfiguration fails for some reason, try removing 'CMakeCache.txt' from the build directory
    Alternatively, you can add the --fresh flag to your CMake flags.
    
    -- Configuring done (50.7s)
    -- Generating done (1.8s)
    -- Build files have been written to: /qt-everywhere-src-6.9.2
    

    It seems my ./configure command is not correct.
    Could you please provide me with an example of the correct configure command line for building Qt 6.9.1 on macOS (with imageformat and style plugins enabled)?

    Thanks in advance!

    1 Reply Last reply
    0
    • I Offline
      I Offline
      IgKh
      wrote on last edited by
      #4

      It does not appear you are doing an out-of-source build, which is very important. And the flags seems off - were they suggested by an AI assistant?

      Carefully read the instructions for building on macOS: https://doc.qt.io/qt-6/macos-building.html

      Also note that unless you are doing a developer's build from Git, you need to install your build results to the configured prefix to be able to use the Qt you built in an application.

      K 1 Reply Last reply
      1
      • I IgKh

        It does not appear you are doing an out-of-source build, which is very important. And the flags seems off - were they suggested by an AI assistant?

        Carefully read the instructions for building on macOS: https://doc.qt.io/qt-6/macos-building.html

        Also note that unless you are doing a developer's build from Git, you need to install your build results to the configured prefix to be able to use the Qt you built in an application.

        K Offline
        K Offline
        Kevin Hoang
        wrote on last edited by
        #5

        @IgKh Thank you for your feedback.

        I followed the instructions from the README that comes with the source package, but after building, I still cannot get any style or image plugins loaded (also, I specifically want a debug build).

        The official Qt documentation also does not provide a clear description of how to specify configuration options in detail. I did try to consult an AI assistant, but as you guessed, it did not really understand Qt’s build system.

        The options I used: -feature-imageformat_png, -feature-imageformatplugin, -submodules qtimageformats were based on the output of ./configure -list-features and ./configure --help, not AI. However, these flags also don’t seem to work as expected.

        So my question is:
        👉 Could you please provide me with a typical example configure (or cmake) command for building Qt Core + Gui + Widgets (with debug mode) on macOS?

        That would help me a lot to get started in the right direction.

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by SGaist
          #6

          Hi,
          Based on experience as well as the macOS Documentation

          mkdir -p ~/dev/Qt-build
          cd ~/dev/Qt-build
          /path/to/QtSources/configure -submodules qtbase qtimageformats -debug
          cmake --build . --parallel
          cmake --install .
          

          If you want to debug or try some things, you can do a developer build. That way you don't need to re-install Qt every time you try something. Don't use a developer build for building a production version of your application.

          I also would not recommend altering the PATH environment variable. Just use the full path to the tools you want to use so you ensure you are using the exact version of Qt you actually want to use.

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          1
          • I Offline
            I Offline
            IgKh
            wrote on last edited by IgKh
            #7

            What @SGaist said, plus add a -prefix flag to configure with a path to somewhere in your User directory, so you won't install your build system-wide.

            Specifically, after configuring look at the file it tells you (config.summary). It should have a section like:

            Qt Gui:
              Accessibility .......................... yes
              Emoji Segmenter ........................ yes
              FreeType ............................... yes
                Using system FreeType ................ no
              HarfBuzz ............................... yes
                Using system HarfBuzz ................ no
              Fontconfig ............................. no
              Image formats:
                GIF .................................. yes
                ICO .................................. yes
                JPEG ................................. yes
                  Using system libjpeg ............... no
                PNG .................................. yes
                  Using system libpng ................ no
            

            If it says "yes" for the image formats you care about, you are good to go - but again, you won't see the plugin files until you install the build into the prefix you set.

            1 Reply Last reply
            0
            • K Offline
              K Offline
              Kevin Hoang
              wrote on last edited by
              #8

              I started over as suggested. I placed the Qt 6.9.2 source folder under my User directory on another macOS. Then I ran the following two commands:

              ./configure -submodules qtbase,qtimageformats -debug -prefix ../qt6-sdk
              cmake build . -DCMAKE_CXX_FLAGS="-Wno-error=unused-but-set-variable"
              

              But the output is only:

              ./configure -submodules qtbase,qtimageformats -debug -prefix ../qt6-sdk
              + /Users/kevin/Projects/qt-everywhere-src-6.9.2/qtbase/configure -top-level -debug -prefix ../qt6-sdk -submodules qtbase,qtimageformats -- -DBUILD_qtbase=ON -DBUILD_qtimageformats=ON
              '/usr/local/bin/cmake' '-DQT_BUILD_SUBMODULES=qtbase;qtimageformats' '-DBUILD_qtbase=ON' '-DBUILD_qtimageformats=ON' '-DQT_INTERNAL_CALLED_FROM_CONFIGURE:BOOL=TRUE' '-DCMAKE_INSTALL_PREFIX=../qt6-sdk' '-DCMAKE_BUILD_TYPE=Debug' '-G' 'Ninja' '/Users/kevin/Projects/qt-everywhere-src-6.9.2'
              -- The CXX compiler identification is AppleClang 17.0.0.17000013
              -- The C compiler identification is AppleClang 17.0.0.17000013
              -- Detecting CXX compiler ABI info
              -- Detecting CXX compiler ABI info - done
              -- Check for working CXX compiler: /usr/bin/c++ - skipped
              -- Detecting CXX compile features
              -- Detecting CXX compile features - done
              -- Detecting C compiler ABI info
              -- Detecting C compiler ABI info - done
              -- Check for working C compiler: /usr/bin/cc - skipped
              -- Detecting C compile features
              -- Detecting C compile features - done
              -- The ASM compiler identification is AppleClang
              -- Found assembler: /usr/bin/cc
              -- Checking dependencies of submodule 'qtbase'
              -- Checking dependencies of submodule 'qtimageformats'
              -- Configuring submodule 'qtbase'
              -- [QtBase] CMAKE_BUILD_TYPE was already explicitly set to: 'Debug'
              -- Configuring submodule 'qtimageformats'
              
              -- Configuration summary has been written to /Users/kevin/Projects/qt-everywhere-src-6.9.2/config.summary
              
              -- 
              
              Qt is now configured for building. Just run 'cmake --build . --parallel'
              
              Once everything is built, you must run 'cmake --install .'
              Qt will be installed into '/Users/kevin/Projects/qt6-sdk'
              
              To configure and build other Qt modules, you can use the following convenience script:
                      /Users/kevin/Projects/qt6-sdk/bin/qt-configure-module
              
              If reconfiguration fails for some reason, try removing 'CMakeCache.txt' from the build directory
              Alternatively, you can add the --fresh flag to your CMake flags.
              
              -- Configuring done (49.2s)
              -- Generating done (1.9s)
              -- Build files have been written to: /Users/kevin/Projects/qt-everywhere-src-6.9.2
              
              cmake build . -DCMAKE_CXX_FLAGS="-Wno-error=unused-but-set-variable"   
              -- Checking dependencies of submodule 'qtbase'
              -- Checking dependencies of submodule 'qtimageformats'
              -- Configuring submodule 'qtbase'
              -- [QtBase] CMAKE_BUILD_TYPE was already explicitly set to: 'Debug'
              -- Configuring submodule 'qtimageformats'
              
              -- Configuration summary has been written to /Users/kevin/Projects/qt-everywhere-src-6.9.2/config.summary
              
              -- Configuring done (19.7s)
              -- Generating done (1.8s)
              -- Build files have been written to: /Users/kevin/Projects/qt-everywhere-src-6.9.2
              

              My config.summary looks like this:

              Building for: macx-clang (x86_64, CPU features: cx16 sse3 ssse3 sse4.1)
              Compiler: clang (Apple) 17.0.0.17000013
              Build options:
                Mode ................................... debug
                Fully optimize release builds (-O3) .... no
                Building shared libraries (alias of  BUILD_SHARED_LIBS)  yes
                Using ccache ........................... no
                Unity Build ............................ no
                Relocatable ............................ yes
                Using precompiled headers .............. yes
                Using Link Time Optimization (LTCG) .... no
                Using Intel Control-flow Enforcement Technology (CET)  yes
                Using Glibc function fortification ..... no
                Using -ftrivial-auto-var-init=pattern .. yes
                Using -fstack-protector-strong ......... yes
                Using -fstack-clash-protection ......... no
                Using libstdc++ assertions ............. no
                Using libc++ hardening ................. yes
                Using -z relro -z now when linking ..... no
                Target compiler supports:
                  x86 Intrinsics ....................... Basic VAES AVX512VBMI2
                Sanitizers:
                  Addresses ............................ no
                  Threads .............................. no
                  Memory ............................... no
                  Fuzzer (instrumentation only) ........ no
                  Undefined ............................ no
                Build parts ............................ libs tools
                Install examples sources ............... no
                App store compliance ................... no
              Qt modules and options:
                Qt Concurrent .......................... yes
                Qt D-Bus ............................... yes
                Qt D-Bus directly linked to libdbus .... no
                Qt Gui ................................. yes
                Qt Network ............................. yes
                Qt PrintSupport ........................ yes
                Qt Sql ................................. yes
                Qt Testlib ............................. yes
                Qt Widgets ............................. yes
                Qt Xml ................................. yes
              Support enabled for:
                Using pkg-config ....................... no
                Using vcpkg ............................ no
                udev ................................... no
                OpenSSL ................................ no
                  Qt directly linked to OpenSSL ........ no
                OpenSSL 1.1 ............................ no
                OpenSSL 3.0 ............................ no
                Using system zlib ...................... yes
                Zstandard support ...................... no
                Thread support ......................... yes
              Common build options:
                Linker can resolve circular dependencies  yes
              Qt Core:
                backtrace .............................. yes
                C++23 <stacktrace> ..................... no
                DoubleConversion ....................... yes
                  Using system DoubleConversion ........ no
                GLib ................................... no
                ICU .................................... no
                std::chrono::tzdb QTZ backend .......... no
                Using system libb2 ..................... no
                Built-in copy of the MIME database ..... yes
                Application permissions ................ yes
                Defaulting legacy IPC to POSIX ......... no
                Tracing backend ........................ <none>
                OpenSSL based cryptographic hash ....... no
                Logging backends:
                  journald ............................. no
                  syslog ............................... no
                  slog2 ................................ no
                PCRE2 .................................. yes
                  Using system PCRE2 ................... no
              Qt Sql:
                SQL item models ........................ yes
              Qt Network:
                getifaddrs() ........................... yes
                IPv6 ifname ............................ yes
                libproxy ............................... no
                SecureTransport ........................ yes
                DTLS ................................... no
                OCSP-stapling .......................... no
                SCTP ................................... no
                Use system proxies ..................... yes
                GSSAPI ................................. yes
                Brotli Decompression Support ........... no
                qIsEffectiveTLD() ...................... yes
                  Built-in publicsuffix database ....... yes
                  System publicsuffix database ......... no
              Core tools:
                Android deployment tool ................ yes
                macOS deployment tool .................. yes
                Windows deployment tool ................ no
                qmake .................................. yes
              Qt Gui:
                Accessibility .......................... yes
                Emoji Segmenter ........................ yes
                FreeType ............................... yes
                  Using system FreeType ................ no
                HarfBuzz ............................... yes
                  Using system HarfBuzz ................ no
                Fontconfig ............................. no
                Image formats:
                  GIF .................................. yes
                  ICO .................................. yes
                  JPEG ................................. yes
                    Using system libjpeg ............... no
                  PNG .................................. yes
                    Using system libpng ................ no
                Text formats:
                  HtmlParser ........................... yes
                  CssParser ............................ yes
                  OdfWriter ............................ yes
                  MarkdownReader ....................... yes
                    Using system libmd4c ............... no
                  MarkdownWriter ....................... yes
                EGL .................................... no
                OpenVG ................................. no
                OpenGL:
                  Desktop OpenGL ....................... yes
                  OpenGL ES 2.0 ........................ no
                  OpenGL ES 3.0 ........................ no
                  OpenGL ES 3.1 ........................ no
                  OpenGL ES 3.2 ........................ no
                Vulkan ................................. no
                Metal .................................. yes
                QGraphicsFrameCapture .................. yes
                Session Management ..................... yes
                Multi-threaded image and painting helpers  yes
              Features used by QPA backends:
                evdev .................................. no
                libinput ............................... no
                HiRes wheel support in libinput ........ no
                INTEGRITY HID .......................... no
                mtdev .................................. no
                tslib .................................. no
                xkbcommon .............................. no
                vxworksevdev ........................... no
                X11 specific:
                  XLib ................................. no
                  XCB Xlib ............................. no
                  EGL on X11 ........................... no
                  xkbcommon-x11 ........................ no
                  xcb-sm ............................... no
              QPA backends:
                DirectFB ............................... no
                EGLFS .................................. no
                EGLFS details:
                  EGLFS OpenWFD ........................ no
                  EGLFS i.Mx6 .......................... no
                  EGLFS i.Mx6 Wayland .................. no
                  EGLFS RCAR ........................... no
                  EGLFS EGLDevice ...................... no
                  EGLFS GBM ............................ no
                  EGLFS VSP2 ........................... no
                  EGLFS Mali ........................... no
                  EGLFS Raspberry Pi ................... no
                  EGLFS X11 ............................ no
                LinuxFB ................................ no
                VNC .................................... no
                VK_KHR_display ......................... no
                QNX:
                  lgmon ................................ no
                  IMF .................................. no
                XCB:
                  Using system-provided xcb-xinput ..... no
                  GL integrations:
                    GLX Plugin ......................... no
                      XCB GLX .......................... no
                    EGL-X11 Plugin ..................... no
                Windows:
                  Direct 2D ............................ no
                  Direct 2D 1.1 ........................ no
                  DirectWrite .......................... no
                  DirectWrite 3 ........................ no
                  DirectWrite COLRv1 Support ........... no
              Qt Widgets:
                GTK+ ................................... no
                Styles ................................. Fusion macOS Windows
              Qt Testlib:
                Tester for item models ................. yes
                Batch tests ............................ no
              Qt PrintSupport:
                CUPS ................................... yes
              Qt Sql Drivers:
                DB2 (IBM) .............................. no
                InterBase .............................. no
                MySql .................................. no
                OCI (Oracle) ........................... no
                ODBC ................................... no
                PostgreSQL ............................. no
                SQLite ................................. yes
                  Using system provided SQLite ......... no
                Mimer .................................. no
              Further Image Formats:
                JasPer ................................. no
                MNG .................................... no
                TIFF ................................... yes
                  Using system libtiff ................. no
                WEBP ................................... yes
                  Using system libwebp ................. no
              

              However, no files are actually built afterwards.
              Do you know what I might be missing here?

              1 Reply Last reply
              0
              • SGaistS Offline
                SGaistS Offline
                SGaist
                Lifetime Qt Champion
                wrote on last edited by
                #9

                You did not call cmake --install . after the build.

                On a side note, do you realize that several people wrote that you should do out of source builds but you persist not to follow that suggestion ?

                Interested in AI ? www.idiap.ch
                Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                K 1 Reply Last reply
                0
                • SGaistS SGaist

                  You did not call cmake --install . after the build.

                  On a side note, do you realize that several people wrote that you should do out of source builds but you persist not to follow that suggestion ?

                  K Offline
                  K Offline
                  Kevin Hoang
                  wrote on last edited by
                  #10

                  @SGaist I also tried running cmake --install . but it does not work. The output is:

                  cmake --install .                                                      
                  -- Install configuration: "Debug"
                  -- Installing: /Users/kevin/Projects/qt6-sdk/lib/cmake/Qt6BuildInternals/Qt6BuildInternalsConfig.cmake
                  -- Installing: /Users/kevin/Projects/qt6-sdk/lib/cmake/Qt6BuildInternals/Qt6BuildInternalsConfigVersion.cmake
                  -- Installing: /Users/kevin/Projects/qt6-sdk/lib/cmake/Qt6BuildInternals/Qt6BuildInternalsConfigVersionImpl.cmake
                  -- Installing: /Users/kevin/Projects/qt6-sdk/lib/cmake/Qt6BuildInternals/QtBuildInternalsExtra.cmake
                  -- Installing: /Users/kevin/Projects/qt6-sdk/lib/cmake/Qt6BuildInternals/QtStandaloneTestTemplateProject
                  -- Installing: /Users/kevin/Projects/qt6-sdk/lib/cmake/Qt6BuildInternals/QtStandaloneTestTemplateProject/CMakeLists.txt
                  -- Installing: /Users/kevin/Projects/qt6-sdk/lib/cmake/Qt6BuildInternals/QtStandaloneTestTemplateProject/Main.cmake
                  -- Installing: /Users/kevin/Projects/qt6-sdk/lib/cmake/Qt6/qt.toolchain.cmake
                  -- Installing: /Users/kevin/Projects/qt6-sdk/mkspecs/qconfig.pri
                  CMake Error at qtbase/cmake_install.cmake:62 (file):
                    file INSTALL cannot find
                    "/Users/kevin/Projects/qt-everywhere-src-6.9.2/qtbase/mkspecs/qmodule.pri":
                    No such file or directory.
                  Call Stack (most recent call first):
                    cmake_install.cmake:42 (include)
                  

                  From the output of cmake --build . above, you can also see that no files are actually built at all.

                  1 Reply Last reply
                  0
                  • Christian EhrlicherC Offline
                    Christian EhrlicherC Offline
                    Christian Ehrlicher
                    Lifetime Qt Champion
                    wrote on last edited by
                    #11

                    If you want help use an out of source build with a clean build directory...

                    Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
                    Visit the Qt Academy at https://academy.qt.io/catalog

                    K 1 Reply Last reply
                    0
                    • Christian EhrlicherC Christian Ehrlicher

                      If you want help use an out of source build with a clean build directory...

                      K Offline
                      K Offline
                      Kevin Hoang
                      wrote on last edited by
                      #12

                      @Christian-Ehrlicher I deleted the old qt-everywhere-src-6.9.2 folder, extracted a fresh copy, and the qt6-sdk folder is also empty.

                      I don’t understand why it is not working anymore.

                      1 Reply Last reply
                      0
                      • SGaistS Offline
                        SGaistS Offline
                        SGaist
                        Lifetime Qt Champion
                        wrote on last edited by SGaist
                        #13

                        Please: Out of source build

                        Interested in AI ? www.idiap.ch
                        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                        1 Reply Last reply
                        0
                        • K Offline
                          K Offline
                          Kevin Hoang
                          wrote on last edited by
                          #14

                          Thanks for your help, I finally managed to build Qt 6.9.2 successfully. 🙏
                          The problem was that I was trying to build inside the source folder instead of doing an out-of-source build.

                          SGaistS 1 Reply Last reply
                          0
                          • K Kevin Hoang has marked this topic as solved on
                          • K Kevin Hoang

                            Thanks for your help, I finally managed to build Qt 6.9.2 successfully. 🙏
                            The problem was that I was trying to build inside the source folder instead of doing an out-of-source build.

                            SGaistS Offline
                            SGaistS Offline
                            SGaist
                            Lifetime Qt Champion
                            wrote on last edited by
                            #15

                            @Kevin-Hoang said in How to correctly build Qt 6.9.1 from source on macOS with imageformat and style plugins?:

                            Thanks for your help, I finally managed to build Qt 6.9.2 successfully. 🙏
                            The problem was that I was trying to build inside the source folder instead of doing an out-of-source build.

                            Please, next time listen to people answering you. We told you five times to do an out of source build beside the documentation also showing that.

                            Interested in AI ? www.idiap.ch
                            Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                            K 1 Reply Last reply
                            0
                            • SGaistS SGaist

                              @Kevin-Hoang said in How to correctly build Qt 6.9.1 from source on macOS with imageformat and style plugins?:

                              Thanks for your help, I finally managed to build Qt 6.9.2 successfully. 🙏
                              The problem was that I was trying to build inside the source folder instead of doing an out-of-source build.

                              Please, next time listen to people answering you. We told you five times to do an out of source build beside the documentation also showing that.

                              K Offline
                              K Offline
                              Kevin Hoang
                              wrote on last edited by
                              #16

                              @SGaist Sorry about that 🙂. To be honest, I was busy with another project, so I wasn’t fully focused, and since this wasn’t my main target, I overlooked the instructions. 🙏

                              Now it’s clear to me, and I managed to build successfully. Thanks again for pointing me in the right direction!

                              1 Reply Last reply
                              0

                              • Login

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