Fix headless builds on macOS and Windows#3826
Open
dtinth wants to merge 3 commits into
Open
Conversation
The include is not referenced anywhere in src/sound/coreaudio-mac/ and breaks CONFIG+=headless builds on macOS, where the widgets module is not available. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HGdLtGxMrbExBFG3aReNAH
The #ifdef _WIN32 block runs in headless builds too, but <QApplication> is only included when HEADLESS is not defined, so headless Windows builds fail to compile. applicationDirPath() is a static inherited from QCoreApplication, so this is behavior-neutral in GUI builds. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HGdLtGxMrbExBFG3aReNAH
A third headless-on-macOS gap, found once the sound.h fix let the headless build reach the link stage: main.cpp calls qt_set_sequence_auto_mnemonic() unconditionally on Q_OS_MACOS, but the symbol only resolves when QtWidgets is linked -- so a plain CONFIG+=headless build fails at link time with "symbol(s) not found for architecture arm64". Menu-accelerator mnemonics are meaningless without a GUI, so gate both the extern declaration and the call site behind !defined(HEADLESS) as well. mac/activity.h and the CActivity app-nap-prevention machinery stay unconditional for macOS -- headless servers/clients still want nap prevention, only the mnemonic bits are GUI-only. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HGdLtGxMrbExBFG3aReNAH
There was a problem hiding this comment.
Pull request overview
This PR fixes CONFIG+=headless builds on macOS and Windows by removing/guarding GUI-only Qt usage so headless targets compile and link consistently across platforms.
Changes:
- Removed an unnecessary
QMessageBoxinclude from the macOS CoreAudio sound header to avoid QtWidgets dependency in headless builds. - Guarded macOS mnemonic-key enabling (
qt_set_sequence_auto_mnemonic) so it’s not referenced in headless builds. - Switched Windows
applicationDirPath()usage fromQApplicationtoQCoreApplicationso headless builds don’t requireQApplication.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| src/sound/coreaudio-mac/sound.h | Drops a QtWidgets header include that breaks headless compilation on macOS. |
| src/main.cpp | Avoids QtWidgets-only symbols/types in headless builds on macOS/Windows. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
ann0see
reviewed
Jul 23, 2026
ann0see
reviewed
Jul 23, 2026
ann0see
left a comment
Member
There was a problem hiding this comment.
macOS works fine. Needed to compile it twice - probably it didn't create qrc_qmake_qmake_qm_files.cpp first, but not part of this PR...
error: Build input file cannot be found: '/private/tmp/jamulus/qrc_qmake_qmake_qm_files.cpp'. Did you forget to declare this file as an output of a script phase or custom build rule which produces it? (in target 'Jamulus' from project 'Jamulus')
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Short description of changes
Three one-line fixes so that
CONFIG+=headlesscompiles (and links) on macOS and Windows, as it already does on Linux.CHANGELOG: Build: Fixed headless builds (
CONFIG+=headless) not compiling on macOS and Windows.Context: Fixes an issue?
Fixes: #3825
Does this change need documentation? What needs to be documented and how?
No.
Status of this Pull Request
Working implementation, CI-verified..
What is missing until this pull request can be merged?
Nothing known.
fatal error: 'QMessageBox' file not found, thenUndefined symbols … qt_set_sequence_auto_mnemonic(bool)error C2027: use of undefined type 'QApplication'Checklist
AUTOBUILD: Please build all targets