Results 1 to 10 of 10

Thread: How to deploy application using shared library in Linux

  1. #1
    Join Date
    Jul 2008
    Location
    Philippines
    Posts
    60
    Thanks
    9
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default How to deploy application using shared library in Linux

    hi folks,

    i'm trying to deploy my application using shared library method (so the binary will get lesser size and easier to release), but i'm getting error when running the application in PC without Qt installed. I've run ldd ./appname which return the needed libraries, so i copy the libraries beside my application (which i do when releasing in windows) but still the same error occurred. Something like
    error while loading shared libraries: libQtGui.so.4: cannot open shared object file: No such file or directory
    libQtGui.so.4 is beside my app but it seems like only a link. where should i copy and place the right .so to run my app?

    thank you very much.

  2. #2
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,710
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: How to deploy application using shared library in Linux

    One way would be to have the real so next to your app executable.
    But a more general way would be to have the lib in a folder that it usually in the LD_LIBRARY_PATH, and /usr/lib is usually a good bet.
    Or, if you are deploying with a script, then you can have your so copied anywhere you like, and update LD_LIBRARY_PATH.
    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

  3. #3
    Join Date
    Jul 2008
    Location
    Philippines
    Posts
    60
    Thanks
    9
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How to deploy application using shared library in Linux

    Quote Originally Posted by high_flyer View Post
    One way would be to have the real so next to your app executable.
    But a more general way would be to have the lib in a folder that it usually in the LD_LIBRARY_PATH, and /usr/lib is usually a good bet.
    Or, if you are deploying with a script, then you can have your so copied anywhere you like, and update LD_LIBRARY_PATH.
    how can i specify the LD_LIBRARY_PATH or the rpath in my project?
    Last edited by cutie.monkey; 13th January 2010 at 07:09.

  4. #4
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,710
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: How to deploy application using shared library in Linux

    Do you want to update the LD_LIBRARY_PATH on the system, or use the LD_LIBRARAY_PATH in your project?
    Depending on what you want, the action is different.
    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

  5. #5
    Join Date
    Jul 2008
    Location
    Philippines
    Posts
    60
    Thanks
    9
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How to deploy application using shared library in Linux

    i want to use LD_LIBRARY_PATH in my project. Im not sure how LD_LIBRARY_PATH works, but what i want to achive is to run my application in other PC without Qt.

  6. #6
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,710
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: How to deploy application using shared library in Linux

    usually deployment is done with a script.
    That script can update LD_LIBRARY_PATH with the path to which it will copy your libs.
    Goole for 'export' command.
    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

  7. #7
    Join Date
    Jul 2008
    Location
    Philippines
    Posts
    60
    Thanks
    9
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How to deploy application using shared library in Linux

    can you please give me a sample script or link where i can get some ideas on how to create the deployment script. thanks

  8. #8
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,710
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: How to deploy application using shared library in Linux

    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

  9. #9
    Join Date
    Jul 2008
    Location
    Philippines
    Posts
    60
    Thanks
    9
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How to deploy application using shared library in Linux

    rpath is another way of solving my problem, but i don't have any idea on how to include rpath in my project. can anyone help me on how to do this? thanks

  10. #10
    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: How to deploy application using shared library in Linux

    Quote Originally Posted by cutie.monkey View Post
    can you please give me a sample script or link where i can get some ideas on how to create the deployment script. thanks
    Here is an example:
    http://www.qtcentre.org/threads/2504...404#post120404

    This page shows an example that is more generic:
    http://doc.qt.nokia.com/4.6/deployment-x11.html

    Look at the third approach under 'creating an application package'

    good luck

Similar Threads

  1. Replies: 0
    Last Post: 4th November 2009, 07:45
  2. Port Shared Library from Linux to Windows
    By calh1578 in forum Qt Programming
    Replies: 2
    Last Post: 28th September 2009, 18:14
  3. how to use shared library
    By assismvla in forum Qt Programming
    Replies: 3
    Last Post: 25th September 2009, 21:29
  4. Program in Windows, Deploy in Linux
    By suitto in forum Installation and Deployment
    Replies: 1
    Last Post: 8th April 2009, 13:11
  5. qmake: dependency of application on common shared library
    By PeterWurmsdobler in forum Qt Programming
    Replies: 5
    Last Post: 27th March 2009, 16:13

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.