Skip to content

headless doesn't compile on macOS/Windows #3825

Description

@dtinth

Describe the bug

I was experimenting with building a smoke test suite (#2428). My coding agent noticed that right now, CONFIG+=headless is Linux-only and fails to build

To Reproduce

Try to build Jamulus with CONFIG+=headless on macOS/Windows. Build commands used:

macOS:

qmake Jamulus.pro CONFIG+=headless QMAKE_APPLE_DEVICE_ARCHS=arm64
make -j3

Windows:

qmake Jamulus.pro CONFIG+=headless CONFIG+=jackonwindows "CONFIG-=debug_and_release" "CONFIG+=release"
nmake

Expected behavior

It compiles.

Actual behavior

macOS:

../src/sound/coreaudio-mac/sound.h:53:10: fatal error: 'QMessageBox' file not found
   53 | #include <QMessageBox>
1 error generated.

Windows:

..\src\main.cpp(912): error C2027: use of undefined type 'QApplication'
C:\Qt\6.10.2\msvc2022_64\include\QtCore/qobject.h(380): note: see declaration of 'QApplication'
..\src\main.cpp(912): error C3861: 'applicationDirPath': identifier not found

Screenshots

See the GitHub Actions run logmacOS job and Windows job

macOS:

Image

Windows:

Image

Operating system

GitHub Actions runners, building from source:

  • macos-15 (Apple Silicon, Xcode 16.3.0, Qt 6.10.2)
  • windows-latest (MSVC 2022, Qt 6.10.2)

Version of Jamulus

Built from source at current main (49f4f8d, reports 3.12.2dev).

Additional context

These issues have one-line fixes.

macOS:

diff --git a/src/sound/coreaudio-mac/sound.h b/src/sound/coreaudio-mac/sound.h
index 9ee27965..970c6371 100644
--- a/src/sound/coreaudio-mac/sound.h
+++ b/src/sound/coreaudio-mac/sound.h
@@ -50,7 +50,6 @@
 #include <AudioToolbox/AudioToolbox.h>
 #include <CoreMIDI/CoreMIDI.h>
 #include <QMutex>
-#include <QMessageBox>
 #include "../soundbase.h"
 #include "../../global.h"

Windows:

diff --git a/src/main.cpp b/src/main.cpp
index a518c2e5..7bca23fb 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -909,7 +909,7 @@ int main ( int argc, char** argv )
     // For accessible support we need to add a plugin to qt. The plugin has to
     // be located in the install directory of the software by the installer.
     // Here, we set the path to our application path.
-    QDir ApplDir ( QApplication::applicationDirPath() );
+    QDir ApplDir ( QCoreApplication::applicationDirPath() );
     pApp->addLibraryPath ( QString ( ApplDir.absolutePath() ) );
 #endif

My agent has a fix branch prepared. Please let me know if you would like a PR opened, or you can open it yourself here: https://github.com/jamulussoftware/jamulus/compare/main...dtinth:jamulus:fix/headless-macos-windows?expand=1

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    Status
    Triage

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions