Skip to content

Fix AppImage packaging when linuxdeploy-plugin-qt picks a Qt 5 qmake#1037

Open
saberoueslati wants to merge 3 commits intodail8859:masterfrom
saberoueslati:fix/appimage-qt6-qmake-detection
Open

Fix AppImage packaging when linuxdeploy-plugin-qt picks a Qt 5 qmake#1037
saberoueslati wants to merge 3 commits intodail8859:masterfrom
saberoueslati:fix/appimage-qt6-qmake-detection

Conversation

@saberoueslati
Copy link
Copy Markdown
Contributor

Closes #1036

Summary

This fixes the Linux AppImage packaging step for environments where both Qt 5 and Qt 6 tooling are installed.

linuxdeploy-plugin-qt can auto-detect /usr/bin/qmake, which may point to Qt 5 even though NotepadNext is built with Qt 6. In that case, the AppImage build can fail with:

ERROR: Could not find Qt modules to deploy

What changed

  • Added a helper function in cmake/PackagingLinux.cmake to resolve a Qt 6-compatible qmake
  • Checked the imported Qt6::qmake CMake target first when it is available
  • Added fallback lookup for common Qt 6 executable names such as qmake6 and qmake-qt6
  • Validated each candidate with qmake -query QT_VERSION
  • Exported QMAKE=... to the AppImage packaging step only when the selected binary is confirmed to be Qt 6
  • Kept the existing packaging flow unchanged when no Qt 6 qmake can be resolved

@dail8859
Copy link
Copy Markdown
Owner

dail8859 commented May 2, 2026

Thanks for the PR.

I would assume building this on a system with both Qt5 and Qt6 installed isn't very common (I could be wrong) so is there a simpler solution to this maybe?

Maybe instead of finding qmake6...if there's some way to just detect this issue and then have cmake abort and print some message to tell the user to set the QMAKE variable? E.g. (untested)

QMAKE=$(which qmake6) cmake ...

@saberoueslati
Copy link
Copy Markdown
Contributor Author

@dail8859 I'll work on it later this evening

@saberoueslati
Copy link
Copy Markdown
Contributor Author

@dail8859 I simplified as asked, now if a QT version different than 6 is detected first, the following message is produced :

cmake -S . -B build \
    -G Ninja \
    -DCMAKE_BUILD_TYPE=Release \
    -DAPP_DISTRIBUTION=AppImage
-- The CXX compiler identification is GNU 13.3.0
-- 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
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE  
-- Performing Test HAVE_STDATOMIC
-- Performing Test HAVE_STDATOMIC - Success
-- Found WrapAtomic: TRUE  
-- Found OpenGL: /usr/lib/x86_64-linux-gnu/libOpenGL.so   
-- Found WrapOpenGL: TRUE  
-- Found XKB: /usr/lib/x86_64-linux-gnu/libxkbcommon.so (found suitable version "1.6.0", minimum required is "0.5.0") 
-- Found WrapVulkanHeaders: /usr/include  
-- Found Git: /usr/bin/git (found version "2.43.0") 
-- CPM: Adding package ads@0 (34b68d6eab1556cf851d24e033909332771f3dfe at /home/saber/coding/NotepadNext/.cpm-cache/ads/9c5e)
-- CPM: Adding package QSimpleUpdater@0 (8e7017f7fbdc2b4b1a26ed1eef9ebcba6a50639c at /home/saber/coding/NotepadNext/.cpm-cache/qsimpleupdater/37ff)
-- CPM: Adding package SingleApplication@0 (494772e98cef0aa88124f154feb575cc60b08b38 at /home/saber/coding/NotepadNext/.cpm-cache/singleapplication/91c3)
-- CPM: Adding package editorconfig_core_qt@0 (ab62f0554abf2bbe4d45427b36a8b2f81ca7b4ab at /home/saber/coding/NotepadNext/.cpm-cache/editorconfig_core_qt/87f1)
-- The C compiler identification is GNU 13.3.0
-- 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
-- Configuring Linux packaging
CMake Error at cmake/PackagingLinux.cmake:36 (message):
  AppImage packaging requires a Qt 6 qmake, but CMake found:

    /usr/bin/qmake

  Reported Qt version:

    5.15.13

  Please set the QMAKE variable to a Qt 6 qmake and re-run CMake, for
  example:

    QMAKE=$(which qmake6) cmake -S . -B build -DAPP_DISTRIBUTION=AppImage
Call Stack (most recent call first):
  cmake/Packaging.cmake:10 (include)
  CMakeLists.txt:50 (include)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

AppImage build on Linux can fail when linuxdeploy-plugin-qt picks a Qt 5 qmake instead of Qt 6

2 participants