Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
[Solved] How to make relative Qt library path in linux?
zither last edited by
In Windows deployment, place Qt lib files (*.dll) in same folder with .exe works fine.
In Mac, we can make relative library address to executable binary files.
ႈIn Linux, it needs to deploy library files (*.so) into /usr/lib/..
Is there any methods, to place relative address from binary file to library files like in Windows?
lgeyer last edited by
"This":http://labs.qt.nokia.com/2011/10/28/rpath-and-runpath/ article might help you - and "RPATH":http://en.wikipedia.org/wiki/Rpath in general.
mkoskim last edited by
[quote author="zither" date="1320502037"]Dear all,
In Linux, it needs to deploy library files (*.so) into /usr/lib/..
Is there any methods, to place relative address from binary file to library files like in Windows?[/quote]
In Linux, libraries are searched from system directories and directories specified in LD_LIBRARY_PATH environment variable. For security reasons, Linux does not normally search libraries from user directories. You may modify it before loading your program - add "." to it, and libraries are searched from current working directory:
@$ LD_LIBRARY_PATH=. ./myProgram@
If you want to make a program that does it automatically, start your program from script, or write a program to modify the variable and then launch the actual program.
dangelog last edited by
baysmith last edited by
Use $ORIGIN in the executable's rpath. For example, add the following to your qmake project file.
QMAKE_LFLAGS += -Wl,--rpath=\$$ORIGIN
Setting the QMAKE_RPATH clears the default rpath setting for the Qt libraries. This allows for bundling the Qt libraries with the application. If you want the rpath to include the path to the Qt libraries, don’t set QMAKE_RPATH.
zither last edited by
The way I want is to make relative address to application without effecting system variables.
I solve the problem with @Bradley said.
Thanks to all
BorisSclauzero last edited by
[quote author="zither" date="1320502037"]In Mac, we can make relative library address to executable binary files.[/quote]
Can you explain me how to do this?
It's about two days that I am stuck with this problem.
Thanks in advance
Please don't revive old thread that are almost 3 years old.
That said, have a look at the install_name_tool command. It's what is used on OS X (and e.g. macdeployqt)