How to correctly build Qt 6.9.1 from source on macOS with imageformat and style plugins?
-
What @SGaist said, plus add a
-prefix
flag toconfigure
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.
-
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? -
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 ?
-
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 ?
@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. -
If you want help use an out of source build with a clean build directory...
-
If you want help use an out of source build with a clean build directory...
@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.
-
Please: Out of source build
-
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. -
-
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.@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.
-
@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.
@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!