Re: Static compilation with Qt

Erik Luijten <[email protected]> Wed, 19 Mar 2025 17:10:40 -0500
Newsgroups gmane.comp.graphics.gnuplot.devel
Message-ID <CAM4Pt-8MmjMbVVkGu0TQ0_gwFOc3R4i3xj_3-V10xYmaFj1JvQ@mail.gmail.com>
--===============5501610732417596182==
Content-Type: multipart/alternative; boundary="0000000000005c634f0630b94bc5"

--0000000000005c634f0630b94bc5
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

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=E2=80=AFPM Erik Luijten <[email protected]=
m> 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=3D1", 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
>

--0000000000005c634f0630b94bc5
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div dir=3D"ltr">Hi, I did solve the second problem, I bel=
ieve. In src/qtterminal/gnuplot_qt.cpp, immediately prior to the line=C2=A0





<p class=3D"gmail-p1" style=3D"margin:0px;font-variant-numeric:normal;font-=
variant-east-asian:normal;font-variant-alternates:normal;font-size-adjust:n=
one;font-kerning:auto;font-feature-settings:normal;font-stretch:normal;font=
-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)"><span cla=
ss=3D"gmail-s1" style=3D"font-variant-ligatures:no-common-ligatures"><br></=
span></p><p class=3D"gmail-p1" style=3D"margin:0px;font-variant-numeric:nor=
mal;font-variant-east-asian:normal;font-variant-alternates:normal;font-size=
-adjust:none;font-kerning:auto;font-feature-settings:normal;font-stretch:no=
rmal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)">=
<span class=3D"gmail-s1" style=3D"font-variant-ligatures:no-common-ligature=
s">QtGnuplotApplication application(argc, argv);</span></p></div><div class=
=3D"gmail_quote gmail_quote_container"><div class=3D"gmail_attr"><br></div>=
<div class=3D"gmail_attr">one needs the line:</div><div class=3D"gmail_attr=
"><br></div><div class=3D"gmail_attr">





<p class=3D"gmail-p1" style=3D"margin:0px;font-variant-numeric:normal;font-=
variant-east-asian:normal;font-variant-alternates:normal;font-size-adjust:n=
one;font-kerning:auto;font-feature-settings:normal;font-stretch:normal;font=
-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)"><span cla=
ss=3D"gmail-s1" style=3D"font-variant-ligatures:no-common-ligatures">Q_IMPO=
RT_PLUGIN(QCocoaIntegrationPlugin);</span></p><p class=3D"gmail-p1" style=
=3D"margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;f=
ont-variant-alternates:normal;font-size-adjust:none;font-kerning:auto;font-=
feature-settings:normal;font-stretch:normal;font-size:11px;line-height:norm=
al;font-family:Menlo;color:rgb(0,0,0)"><br></p><p class=3D"gmail-p1" style=
=3D"margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;f=
ont-variant-alternates:normal;font-size-adjust:none;font-kerning:auto;font-=
feature-settings:normal;font-stretch:normal;font-size:11px;line-height:norm=
al;font-family:Menlo;color:rgb(0,0,0)"><br></p></div><div class=3D"gmail_at=
tr">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:=C2=A0<a href=3D=
"https://doc.qt.io/qt-6/qpa.html">https://doc.qt.io/qt-6/qpa.html</a></div>=
<div class=3D"gmail_attr"><br></div><div class=3D"gmail_attr">Erik</div><di=
v class=3D"gmail_attr"><br></div><div class=3D"gmail_attr"><br></div><div d=
ir=3D"ltr" class=3D"gmail_attr">On Wed, Mar 19, 2025 at 3:28=E2=80=AFPM Eri=
k Luijten &lt;<a href=3D"mailto:[email protected]">erik.luijten@gmail.=
com</a>&gt; wrote:<br></div><blockquote class=3D"gmail_quote" style=3D"marg=
in:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1e=
x"><div dir=3D"ltr"><div dir=3D"ltr">Dear all,<br><div><br></div><div>I am =
trying to create gnuplot executables for macOS in which the=C2=A0Qt librari=
es are statically linked. It is easy to create static versions of Qt, but I=
 run into two problems:</div><div><br></div><div><br></div><div>1. Compilat=
ion of gnuplot on macOS relies on pkg-config, but to the best of=C2=A0my kn=
owledge, pkg-config is not supported in Qt6 (if I am mistaken, I would be g=
rateful=C2=A0for pointers).</div><div><br></div><div><br></div><div>2. Qt5 =
has support=C2=A0for pkg-config. A regular (dynamic) binary of gnuplot work=
s well with Qt. However, a statically compiled version of gnuplot starts pr=
operly, but as soon as I issue the first plot command there=C2=A0is a warni=
ng:</div><div><br></div><div>





<p style=3D"margin:0px;font-variant-numeric:normal;font-variant-east-asian:=
normal;font-variant-alternates:normal;font-size-adjust:none;font-kerning:au=
to;font-feature-settings:normal;font-stretch:normal;font-size:11px;line-hei=
ght:normal;font-family:Menlo;color:rgb(0,0,0)"><span style=3D"font-variant-=
ligatures:no-common-ligatures">qt.qpa.plugin: Could not find the Qt platfor=
m plugin &quot;cocoa&quot; in &quot;&quot;</span></p><p style=3D"margin:0px=
;font-variant-numeric:normal;font-variant-east-asian:normal;font-variant-al=
ternates:normal;font-size-adjust:none;font-kerning:auto;font-feature-settin=
gs:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family=
:Menlo;color:rgb(0,0,0)"><br></p><p style=3D"margin:0px;font-variant-numeri=
c:normal;font-variant-east-asian:normal;font-variant-alternates:normal;font=
-size-adjust:none;font-kerning:auto;font-feature-settings:normal;font-stret=
ch:normal;line-height:normal"><br></p><p style=3D"margin:0px;font-variant-n=
umeric:normal;font-variant-east-asian:normal;font-variant-alternates:normal=
;font-size-adjust:none;font-kerning:auto;font-feature-settings:normal;font-=
stretch:normal;line-height:normal">If I restart gnuplot after setting <span=
 style=3D"font-variant-ligatures:no-common-ligatures;color:rgb(0,0,0);font-=
family:Menlo;font-size:11px">&quot;export QT_DEBUG_PLUGINS=3D1&quot;,</span=
>=C2=A0I get:<br><br>





</p><p style=3D"margin:0px;font-variant-numeric:normal;font-variant-east-as=
ian:normal;font-variant-alternates:normal;font-size-adjust:none;font-kernin=
g:auto;font-feature-settings:normal;font-stretch:normal;line-height:normal"=
><span style=3D"font-variant-ligatures:no-common-ligatures;color:rgb(0,0,0)=
;font-family:Menlo;font-size:11px">FactoryLoader::QFactoryLoader() ignoring=
 &quot;org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3&quot;=
 since plugins are disabled in static builds</span>=C2=A0</p><p style=3D"ma=
rgin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-va=
riant-alternates:normal;font-size-adjust:none;font-kerning:auto;font-featur=
e-settings:normal;font-stretch:normal;line-height:normal"><br></p><div>As f=
ar as I can tell, the qtterminal=C2=A0source code should have a Q_IMPORT_PL=
UGIN() command to work properly with static compilation, but I do not know =
enough about Qt to be sure.</div><div><br></div><div><br></div><div>Any hel=
p would be appreciated!</div><div><br></div><div>Erik</div>





</div></div>
</div>
</blockquote></div></div>

--0000000000005c634f0630b94bc5--


--===============5501610732417596182==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline


--===============5501610732417596182==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
gnuplot-beta mailing list
[email protected]
Membership management via: https://lists.sourceforge.net/lists/listinfo/gnuplot-beta

--===============5501610732417596182==--