|
From: Erik L. <eri...@gm...> - 2025-03-19 20:28:57
|
Dear all, I am trying to create gnuplot executables for macOS in which the Qt libraries are statically linked. It is easy to create static versions of Qt, but I run into two problems: 1. Compilation of gnuplot on macOS relies on pkg-config, but to the best of my knowledge, pkg-config is not supported in Qt6 (if I am mistaken, I would be grateful for pointers). 2. Qt5 has support for pkg-config. A regular (dynamic) binary of gnuplot works well with Qt. However, a statically compiled version of gnuplot starts properly, but as soon as I issue the first plot command there is a warning: qt.qpa.plugin: Could not find the Qt platform plugin "cocoa" in "" If I restart gnuplot after setting "export QT_DEBUG_PLUGINS=1", I get: FactoryLoader::QFactoryLoader() ignoring "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3" since plugins are disabled in static builds As far as I can tell, the qtterminal source code should have a Q_IMPORT_PLUGIN() command to work properly with static compilation, but I do not know enough about Qt to be sure. Any help would be appreciated! Erik |
|
From: Ethan A M. <me...@uw...> - 2025-03-19 21:27:51
|
On Wednesday, 19 March 2025 13:28:24 PDT Erik Luijten wrote:
> Dear all,
>
> I am trying to create gnuplot executables for macOS in which the Qt
> libraries are statically linked. It is easy to create static versions of
> Qt, but I run into two problems:
>
>
> 1. Compilation of gnuplot on macOS relies on pkg-config, but to the best
> of my knowledge, pkg-config is not supported in Qt6 (if I am mistaken, I
> would be grateful for pointers).
I use pkg-config with Qt6 without problems.
I am aware of two past pkg-config +Qt6 related issues on the linux side.
(1) Fedora breaks down the Qt6 dependencies differently, so we needed to add a
check in the configure script that picked them all up. That change is in 6.0.1
https://sourceforge.net/p/gnuplot/bugs/2705/
(2) There was an Ubuntu packaging error that failed in include the pkg-config files
*.pc in the initial Ubuntu Qt6 packages, and this failure propagated to ubuntu
derivatives like Mint. I confirmed at the time that (at least on Mint)
it was sufficient to regenerate the *.pc files directly from the Qt repository or
to copy them, after inspection, from another linux distro. That problem was
acknowledged upstream by Unbuntu, but I have not tracked the resolution since then.
Here is a link to one message in the thread exploring this
https://sourceforge.net/p/gnuplot/mailman/message/58773575/
I don't know why a Fedora or Ubuntu glitch would affect macOS, but perhaps there was
a parallel failure with the same result.
>
>
> 2. Qt5 has support for pkg-config. A regular (dynamic) binary of gnuplot
> works well with Qt. However, a statically compiled version of gnuplot
> starts properly, but as soon as I issue the first plot command there is a
> warning:
>
> qt.qpa.plugin: Could not find the Qt platform plugin "cocoa" in ""
I can't help you here. I believe that Cocoa is one of several possible graphics
backends for Qt on macOS, but if you switch to one of the others you may well
just get the equivalent warning for that new backend.
Ethan
>
>
> If I restart gnuplot after setting "export QT_DEBUG_PLUGINS=1", I get:
>
> FactoryLoader::QFactoryLoader() ignoring
> "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3" since
> plugins are disabled in static builds
>
>
> As far as I can tell, the qtterminal source code should have a
> Q_IMPORT_PLUGIN() command to work properly with static compilation, but I
> do not know enough about Qt to be sure.
>
>
> Any help would be appreciated!
>
> Erik
>
|
|
From: Dima K. <gn...@di...> - 2025-03-19 22:09:57
|
You don't NEED pkg-config. All it does is give you some compiler flags
and linker flags. You can set those flags yourself, at least until the
pkg-config breakage is resolved. On my box (Debian/sid) I see this:
dima@shorty:~/projects/gnuplot$ for p (Qt6Core Qt6Gui Qt6Network Qt6Svg Qt6PrintSupport Qt6Widgets Qt6Core5Compat) { pkg-config --cflags $p }
-I/usr/include/x86_64-linux-gnu/qt6/QtCore -I/usr/include/x86_64-linux-gnu/qt6 -DQT_CORE_LIB -I/usr/lib/x86_64-linux-gnu/qt6/mkspecs/linux-g++
-I/usr/include/x86_64-linux-gnu/qt6/QtGui -I/usr/include/x86_64-linux-gnu/qt6 -DQT_GUI_LIB -I/usr/include/x86_64-linux-gnu/qt6/QtCore -DQT_CORE_LIB -I/usr/lib/x86_64-linux-gnu/qt6/mkspecs/linux-g++
-I/usr/include/x86_64-linux-gnu/qt6/QtNetwork -I/usr/include/x86_64-linux-gnu/qt6 -DQT_NETWORK_LIB -I/usr/include/x86_64-linux-gnu/qt6/QtCore -DQT_CORE_LIB -I/usr/lib/x86_64-linux-gnu/qt6/mkspecs/linux-g++
-I/usr/include/x86_64-linux-gnu/qt6/QtSvg -I/usr/include/x86_64-linux-gnu/qt6 -DQT_SVG_LIB -I/usr/include/x86_64-linux-gnu/qt6/QtCore -I/usr/lib/x86_64-linux-gnu/qt6/mkspecs/linux-g++ -I/usr/include/x86_64-linux-gnu/qt6/QtGui -DQT_GUI_LIB -DQT_CORE_LIB
-I/usr/include/x86_64-linux-gnu/qt6/QtPrintSupport -I/usr/include/x86_64-linux-gnu/qt6 -DQT_PRINTSUPPORT_LIB -I/usr/include/x86_64-linux-gnu/qt6/QtCore -I/usr/lib/x86_64-linux-gnu/qt6/mkspecs/linux-g++ -I/usr/include/x86_64-linux-gnu/qt6/QtGui -I/usr/include/x86_64-linux-gnu/qt6/QtWidgets -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB
-I/usr/include/x86_64-linux-gnu/qt6/QtWidgets -I/usr/include/x86_64-linux-gnu/qt6 -DQT_WIDGETS_LIB -I/usr/include/x86_64-linux-gnu/qt6/QtCore -I/usr/lib/x86_64-linux-gnu/qt6/mkspecs/linux-g++ -I/usr/include/x86_64-linux-gnu/qt6/QtGui -DQT_GUI_LIB -DQT_CORE_LIB
-I/usr/include/x86_64-linux-gnu/qt6/QtCore5Compat -I/usr/include/x86_64-linux-gnu/qt6 -DQT_CORE5COMPAT_LIB -I/usr/include/x86_64-linux-gnu/qt6/QtCore -DQT_CORE_LIB -I/usr/lib/x86_64-linux-gnu/qt6/mkspecs/linux-g++
dima@shorty:~/projects/gnuplot$ for p (Qt6Core Qt6Gui Qt6Network Qt6Svg Qt6PrintSupport Qt6Widgets Qt6Core5Compat) { pkg-config --libs $p }
-lQt6Core
-lQt6Gui -lQt6Core
-lQt6Network -lQt6Core
-lQt6Svg -lQt6Gui -lQt6Core
-lQt6PrintSupport -lQt6Widgets -lQt6Gui -lQt6Core
-lQt6Widgets -lQt6Gui -lQt6Core
-lQt6Core5Compat -lQt6Core
So you can try to feed in the equivalent for your box.
|
|
From: Erik L. <eri...@gm...> - 2025-03-19 22:11:14
|
Hi, I did solve the second problem, I believe. In src/qtterminal/gnuplot_qt.cpp, immediately prior to the line QtGnuplotApplication application(argc, argv); one needs the line: Q_IMPORT_PLUGIN(QCocoaIntegrationPlugin); As far as I can tell, other platforms would need a similar line if one wishes to build a static binary. For Qt6, the list is here: https://doc.qt.io/qt-6/qpa.html Erik On Wed, Mar 19, 2025 at 3:28 PM Erik Luijten <eri...@gm...> wrote: > Dear all, > > I am trying to create gnuplot executables for macOS in which the Qt > libraries are statically linked. It is easy to create static versions of > Qt, but I run into two problems: > > > 1. Compilation of gnuplot on macOS relies on pkg-config, but to the best > of my knowledge, pkg-config is not supported in Qt6 (if I am mistaken, I > would be grateful for pointers). > > > 2. Qt5 has support for pkg-config. A regular (dynamic) binary of gnuplot > works well with Qt. However, a statically compiled version of gnuplot > starts properly, but as soon as I issue the first plot command there is a > warning: > > qt.qpa.plugin: Could not find the Qt platform plugin "cocoa" in "" > > > > If I restart gnuplot after setting "export QT_DEBUG_PLUGINS=1", I get: > > FactoryLoader::QFactoryLoader() ignoring > "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3" since > plugins are disabled in static builds > > > As far as I can tell, the qtterminal source code should have a > Q_IMPORT_PLUGIN() command to work properly with static compilation, but I > do not know enough about Qt to be sure. > > > Any help would be appreciated! > > Erik > |