Results 1 to 18 of 18

Thread: Deploying Qt Application under Linux

  1. #1
    Join Date
    May 2009
    Posts
    129

    Default Deploying Qt Application under Linux

    I had never deployed Qt application under linux..

    My application i have used following module additionally

    1) Qt network

    2) Qt webkit

    3) Qt Sql

    I tried with application distribution with following libs along with my application

    1) Application folder

    1) application
    2) libQtGui.so.4
    3) libQtCore.so.4
    4) libQtNetwok.so.4
    5) libQtxml.so.4
    6) libQtWebkit.so.4
    7)libQtSql.so.4
    8) sql drivers folder

    But i am getting error message ../Maxxtel could not able to run.

    please help me

    Thanks

    Yuvaraj R

  2. #2
    Join Date
    Mar 2007
    Posts
    57
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Deploying Qt Application under Linux

    In general, there are two "good" options for this.

    1) Use dynamic linking and let people install Qt form their linux software repositories, or
    2) Use static linking so people don't need any additional libs (except libc and such obviously)

    Which of these are you trying to do? Furthermore, it may help if you post the real error message instead of "could not able to run".

  3. #3
    Join Date
    May 2009
    Posts
    129

    Default Re: Deploying Qt Application under Linux

    till now i have been using dyanamic method under windows

    In linux i want use static method .

    please explain me about static method.

    how do we distribute the application using static method ?

    Thanks

    Yuvaraj R

  4. #4
    Join Date
    Jan 2009
    Location
    Germany
    Posts
    131
    Thanks
    11
    Thanked 16 Times in 16 Posts
    Qt products
    Qt3 Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Deploying Qt Application under Linux

    Did you read http://qt.nokia.com/doc/4.5/deployment-x11.html and maybe http://qt.nokia.com/doc/4.5/qt-conf.html?


    But i am getting error message ../Maxxtel could not able to run.
    What error message? Please help us and give us real example :-)

  5. #5
    Join Date
    Sep 2009
    Location
    UK
    Posts
    2,447
    Thanks
    6
    Thanked 348 Times in 333 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Deploying Qt Application under Linux

    You can't put dynamic libs in the same directory as the executable under Linux unless you modify the library search path, and even then, a simple library called libQtGui.so.4 will not be used without a symlink to specify the current library version (usually created by installing the library into the system library dir). This will be why you are getting this error. Under Windows it always searches the application path first.

    Its much easier to just add the Qt dependancy to your package and distribute that. When people install your app it will automatically install Qt if necessary (which is the preferred way of distributing Linux apps). If you don't want to package your application, then you must use static linking, but this requires you to rebuild Qt and pay Nokia money unless your app is open source.
    Last edited by squidge; 24th October 2009 at 11:03.

  6. #6
    Join Date
    May 2009
    Posts
    129

    Default Re: Deploying Qt Application under Linux

    Hi

    I opened nighthost mentioned links , but i didn't opned..

    How do add Qt dependencies for my package distibution ..

    please provide me related links

    Thanks

    Yuvaraj R

  7. #7
    Join Date
    Sep 2009
    Location
    UK
    Posts
    2,447
    Thanks
    6
    Thanked 348 Times in 333 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Deploying Qt Application under Linux

    I think you should read this: http://en.wikipedia.org/wiki/Package_management_system for better understanding.

  8. #8
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: Deploying Qt Application under Linux

    Addu,

    Your initial problem with failing to load the program could be helped by some of these:
    • Reading the man page for ldd (1) and running it on your executable.
    • Reading the man page for ld.so (8) particularly about the environment variable LD_LIBRARY_PATH and also when it is ignored.
    • Using a script to wrap your executable and adjust with the LD_LIBRARY_PATH before handling off to your executable.
    • Building a statically linked executable (but read and understand your Qt License first).


    Without being able to read minds we cannot help you with packaging your product. You need to tell us:
    1. Whether you can distribute source or the product is binary only. If you can distribute source, and the end-user can build it, then you may only need to put dependency info in a Readme file. If binary only you need to package using a tool that the target OS can understand so the user does not have to guess.
    2. What your target Linux audience is: tech savvy, not tech savvy, people who normally use Windows, paying or non-paying users etc.
    3. What distros they are running. Packaging for Ubuntu (Debian), Redhat (CentOS), Gentoo or Slackware is different. Google for dpkg, RPM, ebuild, ...


    It almost always helps to tell people what you have already tried, provide exact error messages if that's what you are asking about, provide that actual code of a minimal program that reproduces the fault if possible, explain what you expected to happen etc. Put some effort into asking smart questions and you'll get much more helpful answers.

  9. #9
    Join Date
    Oct 2009
    Posts
    364
    Thanks
    10
    Thanked 37 Times in 36 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Deploying Qt Application under Linux

    I'm not sure whether this is the best solution, but I was able to deploy on linux (ubuntu 9.04) like this:

    create a file myapp.conf in /etc/ld.so.conf.d/
    Inside that myapp.conf file, you should list the directory where your application plus libs reside.
    For example myapp.conf will contain a single line:
    /home/schnitzel/myapp

    I believe you have to then run the command ldconfig. This method is way better than futzing around with LD_LIBRARY_PATH.

    My app uses dynamic linking so my application folder contains only qt core, gui libs, two third party libs and some plugins.

    I still have to wrap my head around creating a package in order to make the install procedure as simple as possible.

    Is it possible to create an ubuntu package with only binaries in it?

  10. #10
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: Deploying Qt Application under Linux

    This method is way better than futzing around with LD_LIBRARY_PATH.
    This method affects the system globally and does leave you open to dynamically linking to the first libQtCore.so.4 (a symlink to a specific version like libQtCore.so.4.5.2) the system finds in the ld.so search path. Normally this is not a problem but can be if, for example, you rely on a fix Qt in 4.5.3 and the first Qt that is found is a Qt 4.5.0 because that's in the path earlier. Conversely, your version might be found first and break someone else's app. Binaries I have built tend to link by name to libQtCore.so.4 (i.e. any Qt4 vers) and not libQtCore.so.4.5.2, but there is probably a way to force this if a specific version is required.

    The script approach makes the change local to your application. For example this is the wrapper for the Google Earth app on my machine:
    Qt Code:
    1. #!/bin/sh
    2. cd "/opt/googleearth"
    3. if [ -n "." ] ; then
    4. if [ "${LD_LIBRARY_PATH+set}" = "set" ] ; then
    5. export LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:."
    6. else
    7. export LD_LIBRARY_PATH="."
    8. fi
    9. fi
    10. exec ./googleearth "$@"
    To copy to clipboard, switch view to plain text mode 
    Last edited by ChrisW67; 25th October 2009 at 09:20. Reason: updated contents

  11. The following user says thank you to ChrisW67 for this useful post:

    schnitzel (25th October 2009)

  12. #11
    Join Date
    Oct 2009
    Posts
    364
    Thanks
    10
    Thanked 37 Times in 36 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Deploying Qt Application under Linux

    Quote Originally Posted by ChrisW67 View Post
    This method affects the system globally and does leave you open to dynamically linking to the first libQtCore.so.4 (a symlink to a specific version like libQtCore.so.4.5.2) the system finds in the ld.so search path. Normally this is not a problem but can be if, for example, you rely on a fix Qt in 4.5.3 and the first Qt that is found is a Qt 4.5.0 because that's in the path earlier. Conversely, your version might be found first and break someone else's app. Binaries I have built tend to link by name to libQtCore.so.4 (i.e. any Qt4 vers) and not libQtCore.so.4.5.2, but there is probably a way to force this if a specific version is required.

    The script approach makes the change local to your application. For example this is the wrapper for the Google Earth app on my machine:
    Qt Code:
    1. #!/bin/sh
    2. cd "/opt/googleearth"
    3. if [ -n "." ] ; then
    4. if [ "${LD_LIBRARY_PATH+set}" = "set" ] ; then
    5. export LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:."
    6. else
    7. export LD_LIBRARY_PATH="."
    8. fi
    9. fi
    10. exec ./googleearth "$@"
    To copy to clipboard, switch view to plain text mode 
    I will try your approach - somehow I was a bit ignorant and thinking the app.conf file would only be relevant to my app.

  13. #12
    Join Date
    May 2009
    Posts
    129

    Default Re: Deploying Qt Application under Linux

    Hi

    i referred the ldd and ld.so commands

    In Qt unstalled systems i ran the following command.

    ldd ./my application

    it gave me

    libQtCore.so.4 not fond
    libQtGui.so.4 not found

    But i have plaed both libs in my application folder.

    Now i ran ./configure -static -prefix /qt instaliton path

    then i have used make command

    Then i went ot lib of Qt .. there i have the command make install..

    still i didn't replace old libs , once i replaced and update here


    Thanks


    Yuvaraj R

  14. #13
    Join Date
    Sep 2009
    Location
    UK
    Posts
    2,447
    Thanks
    6
    Thanked 348 Times in 333 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Deploying Qt Application under Linux

    As stated above, unless the application directory is contained in LD_LIBRARY_PATH, then its not going to find the libraries in the application dir. You shouldn't be messing with LD_LIBRARY_PATH either, but instead package your application so the installer will automatically install Qt if its not there already. Why include 10MB of libraries if you don't have to?

  15. #14
    Join Date
    May 2009
    Posts
    129

    Default Re: Deploying Qt Application under Linux

    Thanks for your reply

    I used libs path in my application. I got solved issues regarding qt libs

    Now new issues has been raised

    It is showing Glibc _2.4 not found


    Then i installed glibc_2.7 ,but i am getting same error.. is i have
    install same version ?

    Thanks

    Yuvaraj R

  16. #15
    Join Date
    Jun 2010
    Posts
    10
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Deploying Qt Application under Linux

    Same erro here.

    I'm using Kubuntu 10.04 to develop and a fresh install of Kubuntu 8.04 to execute but it falls.

    if I use Qt static libraries:
    ./bcFinal
    ./bcFinal: /lib/tls/i686/cmov/libc.so.6: version `GLIBC_2.9' not found (required by ./bcFinal)
    ./bcFinal: /lib/tls/i686/cmov/libc.so.6: version `GLIBC_2.11' not found (required by ./bcFinal)
    if I use Qt shared libraries:
    Segmentation fault.
    the command
    $ ldd ./bcFinal
    linux-gate.so.1 => (0xb7f7f000)
    libQtGui.so.4 => /usr/lib/libQtGui.so.4 (0xb786d000)
    libQtCore.so.4 => /usr/lib/libQtCore.so.4 (0xb76f9000)
    libpthread.so.0 => /lib/tls/i686/cmov/libpthread.so.0 (0xb76e0000)
    libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0xb75ed000)
    libm.so.6 => /lib/tls/i686/cmov/libm.so.6 (0xb75c8000)
    libgcc_s.so.1 => /lib/libgcc_s.so.1 (0xb75bd000)
    libc.so.6 => /lib/tls/i686/cmov/libc.so.6 (0xb746e000)
    libaudio.so.2 => /usr/lib/libaudio.so.2 (0xb7458000)
    libXt.so.6 => /usr/lib/libXt.so.6 (0xb7406000)
    libpng12.so.0 => /usr/lib/libpng12.so.0 (0xb73e3000)
    libSM.so.6 => /usr/lib/libSM.so.6 (0xb73db000)
    libICE.so.6 => /usr/lib/libICE.so.6 (0xb73c3000)
    libz.so.1 => /usr/lib/libz.so.1 (0xb73ae000)
    libgthread-2.0.so.0 => /usr/lib/libgthread-2.0.so.0 (0xb73a9000)
    librt.so.1 => /lib/tls/i686/cmov/librt.so.1 (0xb739f000)
    libglib-2.0.so.0 => /usr/lib/libglib-2.0.so.0 (0xb72ee000)
    libXi.so.6 => /usr/lib/libXi.so.6 (0xb72e6000)
    libXrender.so.1 => /usr/lib/libXrender.so.1 (0xb72de000)
    libXrandr.so.2 => /usr/lib/libXrandr.so.2 (0xb72d8000)
    libXfixes.so.3 => /usr/lib/libXfixes.so.3 (0xb72d3000)
    libXcursor.so.1 => /usr/lib/libXcursor.so.1 (0xb72c9000)
    libXinerama.so.1 => /usr/lib/libXinerama.so.1 (0xb72c6000)
    libfreetype.so.6 => /usr/lib/libfreetype.so.6 (0xb7259000)
    libfontconfig.so.1 => /usr/lib/libfontconfig.so.1 (0xb722f000)
    libXext.so.6 => /usr/lib/libXext.so.6 (0xb7221000)
    libX11.so.6 => /usr/lib/libX11.so.6 (0xb713a000)
    libdl.so.2 => /lib/tls/i686/cmov/libdl.so.2 (0xb7135000)
    /lib/ld-linux.so.2 (0xb7f80000)
    libpcre.so.3 => /usr/lib/libpcre.so.3 (0xb710e000)
    libexpat.so.1 => /usr/lib/libexpat.so.1 (0xb70ed000)
    libXau.so.6 => /usr/lib/libXau.so.6 (0xb70ea000)
    libxcb-xlib.so.0 => /usr/lib/libxcb-xlib.so.0 (0xb70e7000)
    libxcb.so.1 => /usr/lib/libxcb.so.1 (0xb70cf000)
    libXdmcp.so.6 => /usr/lib/libXdmcp.so.6 (0xb70ca000)
    What I can do to solve this ?
    Last edited by MaikoID; 30th June 2010 at 20:02.

  17. #16
    Join Date
    Apr 2010
    Posts
    769
    Thanks
    1
    Thanked 94 Times in 86 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11

    Default Re: Deploying Qt Application under Linux

    Linux, like all operating systems, does NOT guarantee backward compatibility. If you developed under Kubuntu 10.04, your app is NOT going to run under Kubuntu 8.04 or any other version earlier than 10.04. Your application fails because the C runtime version it was built against doesn't exist on your test machine.

  18. #17
    Join Date
    Jun 2010
    Posts
    10
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Deploying Qt Application under Linux

    Thanks for the answer.

    What Qt in static mode can I install in kubuntu 8.04 to compile and excute my app ? Qt 3 or Qt 4 ? Where can I download ?

  19. #18
    Join Date
    Jun 2010
    Posts
    102
    Thanks
    3
    Qt products
    Qt4 Qt/Embedded Qt Jambi PyQt3 PyQt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: Deploying Qt Application under Linux

    which libs gcc download ?, can you help me
    Contact: Skype: sonnh89
    Yahoo: nhs_0702@yahoo.com

    Liên hệ SKype: sonnh89

Similar Threads

  1. Deploying Qt 4.5.1 Application on RHEL 5.. Pls Help
    By swamyonline in forum Installation and Deployment
    Replies: 0
    Last Post: 28th June 2009, 11:43
  2. Deploying application on Linux machine without Qt
    By will49 in forum Installation and Deployment
    Replies: 2
    Last Post: 10th July 2008, 22:41
  3. Deploying App on Linux
    By janus in forum Installation and Deployment
    Replies: 5
    Last Post: 6th May 2008, 21:18
  4. Deploying Qt 4.2 Application on Mac 10.3.5?
    By vishal.chauhan in forum Installation and Deployment
    Replies: 0
    Last Post: 11th May 2007, 11:33
  5. Replies: 2
    Last Post: 12th January 2007, 11:19

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.