Recent

Author Topic: This worries me about our current GTK2 standard  (Read 2650 times)

Curt Carpenter

  • Hero Member
  • *****
  • Posts: 693
Re: This worries me about our current GTK2 standard
« Reply #15 on: November 14, 2025, 12:37:39 am »
I will ask:  how can I try QT5 without disturbing my current Lazarus 4.2 installaton here too much?  Is there a wiki I can read on the subject?

dbannon

  • Hero Member
  • *****
  • Posts: 3619
    • tomboy-ng, a rewrite of the classic Tomboy
Re: This worries me about our current GTK2 standard
« Reply #16 on: November 14, 2025, 01:38:35 am »
Curt, it really easy.

Install libqt5pas-dev (assuming you are using a reasonably recent distro) on your system. That will bring in all of normal Qt5 libraries if they are not already there. And it will pull in the -dev libraries too.

Then, in Lazarus, open your project, go to Project->ProjectOptions->AdditionsAndOverides

From there you add a new build mode, buttons up the top, this facility is so useful you will probably use it more, so, maybe add a Qt5 and Qt5-debug mode ?

Select the Qt5 mode, and click the "LCLWidgetType" button", choose Value "Qt5".  Save. Do the same for your Qt5-debug mode if you made one. The little chart below shows you what is set for each build mode.

Thats it. Now use the pulldown near top left of Lazarus tool bar to choose either that new Qt5 mode or default. Do a build.

Useful tricks  ? I set the binary name to something different in different build modes so I can tell them apart. So, my tomboy-ng is called tomboy-ng-qt5, these get renamed during packaging.

   
Lazarus 3, Linux (and reluctantly Win10/11, OSX Monterey)
My Project - https://github.com/tomboy-notes/tomboy-ng and my github - https://github.com/davidbannon

Curt Carpenter

  • Hero Member
  • *****
  • Posts: 693
Re: This worries me about our current GTK2 standard
« Reply #17 on: November 14, 2025, 05:53:03 pm »
Curt, it really easy.

Install libqt5pas-dev (assuming you are using a reasonably recent distro) on your system. That will bring in all of normal Qt5 libraries if they are not already there. And it will pull in the -dev libraries too.
...

I appreciate your time and the helpful input dbannon.

I downloaded libqt5pas-dev and it is now in my  directory /usr/share/doc -- but I'm not sure what to do next.

 I open Project->ProjectOptions->Compiler Options -> AdditionsAndOverides but don't know what to do there to make libqt5pas-dev into a build mode option.   Don't want to take up more of your time -- can you point me to what I need to read here on the internet to understand this?


wp

  • Hero Member
  • *****
  • Posts: 13277
Re: This worries me about our current GTK2 standard
« Reply #18 on: November 14, 2025, 06:08:34 pm »
I downloaded libqt5pas-dev and it is now in my  directory /usr/share/doc -- but I'm not sure what to do next.

I open Project->ProjectOptions->Compiler Options -> AdditionsAndOverides but don't know what to do there [...]
A quick test to see whether qt5 is correct is to click on "Select LCLWidgetType" here and select the "qt5" entry. Now compile your project as usual. If something is wrong with the libqt5pas-dev and the required dependencies the linking step will report an error. If it runs, everything is fine - you have a qt5 application now. (Remove the checkmark before "qt5" in AddtitionsAndOverrides, or remove this item completely, if you want to go back to gkt2).

And when qt5 is working you can even rebuild your IDE for qt5: "Tools" > "Configure Build Lazarus" > in the "LCL widget type" combobox select "qt5" > "Build". When the IDE restarts after a while you'll have a qt5-IDE, and every application will be compiled for qt5 by default from now on.

cdbc

  • Hero Member
  • *****
  • Posts: 2533
    • http://www.cdbc.dk
Re: This worries me about our current GTK2 standard
« Reply #19 on: November 14, 2025, 06:15:37 pm »
Hi
Quote
/usr/share/doc
Hmmm, if the linker can't find it there then maybe you have to move the lib to
Code: Bash  [Select][+][-]
  1. /usr/lib(64)/
That's where mine are located anyway...  :D
Regards Benny
If it ain't broke, don't fix it ;)
PCLinuxOS(rolling release) 64bit -> KDE6/QT6 -> FPC Release -> Lazarus Release &  FPC Main -> Lazarus Main

Curt Carpenter

  • Hero Member
  • *****
  • Posts: 693
Re: This worries me about our current GTK2 standard
« Reply #20 on: November 14, 2025, 06:19:59 pm »

A quick test to see whether qt5 is correct is to click on "Select LCLWidgetType" here and select the "qt5" entry. Now compile your project as usual. If something is wrong with the libqt5pas-dev and the required dependencies the linking step will report an error. If it runs, everything is fine - you have a qt5 application now. (Remove the checkmark before "qt5" in AddtitionsAndOverrides, or remove this item completely, if you want to go back to gkt2).
"Build". When the IDE restarts after a while you'll have a qt5-IDE, and every application will be compiled for qt5 by default from now on.
...

Where can I find "Select LCLWidgetType"?  Is it an item in Project -> Project Options?

cdbc

  • Hero Member
  • *****
  • Posts: 2533
    • http://www.cdbc.dk
Re: This worries me about our current GTK2 standard
« Reply #21 on: November 14, 2025, 06:30:35 pm »
Hi Curt
Look at the attachment...
Regards Benny
If it ain't broke, don't fix it ;)
PCLinuxOS(rolling release) 64bit -> KDE6/QT6 -> FPC Release -> Lazarus Release &  FPC Main -> Lazarus Main

Curt Carpenter

  • Hero Member
  • *****
  • Posts: 693
Re: This worries me about our current GTK2 standard
« Reply #22 on: November 14, 2025, 07:19:52 pm »
Thank you -- some progress.  I now have "IDE Macro LCLWidgetType:=qt5" checked.  But compiling my simple one-button program delivers the following errors:
Quote
Compile Project, Target: /home/curt/tmp/QT5Test/project1: Exit code 1, Errors: 11, Hints: 2
Hint: Start of reading config file /home/curt/fpc/bin/i386-linux/fpc.cfg
Hint: End of reading config file /home/curt/fpc/bin/i386-linux/fpc.cfg
Verbose: Free Pascal Compiler version 3.3.1-18811-gb08c41c427-dirty [2025/11/07] for i386
Verbose: Copyright (c) 1993-2025 by Florian Klaempfl and others
Verbose: Target OS: Linux for i386
Verbose: Compiling project1.lpr
Verbose: Compiling unit1.pas
unit1.pas(17,28) Verbose: Parameter "Sender" not used
Verbose: Compiling resource /home/curt/tmp/QT5Test/lib/i386-linux/project1.or
Verbose: Linking /home/curt/tmp/QT5Test/project1
Error: /home/curt/lazarus/lcl/units/i386-linux/qt5/qtint.o: In function `Create':
qtobject.inc(54,0) Error: linker: undefined reference to `QGuiApplication_setFallbackSessionManagementEnabled'
Error: /home/curt/lazarus/lcl/units/i386-linux/qt5/qtint.o: In function `SetActiveWindow':
qtwinapi.inc(5846,0) Error: linker: undefined reference to `QGuiApplication_applicationState'
Error: /home/curt/lazarus/lcl/units/i386-linux/qt5/qtint.o: In function `SetForegroundWindow':
qtwinapi.inc(6049,0) Error: linker: undefined reference to `QGuiApplication_applicationState'
Error: /home/curt/lazarus/lcl/units/i386-linux/qt5/qtobjects.o: In function `EndX11SelectionLock':
qtobjects.pas(3906,0) Error: linker: undefined reference to `QTimer_singleShot3'
Error: /home/curt/lazarus/lcl/units/i386-linux/qt5/qtwidgets.o: In function `setTextHint':
qtwidgets.pas(10502,0) Error: linker: undefined reference to `QTextEdit_setPlaceholderText'
project1.lpr(27,1) Error: Error while linking
project1.lpr(27,1) Verbose: There were 1 errors compiling module, stopping
Verbose: Compilation aborted
Verbose: /home/curt/fpc/bin/i386-linux/ppc386 returned an error exitcode

Am I missing some dependencies or paths?

cdbc

  • Hero Member
  • *****
  • Posts: 2533
    • http://www.cdbc.dk
Re: This worries me about our current GTK2 standard
« Reply #23 on: November 14, 2025, 08:25:48 pm »
Hi Curt
Hmmm, by the looks of it, you have a mismatch in qt5 version, as the api is referencing functions & symbols, that aren't found in the actual libraries...
Is it possible for you, to upgrade your Qt5?!?
Otherwise, you might have to patch the import unit(s) -- that's not too hard  ::)
E.g.: 'QTimer_singleShot3' & 'EndX11SelectionLock', for those I have patches...
Regards Benny

eta: Have a look at the attached zip... (search for //bc)
« Last Edit: November 14, 2025, 08:29:10 pm by cdbc »
If it ain't broke, don't fix it ;)
PCLinuxOS(rolling release) 64bit -> KDE6/QT6 -> FPC Release -> Lazarus Release &  FPC Main -> Lazarus Main

Curt Carpenter

  • Hero Member
  • *****
  • Posts: 693
Re: This worries me about our current GTK2 standard
« Reply #24 on: November 14, 2025, 10:16:33 pm »
I appreciate all the help, but give up.  Curiosity will have to wait (although I guess I'm in trouble if something happens to gtk2!) 

Thanks again to all.

zeljko

  • Hero Member
  • *****
  • Posts: 1813
    • http://wiki.lazarus.freepascal.org/User:Zeljan
Re: This worries me about our current GTK2 standard
« Reply #25 on: November 14, 2025, 10:40:33 pm »
Curt Carpenter, what is your Lazarus version ?

dbannon

  • Hero Member
  • *****
  • Posts: 3619
    • tomboy-ng, a rewrite of the classic Tomboy
Re: This worries me about our current GTK2 standard
« Reply #26 on: November 14, 2025, 11:52:35 pm »
I downloaded libqt5pas-dev and it is now in my  directory /usr/share/doc -- but I'm not sure what to do next.

Curt, have you installed libq5pas-dev ?  I expected you to install it from from your systems official repository. By running that install, all the other necessary Qt5 things come along.  If you have a reasonably recent distro (ie Debian Trixie, Ubuntu 24.0 ...), then it will have the current libqt5pas-dev.  If you are using something older, you will need to download BOTH libqt5pas-dev and libqt5pas1 from https://github.com/davidbannon/libqt5pas/releases, install them an in doing so, the other Qt5 libraries will be installed (from you distros official repo).

Installing from your official repo is far and away easier, just one command, I don't think you mentioned what distro and its version ....

Davo

Lazarus 3, Linux (and reluctantly Win10/11, OSX Monterey)
My Project - https://github.com/tomboy-notes/tomboy-ng and my github - https://github.com/davidbannon

Curt Carpenter

  • Hero Member
  • *****
  • Posts: 693
Re: This worries me about our current GTK2 standard
« Reply #27 on: November 15, 2025, 03:36:16 am »
I am running Ubuntu 18.04.6 32bit, Lazarus 4.2 and FPC 3.2.2.  I have a recently configured Ubuntu 24.04.3 64bit system with a new Lazarus 4.2 installed from Source Forge, and will give it a try in the next day or so.  Right now, my project is falling behind so I need to get to work  :)

Really do appreciate all the help.  Suspect the problem is with me, not Lazarus or Linux.

zeljko

  • Hero Member
  • *****
  • Posts: 1813
    • http://wiki.lazarus.freepascal.org/User:Zeljan
Re: This worries me about our current GTK2 standard
« Reply #28 on: November 15, 2025, 09:25:47 am »
In that case your libQt5Pas is too old.

Curt Carpenter

  • Hero Member
  • *****
  • Posts: 693
Re: This worries me about our current GTK2 standard
« Reply #29 on: November 15, 2025, 05:15:37 pm »
In that case your libQt5Pas is too old.
or too new perhaps given my Ubuntu 18 32bit.

 

TinyPortal © 2005-2018