Lazarus

Programming => Operating Systems => Linux => Topic started by: dbannon on October 20, 2019, 08:39:03 am

Title: Ubuntu 19.10 and libgdk
Post by: dbannon on October 20, 2019, 08:39:03 am
I have just tested my app against the newly released Ubuntu 19.10, default install being Gnome of course.

Results seem a bit disappointing, there is, I suggest, a lot less GTK2 stuff in there compared to previous versions.  In particular, a basic Lazarus app fails at startup complaining of missing libgdk-x11.  Interestingly, I cannot find such a library in the appropriate repo. Assume its bundled in with something else.

I normally tell my end users to ALWAYS use dgebi to install a local or downloaded file as its good at resolving dependencies. (Apt and dpkg are not when the deb file is sitting on your local disk).  Fortunately, gdebi must be built using similar gtk2 dependencies as our Lazarus apps and installing it first results in all the necessary libraries being installed.

I note that some other non Gnome Distributions are indicating they will be leaving out GTK2 stuff as time goes by so its not just those (expletive deleted) Gnome devs at work here I am afraid. Sigh....

If your install model is not deb based, its something you may need to watch out for.

When I have some time, might build another VM and try and workout exactly what missing libraries a minimal Lazarus app is dependent on in this brave new world.

Davo

Title: Re: Ubuntu 19.10 and libgdk
Post by: Handoko on October 20, 2019, 11:51:52 am
I've just upgraded my Ubuntu Mate to version 19.10. So far, everything seems to works correctly. But only 1 issue which if I remember correctly it already happened since version 18.10:

https://forum.lazarus.freepascal.org/index.php/topic,46771.msg336414.html

Do you experience similar issue when running program that has TOpenGLControl? It only happens if I run it from the Lazarus IDE.

Back to the topic. I checked my system and I found I do not have libgdk-x11 installed too. But I still can do debugging in Lazarus. Is libgdk-x11 really needed?
Title: Re: Ubuntu 19.10 and libgdk
Post by: dbannon on October 20, 2019, 12:47:11 pm
Do you experience similar issue when running program that has TOpenGLControl? It only happens if I run it from the Lazarus IDE.

Back to the topic. I checked my system and I found I do not have libgdk-x11 installed too. But I still can do debugging in Lazarus. Is libgdk-x11 really needed?

I have not tried TOpenGLControl, not in my test suite.

I 'believe' libgdk-x11 is needed because my test app, very basic, failed complaining about that Library.  After I installed gdebi and all its depandancies my test app runs and I can see the library installed. But it was not listed as one going to be installed, must have come along with something else. I reckon your system is running OK because its an upgrade, not a new install. You will have those GTK libraries left over from previous install.

The mystery deepens ....

Davo
Title: Re: Ubuntu 19.10 and libgdk
Post by: Handoko on October 20, 2019, 01:26:31 pm
I use Synaptic Package Manager, it is a good tool for inspecting library issue. It did not show I have libgdk-x11 installed on my system. So that makes me think libgdk-x11 is not needed.

After I upgraded my Ubuntu, I experienced the Ubuntu-TrayIcon issue. My program didn't show on the tray icon. Recompiling the project solved the problem.

I hate OS upgrade. It often full of surprises.
Title: Re: Ubuntu 19.10 and libgdk
Post by: dbannon on October 20, 2019, 11:27:26 pm
Yep, we are going to see a lot of TrayIcon issues. Up until 19.10, Ubuntu supported the old model.  With 19.10, you needed to use the LibAppIndicator3. Did you note that your TrayIcon only supports a menu now, no click handler executing your own code.

If you distribute your app to other Linux users, better read the wiki article.

Davo

Title: Re: Ubuntu 19.10 and libgdk
Post by: Handoko on October 21, 2019, 03:45:31 am
After the upgrade, the libappindicator3-1 is installed automatically. A TrayIcon program I wrote did not show up. I didn't modify the code but simple recompiled the project using Lazarus 2.0.4, seemed to fix the issue. I will report back if I found something weird.
Title: Re: Ubuntu 19.10 and libgdk
Post by: dbannon on October 21, 2019, 04:32:09 am
Ah, so 2.0.4 had my first attempt to fix this, it uses libappindicator3 if its available. Even if its not the best choice for a given OS. The trouble with the LibAppIndicator3 approach is that it only works with a Menu, so apps that depend on the old system tray sending an an OnClick event won't work. 

Both Fixes and 2.0.6 are a little smarter and try to use the old approach is they can, only using the Libappindicator3 if its known the os wont work in the old approach. But I am afraid they will get it wrong in U19.10 because it came out after my patch was submitted. And its a bit close to 2.0.6 now to be making more changes.

Davo
Title: Re: Ubuntu 19.10 and libgdk
Post by: sash on October 27, 2019, 01:20:11 pm
Ubuntu XFCE upgraded 19.04 -> 19.10.
No problems, either with menu or without it.
Title: Re: Ubuntu 19.10 and libgdk
Post by: lucamar on October 27, 2019, 03:59:09 pm
In particular, a basic Lazarus app fails at startup complaining of missing libgdk-x11.  Interestingly, I cannot find such a library in the appropriate repo. Assume its bundled in with something else.

Yes, libgdk-x11 should be installed as part of the full libgtk2.x package. I've looked in Ubuntu 12.04 up to 16.04 and it's always there.

YMMV, though; I haven't got any machines with a more modern (or a different) distro.

HTH.

ETA: Sorry for being so late; I forgot to look about for this ... :-[
Title: Re: Ubuntu 19.10 and libgdk
Post by: dbannon on October 28, 2019, 06:12:19 am
Ubuntu XFCE upgraded 19.04 -> 19.10.
No problems, either with menu or without it.

Yep, thats what I expect. Upgrades generally don't remove things even if they have been declared 'legacy'.  In the case of Xfce, a new install might be a problem soon because the the Xfce devs have announced a programme to remove GTK2 over the next few releases. See
https://www.phoronix.com/scan.php?page=news_item&px=Xfce4-Panel-No-More-GTK2

But the real problems are on Gnome distros, especially Redhat.

Lucamar -
Yep, I found that lingdk-x11 is a dependancy of libgtk2 so all we seem to need is to ensure our apps are marked as being dependant on GTK2 and all will be good.

But folks, better start poking around at GTK3, its already on most peoples machines (yes, even 16.04) but to compile there you probably need libgtk3-dev ....

Davo


 
Title: Re: Ubuntu 19.10 and libgdk
Post by: sash on October 28, 2019, 10:22:16 am
Well, just tried vanilla live USB stick Xubuntu 19.10 and can confirm an issue exists:
Application runs but no TrayIcon is visible. In some panel configurations (no packages installed) tray icon appears, but no hints or clicks are working.

Other than that - application runs ok, and ldd shows no missing lib dependencies.

P.S. By the way, after upgrade to 19.04 I suffered from a tray icon bug (https://bugs.launchpad.net/ubuntu/+source/xfce4-panel/+bug/1797417), that was either xfxce/gtk/compositor related (but not to Lazarus at all) which was actually fixed after upgrade to 19.10.
Title: Re: Ubuntu 19.10 and libgdk
Post by: dbannon on October 28, 2019, 11:20:05 am
Well, just tried vanilla live USB stick Xubuntu 19.10 and can confirm an issue exists:
Application runs but no TrayIcon is visible. In some panel configurations (no packages installed) tray icon appears, but no hints or clicks are working.
OK, important point here sash, which version of Lazarus are you using ?

If you have a current Fixes, please try running your system tray app with LAZUSEAPPIND=YES    you may need to install LibAppIndicator3 first.  Launch like this -
LAZUSEAPPIND=YES ./project1 <enter>

You will get some info on the terminal.

Davo
Title: Re: Ubuntu 19.10 and libgdk
Post by: sash on October 28, 2019, 01:08:08 pm
OK, important point here sash, which version of Lazarus are you using ?

See my signature. Application was compiled there and tested with Live Xubuntu.
As I said all researches could be made with Live distro (no installation required at all - just reboot from cd/usb) or even on virtual machine.

At the moment I'm a little busy, let's just return to this in a couple of days.
Title: Re: Ubuntu 19.10 and libgdk
Post by: dbannon on October 29, 2019, 09:54:45 am
Yes sash, I do my testing on VirtualBox, I have six distributions, each with several desktops.

But I don't have Lazarus 202 ! You will need something newer to use that env var I mentioned. 

My  testing of Xfce on Ubuntu said it used the "Old TrayIcon" model, you should see an Icon and be able to capture click events. All without using LibAppIndicator3.  But if distributing an app to other users, I suggest you don't try to capture Click events, just use a popup menu, that can be made work on just about anywhere.

As I mentioned earlier, future Xfce will not ship with a lot of GTK2 libraries. Sigh....

Davo
Title: Re: Ubuntu 19.10 and libgdk
Post by: Thaddy on October 29, 2019, 11:00:48 am
@sash
Plz use a maintained version for two reasons:
- any fix may be already applied
- any fix will not be back-ported.

I, for one, am not able - or willing - to test anything else but a latest release version or trunk: those can receive patches.
Title: Re: Ubuntu 19.10 and libgdk
Post by: sash on October 30, 2019, 03:17:03 pm
@Thaddy

Thanks. I know but...

- I'm neither using TrayIcon in my projects.
- Nor having problems with helloworld-type sample project, compiled on my (even with an older LCL) particular machine.
- Seems like this issue is more about distro packaging (19.10 is not LTS after all) than about LCL.
Title: Re: Ubuntu 19.10 and libgdk
Post by: dbannon on October 30, 2019, 11:05:23 pm
Yep, its about distro packaging, in particular, the trend is to leave GTK2 out.  And most Lazarus Linux apps are dependent on GTK2.....

Right now most disro/desktop combinations do include GTK2 but the big name ones don't and they make up most of the installed base.

Davo
Title: Re: Ubuntu 19.10 and libgdk
Post by: tk on November 06, 2019, 10:02:14 pm
Similar issue for me, I just downloaded virtual Ubuntu 19.10 x64 (https://www.osboxes.org/ubuntu/#ubuntu-19-10-vmware) and I could not run any 64bit app built with Lazarus (double commander, fpcupdeluxe, etc.), from their official distributions.

Always got this error:
Code: [Select]
error while loading shared libraries: libgdk-x11-2.0.so.0: cannot open shared object file: No such file or directory
Then I inspected if the libs are located in the system and they were:
Code: [Select]
apt-file search libgdk-x11-2.0.so.0
libgtk2.0-0: /usr/lib/x86_64-linux-gnu/libgdk-x11-2.0.so.0
libgtk2.0-0: /usr/lib/x86_64-linux-gnu/libgdk-x11-2.0.so.0.2400.32

But the apps didn't work. So I (re)installed the libs:
Code: [Select]
sudo apt-get install libgtk2.0-0
Apt-get told me that some libs were missing and installed them:
Code: [Select]
The following additional packages will be installed:
  libgail-common libgail18 libgtk2.0-bin libgtk2.0-common
The following NEW packages will be installed:
  libgail-common libgail18 libgtk2.0-0 libgtk2.0-bin libgtk2.0-common

And this helped, all the apps started to work.

Nothing changed when I called apt-file search libgdk-x11-2.0.so.0 again after this.

Do I have to instruct the customers to reinstall the libs or is it just an issue with this Ubuntu release?

Title: Re: Ubuntu 19.10 and libgdk
Post by: dbannon on November 06, 2019, 11:15:23 pm
tk, it appears that U19.10 (and a growing number of other distros) are dropping GTK2 from the default install list. Not really surprising I guess.  Installing gtk2 and its dependancies 'should' solve the problem, so, yes, mark your deb or rpms as being dependant on GTK2 (or tell end users they must manually install GTK2).

You could try -

Code: [Select]
find / -name "libgdk-x11*" 2> /dev/null <enter>
to ensure it there but its almost certainly installed as part of GTK2 and if the apps run, that also says its there.

Time we all started looking at GTK3 ....

Davo
Title: Re: Ubuntu 19.10 and libgdk
Post by: valdir.marcos on November 07, 2019, 01:37:07 am
tk, it appears that U19.10 (and a growing number of other distros) are dropping GTK2 from the default install list. Not really surprising I guess.
No news here:
Lazarus and GTK2 x GTK3 x GTK4 x GTK5
https://forum.lazarus.freepascal.org/index.php/topic,39668.0.html

Quote
Installing gtk2 and its dependancies 'should' solve the problem, so, yes, mark your deb or rpms as being dependant on GTK2 (or tell end users they must manually install GTK2).

You could try -
Code: [Select]
find / -name "libgdk-x11*" 2> /dev/null <enter>to ensure it there but its almost certainly installed as part of GTK2 and if the apps run, that also says its there.

Time we all started looking at GTK3 ....
Davo
I agree.
Title: Re: Ubuntu 19.10 and libgdk
Post by: sash on November 07, 2019, 12:24:21 pm
Time we all started looking at GTK3 ....

Or adopt QT.
Title: Re: Ubuntu 19.10 and libgdk
Post by: zeljko on November 07, 2019, 12:26:18 pm
You mean adopt lazarus so default ws is qt/qt5 ? Or adopt what exactly ?
Title: Re: Ubuntu 19.10 and libgdk
Post by: sash on November 07, 2019, 12:36:49 pm
You mean adopt lazarus so default ws is qt/qt5
Yes, this.

AFAIK, Lazarus' QT is more stable than GTK3, but not that straightforward to setup and deploy.
Title: Re: Ubuntu 19.10 and libgdk
Post by: zeljko on November 07, 2019, 01:47:35 pm
Most distros have libQt4Pas and libQt5Pas, so installing lazarus under such distro isn't a big deal.
Also, for deployment you need exactly nothing if client's installation already have libQt4Pas/libQt5Pas.
It's definitelly not big deal under x11.
Title: Re: Ubuntu 19.10 and libgdk
Post by: dbannon on November 08, 2019, 12:02:47 am
Or adopt QT.

Trouble is that 'most' distributions arrive with GTK3 preinstalled. Those that don't, find it pretty easy to install. If you distribute your QT app, you would need end users to install QT as well, that, as has been noted, is often not an easy task.

OK, good thing I checked before posting, it looks like my U1910 text VM does have a basic QT install. Pretty sure I did not do that. Maybe sash has a point ? 

Further research is indicated .....
Title: Re: Ubuntu 19.10 and libgdk
Post by: dbannon on November 08, 2019, 02:11:49 am
QT5 ?

Hmm, maybe.  I had it working on my U18.04 install earlier this year, so I made a small test app. Just to see if its a practical solution.  It built OK on my Ubuntu18.04 with Lazarus Fixes.  Running it however on a number of systems -

* U18.04 - Failed "undefined symbol: QTextEdit_setPlaceholderText". Maybe some recent updates broke it.
* U19.10 - OK if I first install libQt5Pas - that was easy.  And a much smaller install than GTK2. Promising.
* Fedora 30 Plasma - Ok if I install qt5pas.  Same with gnome but no TrayIcon.   
* Mageia - Install a lib64qt5pas1 but test app failed "undefined symbol: QTextEdit_setPlaceholderText"
* Debian 10.1 - Install libqt5pas1 - works OK.

So, works with no more than installing libqt5pas on 60% of what I consider the "big five". But you need to know the name of the pas library, it varies. Sigh.  But does not work with 40% and thats a big lump to have to chase down if you are supporting a number of end users. GTK2 delivers 100% but on some of those, now required a largish dependencies download.  GTK3 delivers on 100% but is still quite buggy. 

Sorry sash, my vote is still "lets get GTK3 up to scratch" !

EDIT:  No, I made a mistake, the Qt5 libraries are not pre installed on the mainstream Ubuntu, Fedora and probably Mageia. I use Virtual Boxes to test but I have each distro setup with multiple Desktops,  and that includes KDE/Plasma so the Qt5 libraries have come from there. A manual install uses about 49Meg on Ubuntu 19.10, compare that with 321Meg to put GTK2.0 on the same box. Hmm...

Davo
Title: Re: Ubuntu 19.10 and libgdk
Post by: zeljko on November 08, 2019, 02:28:21 pm
QT5 ?

Hmm, maybe.  I had it working on my U18.04 install earlier this year, so I made a small test app. Just to see if its a practical solution.  It built OK on my Ubuntu18.04 with Lazarus Fixes.  Running it however on a number of systems -

* U18.04 - Failed "undefined symbol: QTextEdit_setPlaceholderText". Maybe some recent updates broke it.
* U19.10 - OK if I first install libQt5Pas - that was easy.  And a much smaller install than GTK2. Promising.
* Fedora 30 Plasma - Ok if I install qt5pas.  Same with gnome but no TrayIcon.   
* Mageia - Install a lib64qt5pas1 but test app failed "undefined symbol: QTextEdit_setPlaceholderText"
* Debian 10.1 - Install libqt5pas1 - works OK.

So, works with no more than installing libqt5pas on 60% of what I consider the "big five". But you need to know the name of the pas library, it varies. Sigh.  But does not work with 40% and thats a big lump to have to chase down if you are supporting a number of end users. GTK2 delivers 100% but on some of those, now required a largish dependencies download.  GTK3 delivers on 100% but is still quite buggy. 

Sorry sash, my vote is still "lets get GTK3 up to scratch" !

EDIT:  No, I made a mistake, the Qt5 libraries are not pre installed on the mainstream Ubuntu, Fedora and probably Mageia. I use Virtual Boxes to test but I have each distro setup with multiple Desktops,  and that includes KDE/Plasma so the Qt5 libraries have come from there. A manual install uses about 49Meg on Ubuntu 19.10, compare that with 321Meg to put GTK2.0 on the same box. Hmm...

Davo

undefined symbol: QTextEdit_setPlaceholderText comes from old version of Qt5Pas library. Distros should update their packages (current stable version is qt5pas-1.2.7),
or you can build it manually on your linux machine, download trunk lazarus, cd lcl/interfaces/qt5/cbindings , read manual howto compile libqt5pas...it's pretty easy.
KDE distros alread have all Qt5 libraries installed except maybe libQt5Pas.


Title: Re: Ubuntu 19.10 and libgdk
Post by: dbannon on November 09, 2019, 12:51:17 am
undefined symbol: QTextEdit_setPlaceholderText comes from old version of Qt5Pas library. Distros should update their packages (current stable version is qt5pas-1.2.7),
or you can build it manually on your linux machine, download trunk lazarus, cd lcl/interfaces/qt5/cbindings , read manual howto compile libqt5pas...it's pretty easy.
KDE distros alread have all Qt5 libraries installed except maybe libQt5Pas.
Agreed its easy, I can do it. But I feel very uncomfortable distributing a binary package that overwrites the end users version of even libqt5pas. And updating a distro's QT5 itself is no easy task if its not packaged for that OS. If, as you say, the distro people would keep up with releases it would work but they don't. My Ubuntu1804 has another 18 months of life ....
But, maybe good news, I found that if you avoid the widgets that have changed, a current app can still use the old QT5 libs including qt5pas. So far I have found that means not using TMemo (sure there are more). My app, tomboy-ng works using the older library OK. Maybe thats a transition strategy.

Zelijko, as the proud maintainer of both GTK3 and QT5, which do you think has a more promising future for Lazarus developers ?

EDIT: Ubuntu quote, on both U18.04 and U19.10 http://users.telenet.be/Jan.Van.hijfte/qtforfpc/fpcqt4.html and that mentions a version 2.6 dating back to 2013. Thats clearly   different number system (and maybe code base) to yours ? 

Davo
Title: Re: Ubuntu 19.10 and libgdk
Post by: zeljko on November 09, 2019, 09:52:35 am
undefined symbol: QTextEdit_setPlaceholderText comes from old version of Qt5Pas library. Distros should update their packages (current stable version is qt5pas-1.2.7),
or you can build it manually on your linux machine, download trunk lazarus, cd lcl/interfaces/qt5/cbindings , read manual howto compile libqt5pas...it's pretty easy.
KDE distros alread have all Qt5 libraries installed except maybe libQt5Pas.
Agreed its easy, I can do it. But I feel very uncomfortable distributing a binary package that overwrites the end users version of even libqt5pas. And updating a distro's QT5 itself is no easy task if its not packaged for that OS. If, as you say, the distro people would keep up with releases it would work but they don't. My Ubuntu1804 has another 18 months of life ....
But, maybe good news, I found that if you avoid the widgets that have changed, a current app can still use the old QT5 libs including qt5pas. So far I have found that means not using TMemo (sure there are more). My app, tomboy-ng works using the older library OK. Maybe thats a transition strategy.

Zelijko, as the proud maintainer of both GTK3 and QT5, which do you think has a more promising future for Lazarus developers ?

EDIT: Ubuntu quote, on both U18.04 and U19.10 http://users.telenet.be/Jan.Van.hijfte/qtforfpc/fpcqt4.html and that mentions a version 2.6 dating back to 2013. Thats clearly   different number system (and maybe code base) to yours ? 

Davo

1. For me personally , I'll probably never use anything but Qt. I'm not interested in gtk2/3/4 since it looks poor against Qt4/Qt5 libs and does not fit my needs for bussiness apps. Note that Qt4 is bit slower than gtk2 , but Qt5 is equal or faster than gtk2 in any aspect.
2. http://users.telenet.be/Jan.Van.hijfte/qtforfpc/fpcqt4.html is talking about Qt4 version of bidings. They aren't changed for years and won't be changed.
3. Qt5 bindings are not at the third party site they're located in lcl/interfaces/qt5/cbindings so you can build it at any time.
4.For deploying: Under mac I'm using qtdeploy script which is installed by Qt, under windows just put all dll's inside your app directory, for linux (if OS does not have libQt5Pas or it's outdated), put eg lib/ directory inside your app directory and copy there your libQt5Pas, then under linker options in your project add additional rpath to linker and everything will work w/o problems.

Title: Re: Ubuntu 19.10 and libgdk
Post by: sash on November 09, 2019, 11:41:40 am
I'm not interested in gtk2/3/4 since it looks poor against Qt4/Qt5 libs and does not fit my needs for bussiness apps.

Hmm ... my experience gives me just the opposite result: gtk looks far superior and more configurable (on my distro) than qt.
But look and feel is customizable with themes for both gtk an qt.

And IMO, GUI appearance - should be beyond app's responsibility.
Instead (especially "business" ones, unlike let's say games), applications should respect and follow user's picked GUI style.
Title: Re: Ubuntu 19.10 and libgdk
Post by: dbannon on November 10, 2019, 01:16:29 am
Thanks for that Zeljko !

2. http://users.telenet.be/Jan.Van.hijfte/qtforfpc/fpcqt4.html is talking about Qt4 version of bidings. They aren't changed for years and won't be changed.
3. Qt5 bindings are not at the third party site they're located in lcl/interfaces/qt5/cbindings so you can build it at any time.

OK, so there is the problem.  Ubuntu are currently shipping what they call 2.6beta for Qt5 apparently from that site. That site does have a 2.6Alpha for Qt5. They have been shipping exactly the same version with, at least, 18.04 through to 19.10. Should we ask them to follow the version in the Lazarus tree ?  What they ship now does, apparently work with the version of Qt5 they ship.


4.......for linux (if OS does not have libQt5Pas or it's outdated), put eg lib/ directory inside your app directory and copy there your libQt5Pas, then under linker options in your project add additional rpath to linker and everything will work w/o problems.
Hmm, in Linux the binary should end up in, eg /usr/local/bin  I really don't like the idea of creating a new directory off there containing an extra library, that would be pretty much in breech of the Linux standards. I think ~/.local/lib would be a better place to put it on a singer user system. But if this 2.6beta works on U19.10 it should work on U18.04, I'll look a bit closer....

As to the version of Qt itself, it looks to me as if its only a problem with Ubuntu's long term release kit. Even Debian 9.9 ships Qt 5.7. On U19.10 they have Qt 5.12 and I guess the next long term release (next April) will be similar. So, maybe the problem I am worrying about will go away over time ?

Davo
Title: Re: Ubuntu 19.10 and libgdk
Post by: zeljko on November 10, 2019, 11:03:41 am
I don't know how Ubuntu packagers call libQt5Pas package, I just know that libQt5Pas under Ubuntu 19.10 is correct and everything works out of the box (lclqt5).
For rpath paths, of course you can add any path you want, I've just written simple example about rpath.
Title: Re: Ubuntu 19.10 and libgdk
Post by: dbannon on November 11, 2019, 09:20:51 am
Yeah, I am not sure where they get it from but clearly not the website the package manager points to !

The naming thing, I sort of understand. You talk about version 1.2.7 and Ubuntu has libqt5pas1.2.6, the '1' being tacked on to its name ?  Seems pretty sure the '2.6' corresponds to your '2.7' so they are only a step behind.

I have started docing what I have found about Qt5 on https://wiki.lazarus.freepascal.org/Qt5_Interface#Linux

Real stand out is the dependencies of a Qt5 app is one tenth that of a GT2 if your distro has neither.  And its pretty plain that more and more are going to start leaving out GTK2. I'll be releasing a Qt5 version of my app as soon as I have run it through my standard tests.

As usual Zelijko, thanks for your help !

Davo
Title: Re: Ubuntu 19.10 and libgdk
Post by: zeljko on November 11, 2019, 09:31:09 am
@dbannon, about version - I'm reffering about version I've changed in Qt5Pas.pro (lcl/interfaces/qt5/cbindings/Qt5Pas.pro). Version is changed due to new routines eg QLineEdit_placeholderText() and changed winId to be PtrUInt instead of PtrInt.
Title: Re: Ubuntu 19.10 and libgdk
Post by: zeljko on November 11, 2019, 09:35:27 am
I've also added few comments on  https://wiki.lazarus.freepascal.org/Qt5_Interface#Linux.
Qt5-5.6.0 is minimum version which can be used with libQt5Pas. libQt5Pas built against Qt5-5.6.x can work with
any Qt5 version > 5.6 and is fully compatibile.
Title: Re: Ubuntu 19.10 and libgdk
Post by: dbannon on November 12, 2019, 01:45:25 am
And I have been back to that wki page too.   

Most newer distros seem OK using their own repo versions of Qt5 and libqt5pas except for Ubuntu 16.04 (good to at least 2021) and Ubuntu18.04 (good until 2023). They have the same version number on their libqt5pas but it does not work as it should ! 

They have some serious version control problems !

You cannot replace it with a libqt5pas from a later Ubuntu because it has a test to see what version of Qt5 its using.
However, the library built using the code from Lazarus tree does not have such as test and it can be pushed onto ether 16.04 or 18.04 and every thing works fine.
Quite a grotty situation for someone sending out linux binaries .....

Best you keep an eye on that wiki page, I will add to it from time to time and you may well spot some terrible mistake !

Davo
Title: Re: Ubuntu 19.10 and libgdk
Post by: ChrisR on November 20, 2019, 06:52:52 pm
I did a clean install of Ubuntu 19.10 on a new computer. Since GTK2 was not installed, I needed to install it:
  sudo apt-get install libgtk2.0-0
after this, the Lazarus programs launch, but only after a ~20 second delay. Once the GTK program is running, all is fine. But ANY Lazarus GTK2 app takes a long time to start - regardless of whether it is the large IDE or a small application.

Fortunately, Ubuntu 19.04 seems to ship with an intact copy of libqt5 (unlike 18.04 where one needs to rebuild bindings), so one can simply install
  sudo apt-get install libqt5pas-dev
The IDE and all my programs nicely compile to QT5. Very impressive.

One final issue, when you recompile the Lazarus IDE, if regenerates the "Lazarus" executable but not the "startlazarus" executable. If I look at the recompiled "Lazarus" it uses QT5, but the "startlazarus" remains gtk2. If I launch Lazarus with "startlazarus" I get the long delay before it calls "Lazarus" while if I run "Lazarus" it launches immediately. Does anyone have any idea why GTK2 applications on Ubuntu 19.04 have this long delay, and if there is any way to eliminate the delay?
Title: Re: Ubuntu 19.10 and libgdk
Post by: dbannon on November 21, 2019, 12:16:52 pm

Chris, "I think" if you have built your own Lazarus in your own home directory, then you don't need to use startlazarus.  Again, "I think" that startlazarus is only useful if Lazarus has been installed up in /usr/ somewhere and you cannot write to it there. When you come to rebuild Lazarus (eg when installing a package) it does all sorts of clever tricks, hiding the newly built version of lazarus down in your disk area in the lazarus dot config directory.

I never use startlazarus, always start one of several versions I have just using a script that cd's to the appropriate lazarus subdirectory and calls 'lazarus' passing it an option to make it use the matching config dir.

for example, in my $HOME/bin directory is start-laz-fixes :

Code: [Select]
#!/bin/bash
RELEASE="fixes_2_0"
cd /home/dbannon/bin/Lazarus/"$RELEASE"
./lazarus --PCP=/home/dbannon/.Laz_"$RELEASE"

Title: Re: Ubuntu 19.10 and libgdk
Post by: ChrisR on November 21, 2019, 02:38:33 pm
@dbannon thanks for your comments. Yes, once Lazarus is built to QT, there is no need to use the GTK2 startlazarus. What really puzzles me is why every single GTK2 app compiled by Lazarus pauses for around 20 seconds when launching. This influences all my projects (MRIcroGL, Surfice, etc), most other Lazarus projects (as GTK2 is still the default widgetset) and the default installation of Lazarus. Most non-developers or new Lazarus users will be frustrated by this startup issue. I do not know if Lazarus is trying to check screen resolution, fonts, or something else, but on a clean install of 19.10 the startup times of GTK2-based Lazarus applications is unacceptable, and I would be grateful to anyone who can find a solution. 
Title: Re: Ubuntu 19.10 and libgdk
Post by: mdalacu on November 21, 2019, 05:14:14 pm
I have no such problem on any Ubuntu version pausing GTK2 app. ;)
Title: Re: Ubuntu 19.10 and libgdk
Post by: ChrisR on November 21, 2019, 06:59:19 pm
I have the pause issue with every Lazarus built GTK2 including Lazarus as initially installed and every Lazarus project including "Hello world". I inserted written statements, and the pause appears to occur after the FormShow and FormCreate events. It is a standard Ubuntu 19.04 install on a new machine (Ryzen 3900X, Nvidia 2080 Ti setup for CUDA). The entire interface pauses during this period - I can not interact with other programs.
Title: Re: Ubuntu 19.10 and libgdk
Post by: mdalacu on November 21, 2019, 07:40:12 pm
It is working great in virtualbox and and also on diffrent hw intel/amd...no pause, no nothing.
I always use the proprietary driver for nvidia on x...
Have you tried a diffrent binary made with Lazarus on your machine? Same problem?
You can try my video converter and see if the problem replicates..
http://dmsimpleapps.blogspot.com/2014/04/dmmediaconverter.html
Title: Re: Ubuntu 19.10 and libgdk
Post by: ChrisR on November 21, 2019, 08:00:30 pm
Just installed Ubuntu 19.10 as a clean install on a new machine (Intel 4790, Nvidia 970 but have not yet installed Nvidia drivers). The behavior is the the same. The default Lazuar built to GTK2 and hello world built to GTK2 also stall the system on Launch. Again, Lazarus applications built to QT5 seem fine. Did you do a clean install of Ubuntu, or did you upgrade from an early version of Ubuntu or install a variant like Ubuntu?
Title: Re: Ubuntu 19.10 and libgdk
Post by: ChrisR on November 21, 2019, 09:36:23 pm
@mdalacu I installed dmMediaConverter - v2.3.1 directly from the amd64 deb file you linked to. On both my AMD Ryzen and Intel i7 the software paused for 26 seconds between starting from the command line and appearing on screen. For both hardware systems, Ubuntu 19.10 was installed clean on an empty hard drive. The Ubuntu installer was downloaded direct from the Ubuntu web site. I ensured all packages were up to date. It seems that all Lazarus programs compiled for GTK2 incur a long penalty for loading on Ubuntu 19.10. Any insights appreciated.
Title: Re: Ubuntu 19.10 and libgdk
Post by: ChrisR on November 21, 2019, 09:53:09 pm

Building a Lazarus GTK hello world project with "Dwarf with sets" set in the debug suggests that FormCreate and FormShow are called before the pause. However, text on labels does not appear until after the pause. The following errors were exported to the command line.

(project1:14196): Gdk-CRITICAL **: 15:49:14.898: IA__gdk_window_get_events: assertion 'GDK_IS_WINDOW (window)' failed

(project1:14196): GLib-GObject-CRITICAL **: 15:49:14.898: g_object_ref: assertion 'G_IS_OBJECT (object)' failed

(project1:14196): GLib-GObject-CRITICAL **: 15:49:14.898: g_object_unref: assertion 'G_IS_OBJECT (object)' failed
Title: Re: Ubuntu 19.10 and libgdk
Post by: dbannon on November 21, 2019, 11:37:26 pm
Chris, an interesting test might be to load one GTK2 app and, while that is running, load another.

The GTK2 libraries are pretty big and if nothing has moved them into memory, maybe thats what you are seeing ?   What sort of hard disk do you have ?   I have done my test on a VM running on a box with a fast SSD so it would hide that problem.

 I am wondering if its all about the fact that the GTK2 apps we are making now are the odd ones out, everything else is using GTK3 so its already in memory and ready to be used by any new app that wants it. But as soon as your single GTK2 app stops, the system says "phew!, glad thats over, lets get rid of this GTK2stuff and free up some memory".

Next step might just be for you to try building your app with GTK3 .....

Davo

Title: Re: Ubuntu 19.10 and libgdk
Post by: ChrisR on November 22, 2019, 12:01:56 am
Davo
 Both systems have 1Tb Samsung M.2 NVME solid state drives. Clean install so plenty of space, no spinning drives. I have two sister Intel machines, one with 16.04 and the other with 18.04 and those load GTK2 Lazarus and GTK2 Lazarus applications in a flash. The penalty is consistent, so the second load takes as long as the first, while the Ryzen 3900X has a massive 64mb of L3 cache.

19.04 does not initially install with the GTK2 libraries. Included GTK apps like GEdit use GTK3, and this loads instantly.

The apps in question are MRIcroGL and Surfaice
  https://github.com/rordenlab/MRIcroGL12
  https://github.com/neurolabusc/surf-ice
Both use OpenGL and last I checked the Lazarus TOpenGLControl component did not support GTK3.

I can build to QT5, but since 18.04 is still the current LTS, but the libQT5pas has issues with that (I have pinged one of the Debian maintainers). Unfortunately, the default 18.04 that you download can not be installed on the new Ryzen CPUs without patches, so I think 19.10 has a niche even though it is not LTS.
Title: Re: Ubuntu 19.10 and libgdk
Post by: mdalacu on November 22, 2019, 06:46:31 am
I actualy use ubuntu with xfce4...
Code: Pascal  [Select][+][-]
  1. sudo apt install xubuntu-desktop
. The best trade off imho. Try it maybe it will work better.
I have also cean installed in a vm kubuntu 19.10. The gtk apps opens instantly...
Title: Re: Ubuntu 19.10 and libgdk
Post by: dbannon on November 22, 2019, 07:37:02 am
A very strange business. And one I think that is related to the Freezing problem this thread started as.

....................
I can build to QT5, but since 18.04 is still the current LTS, but the libQT5pas has issues with that (I have pinged one of the Debian maintainers). Unfortunately, the default 18.04 that you download can not be installed on the new Ryzen CPUs without patches, so I think 19.10 has a niche even though it is not LTS.

I made some notes on the Qt5 wiki page, updated just this morning about building libqt5pas on 18.04.  Easy and reliable.   https://wiki.freepascal.org/Qt5_Interface#libqt5pas

Important thing with 18.04 seems to be that it also has Qt4 installed and prefers to use it.  So you need to tell it we are playing Qt5 and you also need to tell it to do a release (not debug) version.  Once built, that new library replaces the 18.04 repo one, it has the same version number (yek!) but at least with my tests works as expected. In my case, the library came out at 2447712 bytes, a touch smaller than the Ubuntu one at 2570320 (unstripped with debug info, its 89,511,704 bytes).

Your end users can and should replace the Ubuntu library with the built one. Just how to do that is, IMHO, an issue. I am wondering if I should put it in the deb I make, after all, it seems to work fine on each and every system I have tested it on. So far ....

The other problems you are seeing, IHMO are Ubuntu issues, not Lazarus.  Just how we establish that, I don't know. Hmm, gdebi is a gtk2 app, do you see the same problem starting gdebi ?

Davo
Title: Re: Ubuntu 19.10 and libgdk
Post by: ChrisR on November 22, 2019, 02:07:24 pm
gdebi-gtk launches immediately. It is a Python3 script, so  I can not just "ldd" to see its dependencies. I do not think Ubutnu will see this as their problem, from their perspective GTK2 was deprecated a long time ago. The issue is that Lazarus is distributed as GTK2 and defaults to GTK2 for builds. The Lazarus QT5 widgetset seems very mature, so perhaps Debian users should be given the option of installing QT5 IDE. I can handle this myself, but I worry this will impact new Lazarus users and users of our tools.

I appreciate the updated web page that describes building the libqt5pas, and this is a great solution for Lazarus developers. However, I think this is a reach for most of our users, as it requires a tremendous number of development tools and libraries installed (e.g. Lazarus sources for the c bindings, C, QT5-dev, etc). Is it possible to make a simple deb file for the libqt5pas that will work on 16.04, 18.04 and not interact with other tools?

In a similar direction, from others experience it seems likely that this issue does not impact many varieties of Debian like XUbuntu, but it does impact a clean install on two different CPUs (new AMD, mature Intel). I also removed the NVidia graphics card from the Intel system, and the issue persists with the integrated Intel graphics card. My sense is this will be a common hurdle for future users.

I wonder if Lazarus does some calls to determine DPI, as the pause occurs after the "FormCreate" and "FormShow" events are triggered but before widgets appear on the Form. It seems like Lazarus apps are waiting for some information (DPI, fonts installed, etc) and eventually times out.
Title: Re: Ubuntu 19.10 and libgdk
Post by: ChrisR on November 22, 2019, 05:04:08 pm
This seems to be a Lazarus issue, not a specific issue with Ubuntu 19.10's GTK2 implementation. I compiled the hello world example in C and it launches immediately.
 https://developer.gnome.org/gtk-tutorial/stable/c39.html#SEC-HELLOWORLD
I checked with ldd and the C executable uses libgtk-x11-2.0.so

Since FormCreate and FormCreate occur before this delay, but labels only appear after the delay, I still feel that Lazarus is trying to do something with fonts or DPI and eventually times out.
Title: Re: Ubuntu 19.10 and libgdk
Post by: dbannon on November 23, 2019, 12:15:00 am
This seems to be a Lazarus issue, not a specific issue with Ubuntu 19.10's GTK2 implementation. I compiled the hello world example in C and it launches immediately.
<insert rude word> thats very disappointing. I cannot reproduce this issue on my VM but I can see the Freezes (discussed elsewhere) that happen when starting GTK2 Lazarus on 19.10. Given that you alone have seen this issue, I am afraid it falls to you to track it down Chris. Maybe that means setting a  breakpoint back in the lpr file and stepping through the early stages of an application starting up ?  Tedious and annoying but possible.

Quote from: ChrisR
.......building the libqt5pas, and this is a great solution for Lazarus developers. However, I think this is a reach for most of our users, as it requires a tremendous number of development tools and libraries installed (e.g. Lazarus sources for the c bindings, C, QT5-dev, etc). Is it possible to make a simple deb file for the libqt5pas that will work on 16.04, 18.04 and not interact with other tools?

Maybe. Certainly not U16.04, it has too early a version if Qt5.  And it has another 18 months of supported life ....

I intend to try an build a Qt5 deb of my app, tomboy-ng, and bundle the library I have built with it. It will only be useful with 18.04, I don't think the new library is needed with later versions of Ubuntu. I am quite uncomfortable with replacing (possibly) existing libraries on an end users system but have convinced myself its the only way. I wish I could be certain that my U18.04 end  user only uses libqt5pas for Lazarus applications.

If that all works OK, then yep, thats the answer, we make a dep that contains libqt5pas, depends on libqt5core etc and tell people to install it BEFORE installing LazarusQt5 or other Lazarus built Qt5 apps.

I do think thats a good approach, GTK2 is on its way out.

Davo
Title: Re: Ubuntu 19.10 and libgdk
Post by: dbannon on November 24, 2019, 02:52:41 am
OK, I have started a new thread in the Qt section, https://forum.lazarus.freepascal.org/index.php/topic,47514.0.html

It has instructions and links to two debs that solve the problem on Ubuntu 18.04

Davo
Title: Re: Ubuntu 19.10 and libgdk
Post by: ChrisR on December 05, 2019, 04:50:19 pm
For anyone who has this issue in the future, see solution and links at
  https://bugs.freepascal.org/view.php?id=36359
TinyPortal © 2005-2018