Recent

Author Topic: Error: Qt is not installed.  (Read 15043 times)

Fred vS

  • Hero Member
  • *****
  • Posts: 3168
    • StrumPract is the musicians best friend
Error: Qt is not installed.
« on: August 15, 2011, 08:24:24 pm »
Hello everybody. :)
I have a free DJ application compiled with Qt.
If Qt is not installed I want that the application shows a error message like : "Error, Qt libraries are not installed, please do a sudo apt-get install Qt".
But, of course, if Qt is not installed, message dialogs do not works... :(
Anybody have a idea how to show such a message and how to know that Qt is installed ?
Thanks.
I use Lazarus 2.2.0 32/64 and FPC 3.2.2 32/64 on Debian 11 64 bit, Windows 10, Windows 7 32/64, Windows XP 32,  FreeBSD 64.
Widgetset: fpGUI, MSEgui, Win32, GTK2, Qt.

https://github.com/fredvs
https://gitlab.com/fredvs
https://codeberg.org/fredvs

Blaazen

  • Hero Member
  • *****
  • Posts: 3237
  • POKE 54296,15
    • Eye-Candy Controls
Re: Error: Qt is not installed.
« Reply #1 on: August 15, 2011, 09:08:55 pm »
If you try run your Qt-application or Lazarus itself without libQt4pas.so installed, then you have this output in console:
Code: [Select]
$ ./lazarus
./lazarus: error while loading shared libraries: libQt4Pas.so.5: cannot open shared object file: No such file or directory
This is common behaviour on Linux. Linux users usually know that they have to run it from console to see what's bad.
Lazarus 2.3.0 (rev main-2_3-2863...) FPC 3.3.1 x86_64-linux-qt Chakra, Qt 4.8.7/5.13.2, Plasma 5.17.3
Lazarus 1.8.2 r57369 FPC 3.0.4 i386-win32-win32/win64 Wine 3.21

Try Eye-Candy Controls: https://sourceforge.net/projects/eccontrols/files/

Fred vS

  • Hero Member
  • *****
  • Posts: 3168
    • StrumPract is the musicians best friend
Re: Error: Qt is not installed.
« Reply #2 on: August 15, 2011, 09:24:58 pm »
Hello Mr Blaazen and thanks for your answer...
Code: [Select]
Linux users usually know that they have to run it from console to see what's bad.
Of course, but for helping Linux Dummies, is there a way to show a message dialog without Qt installed ?
I use Lazarus 2.2.0 32/64 and FPC 3.2.2 32/64 on Debian 11 64 bit, Windows 10, Windows 7 32/64, Windows XP 32,  FreeBSD 64.
Widgetset: fpGUI, MSEgui, Win32, GTK2, Qt.

https://github.com/fredvs
https://gitlab.com/fredvs
https://codeberg.org/fredvs

Leledumbo

  • Hero Member
  • *****
  • Posts: 8757
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: Error: Qt is not installed.
« Reply #3 on: August 16, 2011, 12:04:35 am »
Quote
Of course, but for helping Linux Dummies, is there a way to show a message dialog without Qt installed ?
You can try LoadLibrary-ing a Qt lib (QtCore is enough maybe?), and check the return value.

felipemdc

  • Administrator
  • Hero Member
  • *
  • Posts: 3538
Re: Error: Qt is not installed.
« Reply #4 on: August 16, 2011, 08:57:26 am »
Of course, but for helping Linux Dummies, is there a way to show a message dialog without Qt installed ?

Yes, but not using the LCL. You can use for example X11 in Linux. It is almost always installed, it could be safe. Your code could be something like this:

<delphi>
program blabla;
....
begin
  lLib := LoadLibrary(...);
  if lLib = nil then
  begin
    ShowX11MessageBox;
  end;
end.
</delphi>

And you can implement the message box using X11. A initial code to get started: http://wiki.lazarus.freepascal.org/X11#A_window_with_a_message

In Windows you can use the Windows API. There is a API for showing message boxes, so it should be much easier.

Fred vS

  • Hero Member
  • *****
  • Posts: 3168
    • StrumPract is the musicians best friend
Re: Error: Qt is not installed.
« Reply #5 on: August 16, 2011, 10:32:20 pm »
@ Mr Blaazen, Leledumbo and Felipemdc
Thank you, gracias, obrigado...
I gonna test it... ;D
I use Lazarus 2.2.0 32/64 and FPC 3.2.2 32/64 on Debian 11 64 bit, Windows 10, Windows 7 32/64, Windows XP 32,  FreeBSD 64.
Widgetset: fpGUI, MSEgui, Win32, GTK2, Qt.

https://github.com/fredvs
https://gitlab.com/fredvs
https://codeberg.org/fredvs

felipemdc

  • Administrator
  • Hero Member
  • *
  • Posts: 3538
Re: Error: Qt is not installed.
« Reply #6 on: August 17, 2011, 08:57:40 am »
Another thing to notice. I think that this might be impossible, because afaik the link to libQt4Pas.so is static so the error message is from the operating system and your program doesn't even start executing. In that case it will be impossible to change how the operating system handles this kind of error.

BigChimp

  • Hero Member
  • *****
  • Posts: 5740
  • Add to the wiki - it's free ;)
    • FPCUp, PaperTiger scanning and other open source projects
Re: Error: Qt is not installed.
« Reply #7 on: August 17, 2011, 09:46:49 am »
Seems like a better idea is to use the distribution's packaging system and create .deb/.rpm/etc files where the Qt dependency is included.

Or create a launcher app that checks for qt and runs the main app if present.
Want quicker answers to your questions? Read http://wiki.lazarus.freepascal.org/Lazarus_Faq#What_is_the_correct_way_to_ask_questions_in_the_forum.3F

Open source including papertiger OCR/PDF scanning:
https://bitbucket.org/reiniero

Lazarus trunk+FPC trunk x86, Windows x64 unless otherwise specified

Fred vS

  • Hero Member
  • *****
  • Posts: 3168
    • StrumPract is the musicians best friend
Re: Error: Qt is not installed.
« Reply #8 on: August 17, 2011, 11:27:20 pm »
@ BigChimp

Quote
Or create a launcher app that checks for qt

Ok, and how to do it  :-[

Thanks
I use Lazarus 2.2.0 32/64 and FPC 3.2.2 32/64 on Debian 11 64 bit, Windows 10, Windows 7 32/64, Windows XP 32,  FreeBSD 64.
Widgetset: fpGUI, MSEgui, Win32, GTK2, Qt.

https://github.com/fredvs
https://gitlab.com/fredvs
https://codeberg.org/fredvs

BigChimp

  • Hero Member
  • *****
  • Posts: 5740
  • Add to the wiki - it's free ;)
    • FPCUp, PaperTiger scanning and other open source projects
Re: Error: Qt is not installed.
« Reply #9 on: August 20, 2011, 12:06:34 pm »
@ BigChimp

Quote
Or create a launcher app that checks for qt

Ok, and how to do it  :-[

Thanks
I'd have a look at Leledumbo's & Felipe's posts: write an FPC program that uses LoadLibrary to load a core QT library. If that fails, show a message box using X11 code on Linux (or Win32 API or OSX Carbon/Cocoa...).
If it works, execute the main Qt program (using TProcess or whatever)...

Regards,
BigChimp
Want quicker answers to your questions? Read http://wiki.lazarus.freepascal.org/Lazarus_Faq#What_is_the_correct_way_to_ask_questions_in_the_forum.3F

Open source including papertiger OCR/PDF scanning:
https://bitbucket.org/reiniero

Lazarus trunk+FPC trunk x86, Windows x64 unless otherwise specified

DenJean

  • New Member
  • *
  • Posts: 18
Re: Error: Qt is not installed.
« Reply #10 on: August 24, 2011, 10:35:25 am »
Let your user start the program by a script, the script calls the actual program if Qt is available and otherwise use the many ways available to send a system message. So check existence of the message program, if it fails try the next one.

notify-send -t 0 "Testing" "Hello there"
xmessage -button ok -center file - "Hello"
shutdown -k -t 0 now "Hello"

 

TinyPortal © 2005-2018