Recent

Author Topic: [SOLVED] Linker Error compiling Target QT5  (Read 7020 times)

Zvoni

  • Hero Member
  • *****
  • Posts: 2319
[SOLVED] Linker Error compiling Target QT5
« on: March 09, 2019, 11:45:48 am »
Hi Folks,

something strange: On Laz1.8.2 i could successfully compile to QT5-Widgetset.
Now on Laz 2.0.0 i get a Linker-Error
LibQT5pas is installed (incl. the dev's), lclextensions are installed (i checkd the folder)

Now i have this error:
Quote
linker: /usr/bin/ld: //usr/share/lazarus/2.0.0/lcl/units/x86_64-linux/qt5/qtwidgets.o: in function `QTWIDGETS$_$TQTTEXTEDIT_$__$$_SETTEXTHINT$ANSISTRING':
qtwidgets.pas:(.text.n_qtwidgets$_$tqttextedit_$__$$_settexthint$ansistring+0x6d): undefined reference to `QTextEdit_setPlaceholderText'
constants.lpr(22,1) Error: Error while linking

Funny thing: i can't even compile the IDE to any other Widgetset except GTK2.
For QT5 i get exactly the same error as above plus
[Makefile:4144: lazarus] Error 1
[Makefile:4574: idepkg] Error 2
make: *** [Makefile:3380: idepkg] Error 2
lazarus.pp(165,1) Error: Error while linking

Ubuntu 18.10-64Bit/FPC3.0.4/Laz2.0.0
Help?
« Last Edit: March 09, 2019, 01:15:30 pm by Zvoni »
One System to rule them all, One Code to find them,
One IDE to bring them all, and to the Framework bind them,
in the Land of Redmond, where the Windows lie
---------------------------------------------------------------------
Code is like a joke: If you have to explain it, it's bad

Cyrax

  • Hero Member
  • *****
  • Posts: 836
Re: Linker Error compiling Target QT5
« Reply #1 on: March 09, 2019, 11:52:45 am »
Did you build LibQT5pas by yourself? Or did it come in binary format from someones else repository? I would suggest that you rebuild LibQT5pas. If that didn't help, then grab latest source of LibQT5pas from the Lazarus trunk and then rebuild it.

Zvoni

  • Hero Member
  • *****
  • Posts: 2319
Re: Linker Error compiling Target QT5
« Reply #2 on: March 09, 2019, 12:00:34 pm »
Did you build LibQT5pas by yourself? Or did it come in binary format from someones else repository? I would suggest that you rebuild LibQT5pas. If that didn't help, then grab latest source of LibQT5pas from the Lazarus trunk and then rebuild it.

It's from the Distro-repository.
Never done that the building from source. Any pointers to a How-To?
One System to rule them all, One Code to find them,
One IDE to bring them all, and to the Framework bind them,
in the Land of Redmond, where the Windows lie
---------------------------------------------------------------------
Code is like a joke: If you have to explain it, it's bad

Cyrax

  • Hero Member
  • *****
  • Posts: 836
Re: Linker Error compiling Target QT5
« Reply #3 on: March 09, 2019, 12:02:46 pm »
Did you build LibQT5pas by yourself? Or did it come in binary format from someones else repository? I would suggest that you rebuild LibQT5pas. If that didn't help, then grab latest source of LibQT5pas from the Lazarus trunk and then rebuild it.

It's from the Distro-repository
Never done that the building from source. Any pointers to a How-To?

Then you need to tell one who is maintainer of it to update it. Or build it yourself. See Ubuntu wiki how it is done. I use Arch so I can't help with it.
« Last Edit: March 09, 2019, 12:05:09 pm by Cyrax »

Zvoni

  • Hero Member
  • *****
  • Posts: 2319
Re: Linker Error compiling Target QT5
« Reply #4 on: March 09, 2019, 12:25:28 pm »
OK, found everything.

The highest version of QT5 is 5.12 right now.
http://download.qt.io/archive/qt/
the cbindings tell me 5.6.1 or higher.
Any known issues with this big difference in Versions?

EDIT: huh? just did a qmake inside the lcl/interfaces/qt/cbindings folder.
Quote
Project MESSAGE: Note: This binding version was generated for Qt 5.6.1. Current Qt is 4.8.7
Project MESSAGE: Qt documents binary compatibility in each Version Change Note: http://qt.nokia.com/developer/changes
Project MESSAGE: Adding x11extras for XOrg platform.
Project MESSAGE: Pascal Qt Interface for binding platform: BINUX
Project MESSAGE: Install location: /usr/lib/x86_64-linux-gnu
Project MESSAGE: Warning: unknown QT: x11extras
Failure to open file: /usr/share/lazarus/2.0.0/lcl/interfaces/qt5/cbindings/Makefile
Unable to generate makefile for: /usr/share/lazarus/2.0.0/lcl/interfaces/qt5/cbindings/Qt5Pas.pro
4.8.7?????
QT5Core is at 5.11


EDIT: Solved the 4.8.7 --> qt5-default was missing.
Now qmake runs (had to sudo it).
final line is this:
Project ERROR: Unknown module(s) in QT: x11extras
???
EDIT: Solved that error. qt5x11-dev's missing
« Last Edit: March 09, 2019, 12:51:36 pm by Zvoni »
One System to rule them all, One Code to find them,
One IDE to bring them all, and to the Framework bind them,
in the Land of Redmond, where the Windows lie
---------------------------------------------------------------------
Code is like a joke: If you have to explain it, it's bad

Zvoni

  • Hero Member
  • *****
  • Posts: 2319
Re: Linker Error compiling Target QT5
« Reply #5 on: March 09, 2019, 01:15:02 pm »
HOORRRAYYYYYY!
I'm now a proud owner of Lazarus 2.0.0 with a QT5-Interface
Thanx Cyrax for pointing me in the right direction.
One System to rule them all, One Code to find them,
One IDE to bring them all, and to the Framework bind them,
in the Land of Redmond, where the Windows lie
---------------------------------------------------------------------
Code is like a joke: If you have to explain it, it's bad

zeljko

  • Hero Member
  • *****
  • Posts: 1594
    • http://wiki.lazarus.freepascal.org/User:Zeljan
Re: [SOLVED] Linker Error compiling Target QT5
« Reply #6 on: March 09, 2019, 02:23:23 pm »
Hi Folks,

something strange: On Laz1.8.2 i could successfully compile to QT5-Widgetset.
Now on Laz 2.0.0 i get a Linker-Error
LibQT5pas is installed (incl. the dev's), lclextensions are installed (i checkd the folder)

Now i have this error:
Quote
linker: /usr/bin/ld: //usr/share/lazarus/2.0.0/lcl/units/x86_64-linux/qt5/qtwidgets.o: in function `QTWIDGETS$_$TQTTEXTEDIT_$__$$_SETTEXTHINT$ANSISTRING':
qtwidgets.pas:(.text.n_qtwidgets$_$tqttextedit_$__$$_settexthint$ansistring+0x6d): undefined reference to `QTextEdit_setPlaceholderText'
constants.lpr(22,1) Error: Error while linking

Problem is that distro maintainers didn't rebuild libQt5Pas with lazarus 2.0. They have sources in lcl/interfaces/qt5/cbindings. Someone should open bug for that distro , so they can rebuild libQt5Pas to the release version.


dbannon

  • Hero Member
  • *****
  • Posts: 2786
    • tomboy-ng, a rewrite of the classic Tomboy
Re: [SOLVED] Linker Error compiling Target QT5
« Reply #7 on: April 09, 2019, 01:46:46 am »
Zvoni, I understand you have downloaded a newer (than the Ubuntu distro repo) version of Qt5 and built it yourself.

Is that only necessary to build your app ?  Can someone else who just wants to run it rely on the distro provided libraries ?

Thanks in advance ...

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

zeljko

  • Hero Member
  • *****
  • Posts: 1594
    • http://wiki.lazarus.freepascal.org/User:Zeljan
Re: [SOLVED] Linker Error compiling Target QT5
« Reply #8 on: April 09, 2019, 10:32:10 am »
Zvoni, I understand you have downloaded a newer (than the Ubuntu distro repo) version of Qt5 and built it yourself.

Is that only necessary to build your app ?  Can someone else who just wants to run it rely on the distro provided libraries ?

Thanks in advance ...

Davo

For Qt4 yes, for Qt5 not since distro maintainers does not rebuild libQt5Pas as it changes in our trunk (they should rebuild libQt5Pas on each lazarus release). I hope that
there won't be any changes in libQt5Pas in future (current trunk have some changes, but I'm still not sure to merge it to lazarus 2.0.2 or not).

dbannon

  • Hero Member
  • *****
  • Posts: 2786
    • tomboy-ng, a rewrite of the classic Tomboy
Re: [SOLVED] Linker Error compiling Target QT5
« Reply #9 on: April 09, 2019, 12:47:48 pm »
Ah thanks zeljko, thats all a bit funny isn't it ?

I guess I could also ship a new libQt5Pas.so.1 with my app but users really don't like that sort of thing.

I don't think it makes sense to nag the distro maintainer though, for example, I use Ubuntu 18.04 right now, that shipped with Lazarus 1.8.2 so, if anything I'd expect libqt5pas to match the 1.8.2 standard. But I actually compile with fixes_2_0 so thats not going to work for me. Even harder for the end use.....

Apart from libqt5pas, the (eg Ubuntu) distro install is OK then ?     Maybe it makes sense to recompile qt5.pas, heaps easier and less invasive that downloading 1.5G of Qt5 and rebuilding all of that ?

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

zeljko

  • Hero Member
  • *****
  • Posts: 1594
    • http://wiki.lazarus.freepascal.org/User:Zeljan
Re: [SOLVED] Linker Error compiling Target QT5
« Reply #10 on: April 09, 2019, 05:57:35 pm »
You don't recompile qt5.pas but Qt5Pas C bindings. I prefer when it's builded by distro and can be installed via package manager, but sure, you can build it on your own and deploy with your app.

dbannon

  • Hero Member
  • *****
  • Posts: 2786
    • tomboy-ng, a rewrite of the classic Tomboy
Re: [SOLVED] Linker Error compiling Target QT5
« Reply #11 on: April 10, 2019, 03:14:15 am »
You don't recompile qt5.pas but Qt5Pas C bindings.

OK, makes sense. And worked fine. Thanks zeliko !

I prefer when it's builded by distro and can be installed via package manager,
Yes, agree 100% but the touble is that there are too many combinations for that to work (?). As I understand it, libQt5Pas needs to match the compiler the app was built from, not the distro itself ?  So, if someone has, lets say, a QT5 app built using Lazarus 1.6 it might need a different library than a second app built using Lazarus 2.0.0 ?  So, if they update their library, the older app may stop working ?

 
but sure, you can build it on your own and deploy with your app.
hmm, maybe not ?  I'd need to build them a library to match the combination of their version of QT and my version of Lazarus, a mistake might mess up their system perhaps ?

Interesting ......

In case someone else wanders across this thread, to build that libQt5Pas library, I did -

  • cd to your current Lazarus install and down to lcl/interfaces/qt5/cbindings/  Read the README, its useful.
  • I found I had a non functioning qmake, wanted to use no existing qt4 tools. Install (from package manager) qt5-qmake. And then when using it, give its full pathname.
  • I had to install (via package manager again) libqt5x11extras5-dev before a successful run of /usr/lib/qt5/bin/qmake
  • make <enter>    (had an awful lot of work to do, maybe I have got too used to fpc fast compiling !)
  • eventually that generated libQt5Pas.so.1.2.6, same name as the one offered in package manager but 40 times the size (degugging stuff still in there ??). I manually copied that to /usr/lib/x86_64-linux-gnu/ (in my case overwriting the repo supplied one). Note needs symlinks to libQt5Pas.so, libQt5Pas.so.1 and libQt5Pas.so.1.2
After that, Lazarus could build my app with Qt5 no probs.

Now to determine if it will run on other machines as easily ....

(Thanks zeljko, would never got this far without your help.)
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

zeljko

  • Hero Member
  • *****
  • Posts: 1594
    • http://wiki.lazarus.freepascal.org/User:Zeljan
Re: [SOLVED] Linker Error compiling Target QT5
« Reply #12 on: April 10, 2019, 08:58:45 am »
eventually that generated libQt5Pas.so.1.2.6, same name as the one offered in package manager but 40 times the size (degugging stuff still in there ??). I manually copied that to /usr/lib/x86_64-linux-gnu/ (in my case overwriting the repo supplied one). Note needs symlinks to libQt5Pas.so, libQt5Pas.so.1 and libQt5Pas.so.1.2

In Qt5Pas.pro file set -=debug and +=release so size will be about 2.5 Mb (and then rebuild bindings)


mdalacu

  • Full Member
  • ***
  • Posts: 233
    • dmSimpleApps
Re: [SOLVED] Linker Error compiling Target QT5
« Reply #13 on: January 06, 2020, 08:43:59 am »
You don't recompile qt5.pas but Qt5Pas C bindings.

OK, makes sense. And worked fine. Thanks zeliko !

I prefer when it's builded by distro and can be installed via package manager,
Yes, agree 100% but the touble is that there are too many combinations for that to work (?). As I understand it, libQt5Pas needs to match the compiler the app was built from, not the distro itself ?  So, if someone has, lets say, a QT5 app built using Lazarus 1.6 it might need a different library than a second app built using Lazarus 2.0.0 ?  So, if they update their library, the older app may stop working ?

 
but sure, you can build it on your own and deploy with your app.
hmm, maybe not ?  I'd need to build them a library to match the combination of their version of QT and my version of Lazarus, a mistake might mess up their system perhaps ?

Interesting ......

In case someone else wanders across this thread, to build that libQt5Pas library, I did -

  • cd to your current Lazarus install and down to lcl/interfaces/qt5/cbindings/  Read the README, its useful.
  • I found I had a non functioning qmake, wanted to use no existing qt4 tools. Install (from package manager) qt5-qmake. And then when using it, give its full pathname.
  • I had to install (via package manager again) libqt5x11extras5-dev before a successful run of /usr/lib/qt5/bin/qmake
  • make <enter>    (had an awful lot of work to do, maybe I have got too used to fpc fast compiling !)
  • eventually that generated libQt5Pas.so.1.2.6, same name as the one offered in package manager but 40 times the size (degugging stuff still in there ??). I manually copied that to /usr/lib/x86_64-linux-gnu/ (in my case overwriting the repo supplied one). Note needs symlinks to libQt5Pas.so, libQt5Pas.so.1 and libQt5Pas.so.1.2
After that, Lazarus could build my app with Qt5 no probs.

Now to determine if it will run on other machines as easily ....

(Thanks zeljko, would never got this far without your help.)
Davo
Thank you , you have made my day!

dbannon

  • Hero Member
  • *****
  • Posts: 2786
    • tomboy-ng, a rewrite of the classic Tomboy
Re: [SOLVED] Linker Error compiling Target QT5
« Reply #14 on: January 08, 2020, 01:43:23 am »
Before you get too happy, be aware that Ubuntu's "unattended update" feature overwrites the newly created library if you install it from a deb. You need to blacklist that particular library.
 >:(
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

 

TinyPortal © 2005-2018