Homebrew / homebrew-core

🍻 Default formulae for the missing package manager for macOS (or Linux)
https://brew.sh
BSD 2-Clause "Simplified" License
13.77k stars 12.45k forks source link

audacious doesn't install Qt with its cocoa plugin #158675

Closed martin-braun closed 10 months ago

martin-braun commented 10 months ago

brew gist-logs <formula> link OR brew config AND brew doctor output

`> ( brew config && brew doctor ) > brew.log 2>&1`:

https://gist.github.com/martin-braun/7fb17aa7a2d4a4a010a4af0ef037ea95

Verification

What were you trying to do (and why)?

brew install audacious which depends on qt and installs successfully, and then launching it.

What happened (include all command output)?

> audacious
WARNING ../src/coreaudio/coreaudio.cc:270 [set_device_samplerate]: Preparing the "Amiron wireless" for bit perfect output (this can take a moment)
                                                                  2024-01-01 05:20:48.993 audacious[50955:839983] Using audio device 164 "Amiron wireless", 2 sample rates in 2 range(s); [16000,44100] (
                                             16000,
                                                       44100
                                                            ); current sample rate 44100Hz
          qt.qpa.plugin: Could not load the Qt platform plugin "cocoa" in "" even though it was found.
                      This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.

                                                                             Available platform plugins are: offscreen, minimal, cocoa.

                                                       zsh: abort      audacious

What did you expect to happen?

The program should launch.

Step-by-step reproduction instructions (by running brew commands)

brew install audacious
audacious

Additional comments

I asked for help at the GitHub of the creator: https://github.com/orgs/audacious-media-player/discussions/82 - you can find my attempt to solve this issue in my comment. I think the formulae needs to be fixed, unfortunately, I don't know how I can fix it on my own.

Any help is appreciated.

cho-m commented 10 months ago

I can't reproduce this on Sonoma.

Can you retry with export QT_DEBUG_PLUGINS=1 to get some more logs?

martin-braun commented 10 months ago

@cho-m Sure:

ERROR ../src/libaudcore/plugin-load.cc:70 [plugin_load]: /usr/local/lib/audacious/Input/ffaudio.dylib could not be loaded: dlopen(/usr/local/lib/audacious/Input/ffaudio.dylib, 0x0002): Library not loaded: /usr/local/opt/jpeg-xl/lib/libjxl.0.8.dylib
  Referenced from: <7899DD65-5FCF-39AB-A934-5108684120DE> /usr/local/Cellar/ffmpeg/6.0_2/lib/libavcodec.60.3.100.dylib
  Reason: tried: '/usr/local/opt/jpeg-xl/lib/libjxl.0.8.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/usr/local/opt/jpeg-xl/lib/libjxl.0.8.dylib' (no such file), '/usr/local/opt/jpeg-xl/lib/libjxl.0.8.dylib' (no such file), '/usr/local/lib/libjxl.0.8.dylib' (no such file), '/usr/lib/libjxl.0.8.dylib' (no such file, not in dyld cache), '/usr/local/Cellar/jpeg-xl/0.9.0/lib/libjxl.0.8.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/usr/local/Cellar/jpeg-xl/0.9.0/lib/libjxl.0.8.dylib' (no such file), '/usr/local/Cellar/jpeg-xl/0.9.0/lib/libjxl.0.8.dylib' (no such file), '/usr/local/lib/libjxl.0.8.dylib' (no such file), '/usr/lib/libjxl.0.8.dylib' (no such file, not in dyld cache)Library not loaded: /usr/local/opt/jpeg-xl/lib/libjxl.0.8.dylib
  Referenced from: <21DD91DC-2025-3367-8F84-ADADB1C417CD> /usr/local/Cellar/ffmpeg/6.0_2/lib/libavformat.60.3.100.dylib
  Reason: tried: '/usr/local/opt/jpeg-xl/lib/libjxl.0.8.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/usr/local/opt/jpeg-xl/lib/libjxl.0.8.dylib' (no such file), '/usr/local/opt/jpeg-xl/lib/libjxl.0.8.dylib' (no such file), '/usr/local/lib/libjxl.0.8.dylib' (no such file), '/usr/lib/libjxl.0.8.dylib' (no such file, not in dyld cache), '/usr/local/Cellar/jpeg-xl/0.9.0/lib/libjxl.0.8.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/usr/local/Cellar/jpeg-xl/0.9.0/lib/libjxl.0.8.dylib' (no such file), '/usr/local/Cellar/jpeg-xl/0.9.0/lib/libjxl.0.8.dylib' (no such file), '/usr/local/lib/libjxl.0.8.dylib' (no such file), '/usr/lib/libjxl.0.8.dylib' (no such file, not in dyld cache)
WARNING ../src/coreaudio/coreaudio.cc:270 [set_device_samplerate]: Preparing the "W-KING D9" for bit perfect output (this can take a moment)
2024-01-10 17:34:48.011 audacious[36288:1063424] Using audio device 164 "W-KING D9", 2 sample rates in 2 range(s); [8000,44100] (
    8000,
    44100
); current sample rate 44100Hz
qt.core.plugin.factoryloader: checking directory path "/Library/Application Support/UPDD/qt6/platforms" ...
qt.core.plugin.factoryloader: looking at "/Library/Application Support/UPDD/qt6/platforms/libqoffscreen.dylib"
qt.core.plugin.loader: Found metadata in lib /Library/Application Support/UPDD/qt6/platforms/libqoffscreen.dylib, metadata=
{
    "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
    "MetaData": {
        "Keys": [
            "offscreen"
        ]
    },
    "archlevel": 0,
    "className": "QOffscreenIntegrationPlugin",
    "debug": false,
    "version": 393728
}

qt.core.plugin.factoryloader: Got keys from plugin meta data QList("offscreen")
qt.core.plugin.factoryloader: looking at "/Library/Application Support/UPDD/qt6/platforms/libqminimal.dylib"
qt.core.plugin.loader: Found metadata in lib /Library/Application Support/UPDD/qt6/platforms/libqminimal.dylib, metadata=
{
    "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
    "MetaData": {
        "Keys": [
            "minimal"
        ]
    },
    "archlevel": 0,
    "className": "QMinimalIntegrationPlugin",
    "debug": false,
    "version": 393728
}

qt.core.plugin.factoryloader: Got keys from plugin meta data QList("minimal")
qt.core.plugin.factoryloader: looking at "/Library/Application Support/UPDD/qt6/platforms/libqcocoa.dylib"
qt.core.plugin.loader: Found metadata in lib /Library/Application Support/UPDD/qt6/platforms/libqcocoa.dylib, metadata=
{
    "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
    "MetaData": {
        "Keys": [
            "cocoa"
        ]
    },
    "archlevel": 0,
    "className": "QCocoaIntegrationPlugin",
    "debug": false,
    "version": 393728
}

qt.core.plugin.factoryloader: Got keys from plugin meta data QList("cocoa")
qt.core.plugin.factoryloader: checking directory path "/usr/local/Cellar/audacious/4.3.1/bin/platforms" ...
qt.core.library: "/Library/Application Support/UPDD/qt6/platforms/libqcocoa.dylib" cannot load: Cannot load library /Library/Application Support/UPDD/qt6/platforms/libqcocoa.dylib: (dlopen(/Library/Application Support/UPDD/qt6/platforms/libqcocoa.dylib, 0x0085): Symbol not found: __ZN21QPlatformBackingStore15composeAndFlushEP7QWindowRK7QRegionRK6QPointP20QPlatformTextureListb
  Referenced from: <A4C141EB-CA10-395D-8B6E-156FE9D9C9DC> /Library/Application Support/UPDD/qt6/platforms/libqcocoa.dylib
  Expected in:     <A9B81754-DD4A-3926-88FD-4A7CCF53383C> /usr/local/Cellar/qt/6.6.1/lib/QtGui.framework/Versions/A/QtGui)
qt.core.plugin.loader: QLibraryPrivate::loadPlugin failed on "/Library/Application Support/UPDD/qt6/platforms/libqcocoa.dylib" : "Cannot load library /Library/Application Support/UPDD/qt6/platforms/libqcocoa.dylib: (dlopen(/Library/Application Support/UPDD/qt6/platforms/libqcocoa.dylib, 0x0085): Symbol not found: __ZN21QPlatformBackingStore15composeAndFlushEP7QWindowRK7QRegionRK6QPointP20QPlatformTextureListb\n  Referenced from: <A4C141EB-CA10-395D-8B6E-156FE9D9C9DC> /Library/Application Support/UPDD/qt6/platforms/libqcocoa.dylib\n  Expected in:     <A9B81754-DD4A-3926-88FD-4A7CCF53383C> /usr/local/Cellar/qt/6.6.1/lib/QtGui.framework/Versions/A/QtGui)"
qt.qpa.plugin: Could not load the Qt platform plugin "cocoa" in "" even though it was found.
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.

Available platform plugins are: offscreen, minimal, cocoa.

zsh: abort      audacious

Now this is helpful. It seems to interfere with UPDD, which is a touch screen display driver that seems to be using Qt for their UI. But, echo $QT_QPA_PLATFORM_PLUGIN_PATH still outputs /usr/local/Cellar/qt/6.6.1/share/qt/plugins.

How can I fix those paths for audacious? What a mess.

cho-m commented 10 months ago

The wrong libqcocoa.dylib is being picked up. It needs to use $HOMEBREW_PREFIX/share/qt/plugins/platforms/libqcocoa.dylib not the one from UPDD.

Do you have something in your env adding UPDD paths?

Not sure, but it doesn't seem like UPDD would be a default path:

qt.core.plugin.factoryloader: checking directory path "/Library/Application Support/UPDD/qt6/platforms" ...
martin-braun commented 10 months ago

@cho-m This is very confusing to me as env | grep UPDD returns nothing for me, env | grep qt only returns QT_QPA_PLATFORM_PLUGIN_PATH=/usr/local/Cellar/qt/6.6.1/share/qt/plugins. I then have been patient enough to run grep -lr "Support/UPDD/qt6" / -s to find anything that points to that path on my system. Excluding redundant things in /System/Volumes/Data my output was:

/Library/Application Support/UPDD/bootstrap/UPDD Install.app/Contents/MacOS/UPDD Install
/Library/Application Support/UPDD/bootstrap/UPDD Install.app/Contents/Resources/qt.conf
/Library/Application Support/UPDD/bootstrap/qt.conf
/Library/Application Support/UPDD/UPDD Uninstall.app/Contents/MacOS/UPDD Uninstall
/Library/Application Support/UPDD/UPDD Uninstall.app/Contents/Resources/qt.conf
/Library/Application Support/UPDD/qt.conf
/Library/Application Support/UPDD/updd.app/Contents/MacOS/updd
/Library/Application Support/UPDD/updd.app/Contents/Resources/qt.conf
/Library/Application Support/UPDD/UPDD Commander.app/Contents/MacOS/UPDD Commander UI Element Tool
/Library/Application Support/UPDD/UPDD Commander.app/Contents/MacOS/UPDD Commander
/Library/Application Support/UPDD/UPDD Commander.app/Contents/Resources/qt.conf
/Library/Application Support/UPDD/libupddapi.7.0.0.dylib
/Library/Application Support/UPDD/upddutils.app/Contents/MacOS/upddutils
/Library/Application Support/UPDD/upddutils.app/Contents/Resources/qt.conf
/Library/Application Support/UPDD/UPDD Daemon.app/Contents/MacOS/UPDD Daemon
/Library/Application Support/UPDD/UPDD Daemon.app/Contents/Resources/qt.conf

So the configuration is self-contained. /Library/Application Support/UPDD/updd.app/Contents/Resources/qt.conf contains

[Paths]
Plugins=/Library/Application Support/UPDD/qt6

and UPDD is running in the background. So my guess is, it defines the Qt path making other applications that rely on Qt fail. UPDD is the culprit, but I'm not willing to agree that the Qt framework cannot be used by multiple applications with multiple versions.

UPDD should isolate the usage of Qt, but I'm not an expert when it comes to Qt. What would be the correct approach in this situation? Why can't the path to Qt not defined for a single application. QT_QPA_PLATFORM_PLUGIN_PATH looks to be the right approach, but it's not working. :/

cho-m commented 10 months ago

Sadly, not too sure why that path is being picked up. Maybe someone who is familiar with Qt plugin loader logic can help.

You could try increasing logging to see if anything useful is output, e.g.

QT_LOGGING_DEBUG=1 QT_LOGGING_RULES="*.debug=true" audacious

It sounds like Qt default paths should be used unless qt.conf is provided https://github.com/qt/qtbase/blob/6.4.2/src/corelib/kernel/qcoreapplication.cpp#L2675-L2680

    Qt provides default library paths, but they can also be set using
    a \l{Using qt.conf}{qt.conf} file. Paths specified in this file
    will override default values. Note that if the qt.conf file is in
    the directory of the application executable, it may not be found
    until a QCoreApplication is created. If it is not found when calling
    this function, the default library paths will be used.

However, it doesn't seem like UPDD's path should be picked up automatically - https://doc.qt.io/qt-6/qt-conf.html. Though audacious isn't an app bundle, so I don't know how the qt.conf lookup logic here behaves.

martin-braun commented 10 months ago

You could try increasing logging to see if anything useful is output, e.g.

QT_LOGGING_DEBUG=1 QT_LOGGING_RULES="*.debug=true" audacious
WARNING ../src/coreaudio/coreaudio.cc:270 [set_device_samplerate]: Preparing the "MacBook Pro Speakers" for bit perfect output (this can take a moment)
2024-01-19 21:56:44.575 audacious[74658:592811] Using audio device 145 "MacBook Pro Speakers", 4 sample rates in 4 range(s); [44100,96000] (
    44100,
    48000,
    88200,
    96000
); current sample rate 44100Hz
qt.highdpi: Initializing high-DPI scaling
qt.highdpi: Initialization done, high-DPI scaling is active
qt.qpa.plugin: init_platform called with pluginNamesWithArguments "cocoa" platformPluginPath "/usr/local/Cellar/qt/6.6.1/share/qt/plugins" platformThemeName ""
qt.core.plugin.factoryloader: checking directory path "/Library/Application Support/UPDD/qt6/platforms" ...
qt.core.plugin.factoryloader: looking at "/Library/Application Support/UPDD/qt6/platforms/libqoffscreen.dylib"
qt.core.plugin.loader: Found metadata in lib /Library/Application Support/UPDD/qt6/platforms/libqoffscreen.dylib, metadata=
{
    "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
    "MetaData": {
        "Keys": [
            "offscreen"
        ]
    },
    "archlevel": 0,
    "className": "QOffscreenIntegrationPlugin",
    "debug": false,
    "version": 393728
}

qt.core.plugin.factoryloader: Got keys from plugin meta data QList("offscreen")
qt.core.plugin.factoryloader: looking at "/Library/Application Support/UPDD/qt6/platforms/libqminimal.dylib"
qt.core.plugin.loader: Found metadata in lib /Library/Application Support/UPDD/qt6/platforms/libqminimal.dylib, metadata=
{
    "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
    "MetaData": {
        "Keys": [
            "minimal"
        ]
    },
    "archlevel": 0,
    "className": "QMinimalIntegrationPlugin",
    "debug": false,
    "version": 393728
}

qt.core.plugin.factoryloader: Got keys from plugin meta data QList("minimal")
qt.core.plugin.factoryloader: looking at "/Library/Application Support/UPDD/qt6/platforms/libqcocoa.dylib"
qt.core.plugin.loader: Found metadata in lib /Library/Application Support/UPDD/qt6/platforms/libqcocoa.dylib, metadata=
{
    "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
    "MetaData": {
        "Keys": [
            "cocoa"
        ]
    },
    "archlevel": 0,
    "className": "QCocoaIntegrationPlugin",
    "debug": false,
    "version": 393728
}

qt.core.plugin.factoryloader: Got keys from plugin meta data QList("cocoa")
qt.core.plugin.factoryloader: checking directory path "/usr/local/Cellar/audacious/4.3.1/bin/platforms" ...
qt.core.plugin.factoryloader: checking directory path "/usr/local/Cellar/qt/6.6.1/share/qt/plugins" ...
qt.qpa.plugin: Attempting to load Qt platform plugin "cocoa" with arguments QList()
qt.core.library: "/Library/Application Support/UPDD/qt6/platforms/libqcocoa.dylib" cannot load: Cannot load library /Library/Application Support/UPDD/qt6/platforms/libqcocoa.dylib: (dlopen(/Library/Application Support/UPDD/qt6/platforms/libqcocoa.dylib, 0x0085): Symbol not found: __ZN21QPlatformBackingStore15composeAndFlushEP7QWindowRK7QRegionRK6QPointP20QPlatformTextureListb
  Referenced from: <A4C141EB-CA10-395D-8B6E-156FE9D9C9DC> /Library/Application Support/UPDD/qt6/platforms/libqcocoa.dylib
  Expected in:     <A9B81754-DD4A-3926-88FD-4A7CCF53383C> /usr/local/Cellar/qt/6.6.1/lib/QtGui.framework/Versions/A/QtGui)
qt.core.plugin.loader: QLibraryPrivate::loadPlugin failed on "/Library/Application Support/UPDD/qt6/platforms/libqcocoa.dylib" : "Cannot load library /Library/Application Support/UPDD/qt6/platforms/libqcocoa.dylib: (dlopen(/Library/Application Support/UPDD/qt6/platforms/libqcocoa.dylib, 0x0085): Symbol not found: __ZN21QPlatformBackingStore15composeAndFlushEP7QWindowRK7QRegionRK6QPointP20QPlatformTextureListb\n  Referenced from: <A4C141EB-CA10-395D-8B6E-156FE9D9C9DC> /Library/Application Support/UPDD/qt6/platforms/libqcocoa.dylib\n  Expected in:     <A9B81754-DD4A-3926-88FD-4A7CCF53383C> /usr/local/Cellar/qt/6.6.1/lib/QtGui.framework/Versions/A/QtGui)"
qt.qpa.plugin: Could not load the Qt platform plugin "cocoa" in "/usr/local/Cellar/qt/6.6.1/share/qt/plugins" even though it was found.
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.

Available platform plugins are: offscreen, minimal, cocoa.

zsh: abort      QT_LOGGING_DEBUG=1 QT_LOGGING_RULES="*.debug=true" audacious

Though audacious isn't an app bundle, so I don't know how the qt.conf lookup logic here behaves.

Me neither, and honestly .... I don't like to give up, but I have not the time to deal with this, especially since I managed to work around my codec problem. In case I deal with Qt in general again, I could look into this in detail.

Other than that, I close this for now, unless others respond here having the issue as well.