Results 1 to 6 of 6

Thread: run qt program on linux

  1. #1
    Join Date
    Feb 2013
    Posts
    19
    Thanks
    4
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default run qt program on linux

    Hello together,

    first, sry for this stupid question but i tried to solve it with google and the search function but wasnt able to find s.th ....

    I wanna run a qt program (nothing special on a stand alone linux machine).
    Machine 1: ubuntu 12.04 qt 4.8 compiled the program and it works well. (dynamic linking so i need to put the qt libs near the executeable file that the OS can find them.)
    Machine2: ubuntu 12.04 (no qt installed) wont run the program cause i need to give the program some libs or? On Windows i just put the neccessary qt dll´s in a path the .exe can find them and then the program runs on windows. But i am a newbie on linux, so i looked for qt .so files but dont find them...

    So the question is, how can i use a program which is compiled on ubuntu on another linux machine without installing qt?

    TIA for ur help!
    Anenja

  2. #2
    Join Date
    Aug 2009
    Location
    coimbatore,India
    Posts
    314
    Thanks
    37
    Thanked 47 Times in 43 Posts
    Qt products
    Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: run qt program on linux

    Hi anenja,

    Just check the docs,
    http://qt-project.org/doc/qt-4.8/deployment-x11.html

    But i am a newbie on linux, so i looked for qt .so files but dont find them
    You didnt mention the Qt version you are using.

    If you are using Qt5.0, you can find the libs under,
    /home/noufal/Qt5.0.1/5.0.1/gcc/lib/

    So the question is, how can i use a program which is compiled on ubuntu on another linux machine without installing qt?
    You need all the required lib files. For ex: if you are using QtGui then you need QtGui lib file.
    You need to copy all the required lib files inside the application dir.

    In your target system, just try to run the application using terminal
    ex: ./myApp
    Application will complain about the required lib files. Just copy the libs in the app dir.

    Hope it helps,
    Bala

  3. The following user says thank you to BalaQT for this useful post:

    Anenja (8th April 2013)

  4. #3
    Join Date
    Feb 2013
    Posts
    19
    Thanks
    4
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: run qt program on linux

    Hi,

    thanks for ur reply. i Give it a try this evening and post the result.
    btw. qt version 4.8.

    Thanks!

  5. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: run qt program on linux

    Google for LD_LIBRARY_PATH and/or "rpath linker option".
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  6. #5
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: run qt program on linux

    Quote Originally Posted by Anenja View Post
    Machine 1: ubuntu 12.04 qt 4.8 compiled the program and it works well. (dynamic linking so i need to put the qt libs near the executeable file that the OS can find them.)
    Obviously the OS finds the libs installed in the system wide location

    Quote Originally Posted by Anenja View Post
    Machine2: ubuntu 12.04 (no qt installed) wont run the program cause i need to give the program some libs or?
    The most common thing is to ship the Qt libraries with the program, e.g. putting them in the same directory as the executable, and have a starter script that sets LD_LIBRARY_PATH to include that directory.

    LD_LIBRARY_PATH is an environment variable that works similar to PATH, but on libraries instead of executables.
    It is usually unset (not set at all), so libraries are only searched for in system locations. It can be set to a colon separate list of directories that are then searched before falling back to system locations.

    For example: if you had a program installed in /opt/myprogram/bin and some libraries in the same directory, then
    cd /opt/myprogram/bin
    export LD_LIBRARY_PATH=$(pwd):$LD_LIBRARY_PATH
    ./myprogram

    would try to find libraries needed by myprogram first in /opt/myprogram/bin, then in any other path that was in LD_LIBRARY_PATH before the new export and finally in all system locations.

    Cheers,
    _

  7. The following user says thank you to anda_skoa for this useful post:

    Anenja (8th April 2013)

  8. #6
    Join Date
    Feb 2013
    Posts
    19
    Thanks
    4
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default [SOLVED] Re: run qt program on linux

    Thanks for all the help!

    Sorry for the late answer, i have not much time to try all ur hints.
    It works like u all said, if i put the libs to the executeable - the LD_LIBRARY_PATH is really nice to know and i will google for it.


    Wish u all a nice day.

Similar Threads

  1. Building QT program on the Linux in QtCreator
    By piyushpandey in forum Newbie
    Replies: 2
    Last Post: 18th January 2011, 22:29
  2. My first Linux QT program wont compile
    By GrahamLabdon in forum Newbie
    Replies: 1
    Last Post: 27th October 2010, 16:49
  3. How to shutdown Linux machine from QT Program?
    By Kevin Hoang in forum Qt Programming
    Replies: 3
    Last Post: 20th August 2010, 21:42
  4. Program in Windows, Deploy in Linux
    By suitto in forum Installation and Deployment
    Replies: 1
    Last Post: 8th April 2009, 14:11
  5. QT Program debug,GDB on Linux
    By darpan in forum General Programming
    Replies: 1
    Last Post: 26th January 2007, 23:02

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.