PDA

View Full Version : How to deploy application using shared library in Linux



cutie.monkey
12th January 2010, 05:49
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.

high_flyer
12th January 2010, 09:14
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.

cutie.monkey
13th January 2010, 06:55
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?

high_flyer
13th January 2010, 10:52
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.

cutie.monkey
13th January 2010, 14:03
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.

high_flyer
13th January 2010, 16:15
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.

cutie.monkey
14th January 2010, 03:30
can you please give me a sample script or link where i can get some ideas on how to create the deployment script. thanks

high_flyer
14th January 2010, 13:50
http://www.linuxconfig.org/Bash_scripting_Tutorial

cutie.monkey
15th January 2010, 05:04
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

schnitzel
21st January 2010, 18:41
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/25040-Deploying-Qt-Application-under-Linux?p=120404#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