Load GUI libraries at runtime (but only if needed)

Do you have a question about makefiles, a compiler or IDE you are using and need to know how to set it up for wxWidgets or why it doesn't compile but other IDE's do ? Post your questions here.
Virchanza
I live to help wx-kind
I live to help wx-kind
Posts: 172
Joined: Sun Jul 19, 2009 6:12 am

Re: Load GUI libraries at runtime (but only if needed)

Post by Virchanza »

ONEEYEMAN wrote: Sat Mar 18, 2023 7:51 pm On top of that wxQt will not let you do that, because Qt license restriction.
This is the first I've heard about wxQt.

Where can I get an exhaustive list of all the wxWidgets ports, e.g. wxX11, wxMSW, wxGTK3, etc.? I cannot find the exhaustive list anywhere.

I haven't read the Qt license but I very much doubt that it forbids you to link statically with a library that links dynamically with Qt.

So now I'm gonna also link my program statically with wxQt as well, so that it will look good on GTK3 as well as Qt, and also it will 'just work' on bare X11.
ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 7459
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: Load GUI libraries at runtime (but only if needed)

Post by ONEEYEMAN »

Hi,
The ports include MSW, GTK {2, 3, 4, etc}, OSX/Cocoa and Qt.

There is a very very basic DFB port of wxWidgets.
There was a wxMotiff port, but it is no longer there as it went unmaintained for so many years. The drop was done in the current latest release.
There is X11 port. It is feature rich, but unmaintained for many years. The only reason it is kept is because it used as wxUniversal on *nix-like port.
And of course there is a wxUniversal. This port is basically used to create a brand new ports. It is actually a set of widgets that are being painted by wxWidgets itself.
There is also a Haiku port based on the Haiku API. But this one is not maintained by wx core team.
There was also OSXD/Carbon port of wxWidgets, but it was abandoned, because Apple stopped supporting Carbon with I think 10.8, and when the minimum required OSX raised, Carbon had to go. Also Carbon application is 32-bit only.
However some pieces of API from Carbon still referenced in the current Git master. So don't be surprised.

To get a full list - "Use the Source".
To find out if it is getting the maintenance - ask here or on the wx-users ML.

Now to answer your other questions.

I believe the Qt license prohibit to link statically, unless you pay Nokia for the license. Please consult the lawyer if you know one.

Keep in mind so that the relaxing license is available only from Qt version 5, so if you have version 4, you are out of luck.

wxQt port is not really basic, but it has quite a lot of issues, because people don't really care about this port. But occasionally it does receive patches.

Also notice that Qt itself is huge and is split between multiple so/dll/dylib files. So, if you really plan to link statically you binary will be huge and will kill the download of any decent provider. ;-)

(A note worse mentioning: wxQt port was originally made to make software work on Android. But since Android idea was abandoned, wxQt stopped being actively maintained)/.

I strongly suggest to consulta lawyer before even thinking of using Qt/wxQt statically. I belive you will have to pay for the licejnse to Nokia in order to do that. And the license cost approx $1500. But because Qt has double license you can link dynamically for free.

Thats actually a reason why originally wx team were using GTK port and not Qt one.

Also as I said - wxX11 port is feature rich but unmaintained. So if something will not work - you are on your own fixing it. So I doubt it will "just work" on X11.
Virchanza
I live to help wx-kind
I live to help wx-kind
Posts: 172
Joined: Sun Jul 19, 2009 6:12 am

Re: Load GUI libraries at runtime (but only if needed)

Post by Virchanza »

Oneeyeman, I don't know if you pay much attention when reading my posts. Do you think I was saying that I would link statically with the Qt libraries?
ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 7459
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: Load GUI libraries at runtime (but only if needed)

Post by ONEEYEMAN »

Hi,
Are you using "--disable-shared" when building wxWIdgets?

Thank you.
Virchanza
I live to help wx-kind
I live to help wx-kind
Posts: 172
Joined: Sun Jul 19, 2009 6:12 am

Re: Load GUI libraries at runtime (but only if needed)

Post by Virchanza »

ONEEYEMAN wrote: Sat Mar 18, 2023 11:15 pm Hi,
Are you using "--disable-shared" when building wxWIdgets?

Thank you.
Yes, in order to produce static libraries for wxWidgets.

Whether or not the wxWidgets is linked statically, has no bearing whatsoever on whether or not Qt is linked statically.

I am proposing to link statically with wxWidgets, and to link dynamically with Qt.
ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 7459
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: Load GUI libraries at runtime (but only if needed)

Post by ONEEYEMAN »

Hi,
I understand... except the default wxWidgets Makefile links everything static if one uses "--disable-shared".

Did you modify the Makefile in order not to do that?

Thank you.
Virchanza
I live to help wx-kind
I live to help wx-kind
Posts: 172
Joined: Sun Jul 19, 2009 6:12 am

Re: Load GUI libraries at runtime (but only if needed)

Post by Virchanza »

ONEEYEMAN wrote: Sun Mar 19, 2023 3:11 am I understand... except the default wxWidgets Makefile links everything static if one uses "--disable-shared".
No it doesn't, or at least it doesn't on my Ubuntu 22.04 desktop PC. When I build wxWidgets with "--disable-shared", and then I link an executable file with wxWidgets, I get an executable that links dynamically with underlying graphics library (e.g. GTK3 or X11). I can confirm this by using 'readelf' or 'ldd' on the executable.
ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 7459
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: Load GUI libraries at runtime (but only if needed)

Post by ONEEYEMAN »

Hi,
This is really strange
Linking statically means everything is in the library/executable.

Can you run the default (unmodified) build of wxWidgets, build minimal sample and check?

Thank you.
DavidHart
Site Admin
Site Admin
Posts: 4252
Joined: Thu Jan 12, 2006 6:23 pm
Location: IoW, UK

Re: Load GUI libraries at runtime (but only if needed)

Post by DavidHart »

Linking statically means everything is in the library/executable.
You misunderstand. It means linking statically to the wx libs, not to everything.

See my earlier post about a statically-linked 'minimal'. That linked dynamically to 76 libs, including
libgtk-3.so.0 => /lib/x86_64-linux-gnu/libgtk-3.so.0 (0x00007f376e0a5000)
Post Reply