Lazarus

Programming => Widgetset => QT => Topic started by: ChrisR on April 05, 2021, 10:06:55 pm

Title: [SOLVED] QT5 with latest Lazarus has undefined references
Post by: ChrisR on April 05, 2021, 10:06:55 pm
I am unalbe to compile event he simplest default project with Lazarus to the Linux QT5 widgetset. This is new, as previously I had no problem, even with complex projects. My libqt5pas seems to be the latest. I am using Ubuntu 20.04



$svn up
Updating '.':
At revision 64929.


$sudo apt install libqt5pas-dev
Reading package lists... Done
Building dependency tree       
Reading state information... Done
libqt5pas-dev is already the newest version (2.8).
0 upgraded, 0 newly installed, 0 to remove and 1 not upgraded.

sudo apt install libqt5pas1
Reading package lists... Done
Building dependency tree       
Reading state information... Done
libqt5pas1 is already the newest version (2.8).
0 upgraded, 0 newly installed, 0 to remove and 1 not upgraded.


$lazbuild -B project1.lpr --ws=qt5
TProject.DoLoadStateFile Statefile not found: /home/chris/Downloads/QT5/lib/x86_64-linux/project1.compiled
Hint: (11030) Start of reading config file /home/chris/.fpc.cfg
Hint: (11031) End of reading config file /home/chris/.fpc.cfg
Free Pascal Compiler version 3.2.0 [2020/07/07] for x86_64
Copyright (c) 1993-2020 by Florian Klaempfl and others
(1002) Target OS: Linux for x86-64
(3104) Compiling project1.lpr
(3104) Compiling unit1.pas
(9022) Compiling resource /home/chris/Downloads/QT5/lib/x86_64-linux/project1.or
(9015) Linking /home/chris/Downloads/QT5/project1
/usr/bin/ld: /home/chris/lazarus/lcl/units/x86_64-linux/qt5/qtwidgets.o: in function `QTWIDGETS_$$_QTAXFACTORY$QSTRINGH$QOBJECTH$$QACCESSIBLEINTERFACEH':
qtwidgets.pas:(.text.n_qtwidgets_$$_qtaxfactory$qstringh$qobjecth$$qaccessibleinterfaceh+0xdf): undefined reference to `QLCLAccessibleWidget_Create'
/usr/bin/ld: /home/chris/lazarus/lcl/units/x86_64-linux/qt5/qtwidgets.o: in function `QTWIDGETS$_$TQTACCESSIBLEOBJECT_$__$$_CREATE$TLAZACCESSIBLEOBJECT$QWIDGETH$$TQTACCESSIBLEOBJECT':
qtwidgets.pas:(.text.n_qtwidgets$_$tqtaccessibleobject_$__$$_create$tlazaccessibleobject$qwidgeth$$tqtaccessibleobject+0x14c): undefined reference to `QAccessible_queryAccessibleInterface'
/usr/bin/ld: qtwidgets.pas:(.text.n_qtwidgets$_$tqtaccessibleobject_$__$$_create$tlazaccessibleobject$qwidgeth$$tqtaccessibleobject+0x16a): undefined reference to `QLCLAccessibleWidget_override_child'
/usr/bin/ld: qtwidgets.pas:(.text.n_qtwidgets$_$tqtaccessibleobject_$__$$_create$tlazaccessibleobject$qwidgeth$$tqtaccessibleobject+0x183): undefined reference to `QLCLAccessibleWidget_override_childCount'
/usr/bin/ld: qtwidgets.pas:(.text.n_qtwidgets$_$tqtaccessibleobject_$__$$_create$tlazaccessibleobject$qwidgeth$$tqtaccessibleobject+0x19c): undefined reference to `QLCLAccessibleWidget_override_role'
/usr/bin/ld: qtwidgets.pas:(.text.n_qtwidgets$_$tqtaccessibleobject_$__$$_create$tlazaccessibleobject$qwidgeth$$tqtaccessibleobject+0x1b5): undefined reference to `QLCLAccessibleWidget_override_text'
/usr/bin/ld: /home/chris/lazarus/lcl/units/x86_64-linux/qt5/qtwidgets.o: in function `QTWIDGETS$_$TQTACCESSIBLEOBJECT_$__$$_CHILDOVERRIDE$LONGINT$QACCESSIBLEINTERFACEH':
qtwidgets.pas:(.text.n_qtwidgets$_$tqtaccessibleobject_$__$$_childoverride$longint$qaccessibleinterfaceh+0x73): undefined reference to `QAccessible_queryAccessibleInterface'
/usr/bin/ld: /home/chris/lazarus/lcl/units/x86_64-linux/qt5/qtwidgets.o: in function `QTWIDGETS$_$TQTACCESSIBLETREE_$__$$_CREATE$TLAZACCESSIBLEOBJECT$QWIDGETH$$TQTACCESSIBLETREE':
qtwidgets.pas:(.text.n_qtwidgets$_$tqtaccessibletree_$__$$_create$tlazaccessibleobject$qwidgeth$$tqtaccessibletree+0x9b): undefined reference to `QAccessible_queryAccessibleInterface'
/usr/bin/ld: qtwidgets.pas:(.text.n_qtwidgets$_$tqtaccessibletree_$__$$_create$tlazaccessibleobject$qwidgeth$$tqtaccessibletree+0xb9): undefined reference to `QLCLAccessibleWidget_override_child'
/usr/bin/ld: qtwidgets.pas:(.text.n_qtwidgets$_$tqtaccessibletree_$__$$_create$tlazaccessibleobject$qwidgeth$$tqtaccessibletree+0xd2): undefined reference to `QLCLAccessibleWidget_override_childCount'
/usr/bin/ld: /home/chris/lazarus/lcl/units/x86_64-linux/qt5/qtwidgets.o: in function `QTWIDGETS$_$TQTACCESSIBLETREE_$__$$_CHILDOVERRIDE$LONGINT$QACCESSIBLEINTERFACEH':
qtwidgets.pas:(.text.n_qtwidgets$_$tqtaccessibletree_$__$$_childoverride$longint$qaccessibleinterfaceh+0xc3): undefined reference to `QAccessible_queryAccessibleInterface'
/usr/bin/ld: /home/chris/lazarus/lcl/units/x86_64-linux/qt5/qtwidgets.o: in function `QTWIDGETS$_$TQTACCESSIBLETREEROW_$__$$_CREATE$TLAZACCESSIBLEOBJECT$QWIDGETH$$TQTACCESSIBLETREEROW':
qtwidgets.pas:(.text.n_qtwidgets$_$tqtaccessibletreerow_$__$$_create$tlazaccessibleobject$qwidgeth$$tqtaccessibletreerow+0x9b): undefined reference to `QAccessible_queryAccessibleInterface'
/usr/bin/ld: qtwidgets.pas:(.text.n_qtwidgets$_$tqtaccessibletreerow_$__$$_create$tlazaccessibleobject$qwidgeth$$tqtaccessibletreerow+0xb9): undefined reference to `QLCLAccessibleWidget_override_actionNames'
/usr/bin/ld: qtwidgets.pas:(.text.n_qtwidgets$_$tqtaccessibletreerow_$__$$_create$tlazaccessibleobject$qwidgeth$$tqtaccessibletreerow+0xc7): undefined reference to `QLCLAccessibleWidget_override_child'
/usr/bin/ld: qtwidgets.pas:(.text.n_qtwidgets$_$tqtaccessibletreerow_$__$$_create$tlazaccessibleobject$qwidgeth$$tqtaccessibletreerow+0xd5): undefined reference to `QLCLAccessibleWidget_override_childAt'
/usr/bin/ld: qtwidgets.pas:(.text.n_qtwidgets$_$tqtaccessibletreerow_$__$$_create$tlazaccessibleobject$qwidgeth$$tqtaccessibletreerow+0xee): undefined reference to `QLCLAccessibleWidget_override_childCount'
/usr/bin/ld: qtwidgets.pas:(.text.n_qtwidgets$_$tqtaccessibletreerow_$__$$_create$tlazaccessibleobject$qwidgeth$$tqtaccessibletreerow+0x107): undefined reference to `QLCLAccessibleWidget_override_doAction'
/usr/bin/ld: qtwidgets.pas:(.text.n_qtwidgets$_$tqtaccessibletreerow_$__$$_create$tlazaccessibleobject$qwidgeth$$tqtaccessibletreerow+0x120): undefined reference to `QLCLAccessibleWidget_override_parent'
/usr/bin/ld: qtwidgets.pas:(.text.n_qtwidgets$_$tqtaccessibletreerow_$__$$_create$tlazaccessibleobject$qwidgeth$$tqtaccessibletreerow+0x139): undefined reference to `QLCLAccessibleWidget_override_rect'
/usr/bin/ld: qtwidgets.pas:(.text.n_qtwidgets$_$tqtaccessibletreerow_$__$$_create$tlazaccessibleobject$qwidgeth$$tqtaccessibletreerow+0x152): undefined reference to `QLCLAccessibleWidget_override_role'
/usr/bin/ld: qtwidgets.pas:(.text.n_qtwidgets$_$tqtaccessibletreerow_$__$$_create$tlazaccessibleobject$qwidgeth$$tqtaccessibletreerow+0x16b): undefined reference to `QLCLAccessibleWidget_override_text'
/usr/bin/ld: /home/chris/lazarus/lcl/units/x86_64-linux/qt5/qtwidgets.o: in function `QTWIDGETS$_$TQTACCESSIBLETREEROW_$__$$_PARENTOVERRIDE$QACCESSIBLEINTERFACEH':
qtwidgets.pas:(.text.n_qtwidgets$_$tqtaccessibletreerow_$__$$_parentoverride$qaccessibleinterfaceh+0x25): undefined reference to `QAccessible_queryAccessibleInterface'
/usr/bin/ld: /home/chris/lazarus/lcl/units/x86_64-linux/qt5/qtwscontrols.o: in function `QTWSCONTROLS$_$TQTWSLAZACCESSIBLEOBJECT_$__$$_CREATEHANDLE$TLAZACCESSIBLEOBJECT$$HWND':
qtwscontrols.pp:(.text.n_qtwscontrols$_$tqtwslazaccessibleobject_$__$$_createhandle$tlazaccessibleobject$$hwnd+0x13): undefined reference to `QAccessible_installFactory'
/home/chris/Downloads/QT5/project1.lpr(25,1) Error: (9013) Error while linking
/home/chris/Downloads/QT5/project1.lpr(25,1) Fatal: (10026) There were 1 errors compiling module, stopping
Fatal: (1018) Compilation aborted
Error: /usr/bin/ppcx64 returned an error exitcode
Error: (lazarus) Compile Project, Target: project1: stopped with exit code 1
Error: (lazbuild) failed compiling of project /home/chris/Downloads/QT5/project1.lpi
Title: Re: QT5 with latest Lazarus has undefined references
Post by: zeljko on April 06, 2021, 08:57:08 am
You must use libQt5Pas from lazarus trunk - in other words you must rebuild libQt5Pas on your own since I've added QAccessibility* in trunk.
If you don't want to build libQt5Pas then use stable Lazarus release.
Title: Re: QT5 with latest Lazarus has undefined references
Post by: MarkMLl on April 06, 2021, 10:10:29 am
You must use libQt5Pas from lazarus trunk - in other words you must rebuild libQt5Pas on your own since I've added QAccessibility* in trunk.
If you don't want to build libQt5Pas then use stable Lazarus release.

Where is it best installed? Do you have any notes on doing that? I've always assumed that Lazarus + Qt was just a combination that stopped working on occasion.

I can confirm the same problem with lazarus-trunk and Debian "Bullseye" i.e. testing/not-yet-stable.

MarkMLl
Title: Re: QT5 with latest Lazarus has undefined references
Post by: zeljko on April 06, 2021, 11:09:48 am
On my linuxmint libQt5Pas is inside /usr/lib/x86_64-linux-gnu
linda@linda-Lenovo-Y520-15IKBN /usr/lib/x86_64-linux-gnu $ ls -al libQt5Pas.so*
lrwxrwxrwx 1 root root       18 tra   4 12:35 libQt5Pas.so -> libQt5Pas.so.1.2.9
lrwxrwxrwx 1 root root       18 tra   4 12:35 libQt5Pas.so.1 -> libQt5Pas.so.1.2.9
lrwxrwxrwx 1 root root       18 tra   4 12:35 libQt5Pas.so.1.2 -> libQt5Pas.so.1.2.9
-rwxr-xr-x 1 root root 88692504 lip   5  2019 libQt5Pas.so.1.2.7
-rwxr-xr-x 1 root root  3663888 tra   4 12:34 libQt5Pas.so.1.2.9

cd lcl/interfaces/qt5/cbindings
qmake -query && qmake && make

You must install qt5 dev packages (don't know exact names)

I've copied libQt5Pas.so.1.2.9 manually after compilation.



Title: Re: QT5 with latest Lazarus has undefined references
Post by: MarkMLl on April 06, 2021, 11:15:41 am
cd lcl/interfaces/qt5/cbindings
qmake -query && qmake && make

You must install qt5 dev packages (don't know exact names)

I've copied libQt5Pas.so.1.2.9 manually after compilation.

Install from where: the distro or Lazarus svn?

I'm entirely used to installing libqt*pas from the distro, but your suggestion earlier was that it also existed as part of Lazarus.

MarkMLl
Title: Re: QT5 with latest Lazarus has undefined references
Post by: zeljko on April 06, 2021, 11:53:47 am
From lazarus svn. Distro one is missing QAccessibilityWidget implementation.
You cannot use lazarus-qt5 trunk without rebuilding libqt5pas manually.
Distro version will be updated when lazarus-2.2 is out I guess, current distro version is probably 1.2.8,
trunk version is 1.2.9.
Title: Re: QT5 with latest Lazarus has undefined references
Post by: MarkMLl on April 06, 2021, 12:36:32 pm
Thanks, I'll investigate and report back.

On Debian "Buster" (stable) libqt4pas-dev is reported as 2.5-18 (I might actually have got that from the previous distro version) and libqt5pas-dev as 2.6~beta-6. On "Bullseye" (testing) libqt5pas-dev is reported as 2.6+2.0.8+dfsg-2... I'm not sure how those versions tie in with the ones you've mentioned

Quote
cd lcl/interfaces/qt5/cbindings
qmake -query && qmake && make

OK, I see the relevant files in my local lazarus-trunk, I'd been indulging in the "recreational impossibility" of finding a repository with an unknown name on the FPC Subversion server :-)

MarkMLl
Title: Re: QT5 with latest Lazarus has undefined references
Post by: AlexTP on April 06, 2021, 12:55:16 pm
Users need to reinstall libqt5Pas. If they use app from Lazarus trunk.
From 'releases' from here
https://github.com/davidbannon/libqt5pas/
Title: Re: QT5 with latest Lazarus has undefined references
Post by: MarkMLl on April 06, 2021, 01:43:45 pm
Users need to reinstall libqt5Pas. If they use app from Lazarus trunk.
From 'releases' from here
https://github.com/davidbannon/libqt5pas/

"Reinstall" doesn't come into it, since OP and myself have the "official" packages from our distro which are potentially signed etc. "Replace" would be more appropriate, but GOK if that would cause backwards compatibility issues.

Noting that the Github repository has been updated today i.e. after OP started the thread:

I think the really useful thing there is https://github.com/davidbannon/libqt5pas/blob/master/cbindings/README.TXT which gives the basic build instructions with the numbering rationale being in https://github.com/davidbannon/libqt5pas/blob/master/README.md

If my understanding is correct Debian's 2.6 corresponds to his 1.2.6 etc.

Building from lazarus/trunk sources looks like a problem on a comparatively clean system, I've got as far as


/usr/local/share/lazarus-trunk/lcl/interfaces/qt5/cbindings$ qmake -query
qmake: could not exec '/usr/lib/qt5/bin/qmake': No such file or directory


...I'll come back to this but right now I've got company accounts to work on.

MarkMLl
Title: Re: QT5 with latest Lazarus has undefined references
Post by: AlexTP on April 06, 2021, 01:56:38 pm
I've got the same error on build:
qmake: could not exec '/usr/lib/qt5/bin/qmake': No such file or directory
Title: Re: QT5 with latest Lazarus has undefined references
Post by: MarkMLl on April 06, 2021, 02:29:13 pm
The basic  qmake -query  works on a more mature system (both Debian).

Both systems obviously have libqt5pas-dev, the more mature system also has libqt5opengl5-dev:amd64 qtbase5-dev:amd64 qtbase5-dev-tools qttools5-dev-tools.

dpkg -S /usr/bin/qmake  says it's from qtchooser, but that's definitely not something I've installed manually. I log package installation fairly carefully but what it doesn't show is the actual command like and the "top level" package that pulled other stuff in.

MarkMLl

Title: Re: QT5 with latest Lazarus has undefined references
Post by: dbannon on April 06, 2021, 02:55:15 pm
The way I understood it, you only needed the new libqt5pas libraries if you are using the specific features zeljko has just added. Thats what happened in the past and is workable. However, that is not the case now and I am afraid things appear to be seriously broken.

I have just pulled down Lazarus trunk and tried to build my app on a U20.04 machine with std repo versions of libqt5pas and it fails. Prior to the recent accessibility additions it works fine. This means that anyone using trunk now must use the libraries for my github if they use Qt5 apps, end users as well as developers. 

I am quite sure that was not the intended outcome and suggest it needs to be reversed.

Davo

Title: Re: QT5 with latest Lazarus has undefined references
Post by: MarkMLl on April 06, 2021, 03:20:22 pm
I'm watching with interest. In the interim do you have any suggestion what packages are the minimum required for building? I think that would be of interest to anybody who occasionally rebuilds lazarus-trunk since by and large we'd expect to have the development tools and libraries applicable to our OS etc. available as a prerequisite.

MarkMLl
Title: Re: QT5 with latest Lazarus has undefined references
Post by: dbannon on April 06, 2021, 03:24:48 pm
"Replace" would be more appropriate, ...

Yes, its definitely a replace.

Quote from: MarkMLl
..... with the numbering rationale being in https://github.com/davidbannon/libqt5pas/blob/master/README.md

If my understanding is correct Debian's 2.6 corresponds to his 1.2.6 etc.

Yes, sort of.  The main library is libqt5pas1 and version 2.6 but the dev package drops the '1', Debian versioning is a very arcane art.

Anyway, its been called 1.2.6 for a long time while zeljko has been making incremental changes.  All those changes, up to now, have been backwards compatible.  The distros have been using an incredibly ugly version number like 1.2.6~beta-6build1 and that '~' is an absolute menace. Zeljko agreed to call it 1.2.8 last time around to get rid of the '~' and to ensure a higher version number than 1.2.6something.  To avoid auto updates from breaking things.

But the point is, until this recent change, only quite old distros eg U18.04 and friends, needed to worry about it.  Suddenly, we have a backwards compatibility issue !

Quote from: MarkMLl
Building from lazarus/trunk sources looks like a problem on a comparatively clean system,

Its not hard, slow, you will need qmake and libqt5x11extras-dev. Probably will have everything else.  But our end users ?  Thats a very different situation !

Don't worry about the qmake -query, just proceed to qmake qt=qt5. Or use mine from the github repo, no back doors, I promise !

Davo
Title: Re: QT5 with latest Lazarus has undefined references
Post by: dbannon on April 06, 2021, 03:32:46 pm
I'm watching with interest. In the interim do you have any suggestion what packages are the minimum required for building? I think that would be of interest to anybody who occasionally rebuilds lazarus-trunk since by and large we'd expect to have the development tools and libraries applicable to our OS etc. available as a prerequisite.

MarkMLl

As I mentioned above, qmake and libqt5x11extras-dev. Probably will have everything else.

But if this change makes it through to release Lazarus, in say, 2.1.0, QT5 will be useless for any app thats going to be distributed until the distros catch up. And that is a matter of several years. U20.04 is probably good until 2024 ....

Debian Testing is in a feature freeze mode now, wonder if we should be pushing to get this "new and improved" lib into it ?  Will have to test to see it does not break Lazarus 2.0.12 for example. Sigh ...

Davo

Davo
Title: Re: QT5 with latest Lazarus has undefined references
Post by: zeljko on April 06, 2021, 04:02:13 pm
It is safe to push libQt5Pas 1.2.9 to distro maintainers, if someone know such ppl then pls ask them to update libQt5Pas
Title: Re: QT5 with latest Lazarus has undefined references
Post by: MarkMLl on April 06, 2021, 04:12:28 pm
As I mentioned above, qmake and libqt5x11extras-dev. Probably will have everything else.

Sorry, I'd missed that bit.

libqt5x11extras5-dev (note extra digit) on Debian which also pulls in libglu1-mesa-dev libqt5opengl5-dev libvulkan-dev qt5-qmake qt5-qmake-bin qtbase5-dev qtbase5-dev-tools.

qmake -query now runs OK which I presume is an indication prerequisites are OK. qmake qt=qt5 runs to successful completion. make runs to successful completion. I've not tried going further pending working out where it's being installed and what the implications are.

Quote
Debian Testing is in a feature freeze mode now, wonder if we should be pushing to get this "new and improved" lib into it ?  Will have to test to see it does not break Lazarus 2.0.12 for example. Sigh ...

The kernel version is still drifting upwards, and I think it would be worth pointing out the desirability of getting this prerequisite library up to something which is possibly slightly in advance of the Lazarus version frozen for the distro.

MarkMLl
Title: Re: QT5 with latest Lazarus has undefined references
Post by: ChrisR on April 06, 2021, 05:49:30 pm
I also note that the Ubuntu packages
  https://packages.ubuntu.com/focal/libdevel/libqt5pas-dev
link to code from 2013
  http://users.telenet.be/Jan.Van.hijfte/qtforfpc/fpcqt4.html
I actually like how David Bannon separates this library from the rest of Lazarus.
  https://github.com/davidbannon/libqt5pas
However, he is not the developer, so he does not know when a new version is required. Since zeljko is spear-heading the impressive development of the QT5 widgetset, perhaps he should choose the best way to maintain and describe this library. One option is that the Lazarus community deems David Banoons repository the official one, with zeljko telling him when a new release should be created. We could then update all the Lazarus wikis to point to a single unified solution for this. As GTK2 is getting old, and GTK3 has many regressions (at least from my perspective as an OpenGL developer), the mature QT5 seems the future of Lazarus. I think the community would benefit from a unified mechanism for promoting this required library.
Title: Re: QT5 with latest Lazarus has undefined references
Post by: MarkMLl on April 06, 2021, 08:47:39 pm
If anybody does fix this (or becomes aware of its having been fixed) in a way that doesn't need a locally-generated binding library please could they append something to this thread so that we all know.

Temporarily fixed by reverting to revision 64919.

MarkMLl
Title: Re: QT5 with latest Lazarus has undefined references
Post by: dbannon on April 07, 2021, 03:54:24 am
OK, I have run a number of tests that indicate the new libraries are backwards compatible so older versions of Lazarus seem quite happy to use the new libraries. (The reverse is not the case however!).

So, I have logged a debian bug against bullseye in the hope they they will accept the new model into bullseye before it becomes 'stable'. That will set a transition happening at least.

https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=986495

In the mean time (ie several years) I suggest we (Qt5 and trunk users) need to manually install the new library on our own systems but make sure we compile release packages with, eg, Lazarus 2.0.12 ensuring compatibility with the libqt5pas libraries that will be out in user land for some time.

The alternative is, of course, we have to tell end users they need to manually install the new libraries, perhaps from  https://github.com/davidbannon/libqt5pas. Users hate that !  Ubuntu and friends users could use a PPA but thats only slightly less popular and does not help all the other distro users.

Davo
Title: Re: QT5 with latest Lazarus has undefined references
Post by: dbannon on April 07, 2021, 04:09:00 am
If anybody does fix this (or becomes aware of its having been fixed) in a way that doesn't need a locally-generated binding library please could they append something to this thread so that we all know.

https://github.com/davidbannon/libqt5pas/releases/tag/v1.2.9 - downloading and installing either deb or rpm is certainly easier than "locally-generating" but not a solution IMHO.

In addition, I am happy to add just a tar of the necessary files, would consist of just a library and a couple of symlinks that need be copied into (usually) /usr/lib/x86_64-linux-gnu. Thats won't, of course satisfy a package that has been declared to depend on libqt5pas.  Perhaps we need a 32bit version as well.

And creating a PPA would help too, Ubuntu users, and users of distros based on Ubuntu would at least get auto updates. But its still a very blunt weapon. Upgrades to your OS usually cancel all PPAs and again, end users always feel very uncomfortable about configuring PPAs. And PPAs have to be based on source packages ...

Personally, I think the accessibility changes made to Lazarus's Qt5 might be better done with an opt in #DEFINE approach.

Davo
Title: Re: QT5 with latest Lazarus has undefined references
Post by: MarkMLl on April 07, 2021, 08:58:02 am
Personally, I think the accessibility changes made to Lazarus's Qt5 might be better done with an opt in #DEFINE approach.

Or by loading the relevant procedures dynamically (i.e. on-demand rather than at the start of execution).

A few years ago I think I raised a bug asking for a compiler facility to check for the existence of a library, something like that might possibly help but obviously wouldn't fix the situation where a binary if moved from an up-to-date development system to a slightly older production system (with no development tools for security purposes).

Could possibly do with a note in the cbindings readme saying what the prerequisite packages are for various distreaux.

MarkMLl
Title: Re: QT5 with latest Lazarus has undefined references
Post by: dbannon on April 09, 2021, 02:56:52 am
I have had a response from the Debian people, no, they are not interested in updating the version of libqt5pas as their policy is quite clear, the existing library works fine with the RELEASE version of Lazarus they currently support (and that is not going to change between now and release of Bullseye).  And honestly, I consider that quite a reasonable position.

I don't believe what we have now is workable. Every new user who tries out Lazarus Trunk and Qt5 is going to get an incomprehensible error message and will walk away shaking his or her head sadly.  If the changes propagate into the next Lazarus release, its even worse.

With (eg) Debian having a two year release cycle, any application we build with either trunk or a newly released Lazarus will fail unless the end user manually updates their own libqt5pas library. And thats a massive turn off for end users.

I propose that we make the recent changes to the Lazarus code (NOT the C library code) subject to a #ifdef. zeljko has done much of that much of that already, all the Lazarus cbindings have moved out of qt5.pas and into qt56.pas.   qt5.pas just has an include, we make that include subject to the #ifdef

So, we reintroduce the 'old' qt5.pas as qt56stable.pas back into the repo and change q5.pas to -

Code: Pascal  [Select][+][-]
  1. {$I qtdefines.inc}
  2.  
  3. { Enabling the next define will allow use of the accessibility functions now built into Lazarus QT5.
  4.   But that requires manually installed new versions of the libqt5pas library.  See the cbinding
  5.   directory for build instructions or see https://github.com/davidbannon/libqt5pas   }
  6. // {$define QT5DEV}  
  7. {$ifdef QT5DEV}
  8. {$i qt56.pas}
  9. {$else}
  10. {$i qt56stable.pas}
  11. {$endif}        

The library (and dev library) remain the same, as distros pick them up, they will get the new code, eventually all distros will have the new code and the above setting can become the default. In the mean time, developers and end users who need the new facilities can install them, other people will be able to continue working in the mean time.

This new approach needs to be documented on the wiki. I also believe the new accessibility features need to be documented too. All we have at the moment is a bug report.

I have not tested the above proposal and if there are more changes than I expect to the common C code it will be more complicated than I present but its a start !

Is this an acceptable approach ?

Davo
Title: Re: QT5 with latest Lazarus has undefined references
Post by: MarkMLl on April 09, 2021, 09:09:47 am
@dbannon it looks a reasonable approach, but it definitely needs comments (i.e. like you've done) in appropriate places so that any distro maintainer casually packing it knows what's going on: it's not reasonable to expect them to go hunting in the wiki.

And there's still the risk that because the existing library works they won't pick up the new one.

MarkMLl
Title: Re: QT5 with latest Lazarus has undefined references
Post by: dbannon on April 09, 2021, 09:57:02 am
No, I am afraid my guesses about the extent of the changes made a few days ago was wildly optimistic.  Here is a summary of what changed in the pascal code (ie excluding the C code used to build the library, no need to 'manage' that) -

interfaces/qt5/qt56.pas differ     295 additional lines
interfaces/qt5/qtobject.inc differ    1 line
interfaces/qt5/qtwidgets.pas differ   462 additional lines
interfaces/qt5/qtwscomctrls.pp differ  1 line
interfaces/qt5/qtwscontrols.pp differ  48 additional lines
interfaces/qt5/qtwsfactory.pas differ  3 lines

While it could be possible to manage those changes with some compile directives, its not going to be be pretty. It will be a fair bit of work and will leave the code a bit harder to maintain. And I wonder if such a patch would be acceptable ?

Trouble is, I cannot see any other approach that even vaguely addresses this problem.  Can anyone else ?

Davo
Title: Re: QT5 with latest Lazarus has undefined references
Post by: MarkMLl on April 09, 2021, 10:17:50 am
I've not got the relevant code in front of me at the moment, but is it safe to conclude that a substantial number of those changes are declarative so don't depend on the binary (shared object) of the updated binding?

Could the changes be reduced to a small number of function calls which could be handled using run-time dynamic linkage?

MarkMLl
Title: Re: QT5 with latest Lazarus has undefined references
Post by: dbannon on April 09, 2021, 12:22:15 pm
I've not got the relevant code in front of me at the moment, but is it safe to conclude that a substantial number of those changes are declarative so don't depend on the binary (shared object) of the updated binding?
You mean as long as they are not called, it does not matter that they point nowhere ?  A good number but not more that 20% as a guess.

Could the changes be reduced to a small number of function calls which could be handled using run-time dynamic linkage?
No, not without restructuring Z's code, not something I am not willing to risk !

On the other hand, quite a lot will be in a small number of blocks requiring minimal intervention.

But the real question is, are the Powers that Be willing to accept such an ugly hack ?  It would probably have to be in there for at least two to three years ?

Davo

Title: Re: QT5 with latest Lazarus has undefined references
Post by: MarkMLl on April 09, 2021, 12:38:00 pm
But the real question is, are the Powers that Be willing to accept such an ugly hack ?  It would probably have to be in there for at least two to three years ?

There's a number of possibilities:

* Dump all the Qt5 stuff and revert to an older version... which is now unsupported by most distreaux.

* Force all users to upgrade their binding library, which would be extremely bad PR from FPC's POV.

* Fork "bigide" to have "accessible_bigide" or similar, or the platform name to include Accessible_Qt5.

* Modify the problematic patch so that if it tried to call the unimplemented function it would fail or raise an exception, which would need run-time dynamic linkage.

* Dump the patch that caused the problem as unachievable until the distreaux have caught up.

If anybody can see any others then for $DEITY's sake add them, but I think that only the final three are viable.

MarkMLl
Title: Re: QT5 with latest Lazarus has undefined references
Post by: dbannon on April 09, 2021, 03:02:53 pm
Well, turns out its not as ugly as I feared. I have added only 19 $ifdef and it compiles nicely !

Controlling with a $DEFINE in qtdefines.inc - thats going to need some more thought.

Think I'll head of to bed now, maybe we'll get some feed back from the developers ....

Davo
Title: Re: QT5 with latest Lazarus has undefined references
Post by: MarkMLl on April 09, 2021, 09:22:54 pm
qt56.pas is a bit of a beast. I have a tool which would semi-automatically convert that into an object containing lots of procedure/function pointers which would be nil where the target was unavailable in the .so, but I'm reluctant to try that by myself since (a) it doesn't handle the explicit specification of the entry-point name, (b) it's untested with any OS other than Linux x86_64 and I'm not in a position to support other platforms, and (c) all the points where it was being referenced would have to be qualified with an explicit qt56 to get everything to work properly.

The first of those could of course turn out to be a "non problem" if the external and internal names never differed, but verifying that and accommodating the redundant name specification would be a fairly big job in itself (I'm looking at the utility now to see what can be easily improved). Splitting the new stuff into qt56b.pas would probably make every approach easier.

MarkMLl
Title: Re: QT5 with latest Lazarus has undefined references
Post by: dbannon on April 14, 2021, 02:37:09 am
For the record, zeljko has added a define in qtdefines.inc that, by default, disables this set of features.

It would be great if we could make this feature usable long term.

Davo
Title: Re: QT5 with latest Lazarus has undefined references
Post by: MarkMLl on April 14, 2021, 09:42:21 am
Trunk revision 64989 builds OK for Qt5 on the same test system that I was using earlier.

MarkMLl
Title: Re: [SOLVED] QT5 with latest Lazarus has undefined references
Post by: ChrisR on April 14, 2021, 03:11:58 pm
Thanks dbannon and zeljko for solving this. Thanks to your help, QT5 is my default Lazarus Linux widgetset.
Title: Re: [SOLVED] QT5 with latest Lazarus has undefined references
Post by: prof7bit on March 02, 2022, 09:01:36 am
Today I'm getting an undefined reference again:

"lazarus undefined reference to `QGuiApplication_setFallbackSessionManagementEnabled'"


And this time it happens in the 2.2 fixes branch. I could previously build Lazarus release 2.2 and the subsequent 2.2-fixes without any problems until maybe a week or two ago (last time I tried and have not yet bisected the exact revision). In fact this is the first time ever since using Lazarus (since the early 0.9 days) that the distro supplied stable version of libqtpas is not bleeding edge enough to build stable lazarus, and not even with trunk I have ever experienced this.

May I suggest that we finally move libqt5pas into the Lazarus source tree (where the other qt5 widgetset code is living), maintain it ourselves and build it along with Lazarus?
Title: Re: [SOLVED] QT5 with latest Lazarus has undefined references
Post by: PascalDragon on March 02, 2022, 09:14:58 am
May I suggest that we finally move libqt5pas into the Lazarus source tree (where the other qt5 widgetset code is living), maintain it ourselves and build it along with Lazarus?

No, because this requires the presence of the Qt build system (GCC, cmake, etc.) as a dependency. Also when installing a Qt-based FPC application that library needs to be installable independent of Lazarus.
Title: Re: [SOLVED] QT5 with latest Lazarus has undefined references
Post by: MarkMLl on March 02, 2022, 09:16:14 am
xref to current https://forum.lazarus.freepascal.org/index.php/topic,58495.msg435640.html#msg435640
Title: Re: [SOLVED] QT5 with latest Lazarus has undefined references
Post by: prof7bit on March 02, 2022, 09:35:25 am
The breaking change happened in revision bd30173

Inside the 2.2 fixes branch!

It was to "fix" some obscure issue happening only on Manjaro-KDE (a bleeding edge experimental distribution that breaks at least once a week on its own because it is riding the bleeding tip of the KDE dev branch)

From the above revision onwards (after sideloading a newer qt5pas on my stable Ubuntu dev machine) I will no longer be able install any of my Lazarus created binaries on any of our 12 production machines downstairs (also Ubuntu LTS).

I'm now stuck at revision 201880a, the last one working on Ubuntu :-(

This should not happen in a fixes branch. I would not say anything if it happened in the main/trunk branch, but not in fixes.

Title: Re: [SOLVED] QT5 with latest Lazarus has undefined references
Post by: Templar on September 19, 2022, 05:33:39 am
also Ubuntu LTS

I tried .deb packages from https://launchpad.net/ubuntu/+source/libqtpas (https://launchpad.net/ubuntu/+source/libqtpas), version "2.6+2.2.0+dfsg1-3" for The Kinetic Kudu with my Kubuntu 22.04 (LTS), and it worked.
Title: Re: [SOLVED] QT5 with latest Lazarus has undefined references
Post by: MarkMLl on September 19, 2022, 08:51:27 am
Thanks for the confirmation, and welcome to the forum :-)

MarkMLl
Title: Re: [SOLVED] QT5 with latest Lazarus has undefined references
Post by: MitjaStachowiak on October 06, 2022, 04:22:17 pm
For solving the error with setFallbackSessionManagementEnabled, I just removed this procedure from lazarus/lcl/interfaces/qt5/qt56.pas

It is used in just one place in Lazarus, where it then can be removed, too. I think, this method is somehow deprecated > https://forum.qt.io/topic/125035/what-is-was-qguiapplication-setfallbacksessionmanagementenabled
Title: Re: [SOLVED] QT5 with latest Lazarus has undefined references
Post by: zeljko on October 10, 2022, 09:02:36 pm
It's not deprecated for qt5, only qt6.
TinyPortal © 2005-2018