Recent

Author Topic: Ubuntu 19.10 and libgdk  (Read 2831 times)

dbannon

  • Hero Member
  • *****
  • Posts: 787
    • tomboy-ng, a rewrite of the classic Tomboy
Re: Ubuntu 19.10 and libgdk
« Reply #45 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

Lazarus 2, Linux (and reluctantly Win10, OSX)
My Project - https://github.com/tomboy-notes/tomboy-ng

ChrisR

  • Full Member
  • ***
  • Posts: 103
Re: Ubuntu 19.10 and libgdk
« Reply #46 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.

mdalacu

  • Full Member
  • ***
  • Posts: 202
    • dmSimpleApps
Re: Ubuntu 19.10 and libgdk
« Reply #47 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...
« Last Edit: November 22, 2019, 06:49:05 am by mdalacu »

dbannon

  • Hero Member
  • *****
  • Posts: 787
    • tomboy-ng, a rewrite of the classic Tomboy
Re: Ubuntu 19.10 and libgdk
« Reply #48 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
« Last Edit: November 22, 2019, 07:40:05 am by dbannon »
Lazarus 2, Linux (and reluctantly Win10, OSX)
My Project - https://github.com/tomboy-notes/tomboy-ng

ChrisR

  • Full Member
  • ***
  • Posts: 103
Re: Ubuntu 19.10 and libgdk
« Reply #49 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.

ChrisR

  • Full Member
  • ***
  • Posts: 103
Re: Ubuntu 19.10 and libgdk
« Reply #50 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.

dbannon

  • Hero Member
  • *****
  • Posts: 787
    • tomboy-ng, a rewrite of the classic Tomboy
Re: Ubuntu 19.10 and libgdk
« Reply #51 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
Lazarus 2, Linux (and reluctantly Win10, OSX)
My Project - https://github.com/tomboy-notes/tomboy-ng

dbannon

  • Hero Member
  • *****
  • Posts: 787
    • tomboy-ng, a rewrite of the classic Tomboy
Re: Ubuntu 19.10 and libgdk
« Reply #52 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
Lazarus 2, Linux (and reluctantly Win10, OSX)
My Project - https://github.com/tomboy-notes/tomboy-ng

ChrisR

  • Full Member
  • ***
  • Posts: 103
Re: Ubuntu 19.10 and libgdk
« Reply #53 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