[Qt-interest] Setting library path before running?
Oliver.Knoll at comit.ch
Oliver.Knoll at comit.ch
Tue Mar 23 12:53:44 CET 2010
william.crocker at analog.com wrote on Tuesday, March 23, 2010 11:37 AM:
> ...
> We run our apps through a wrapper script which sets LD_LIBRARY_PATH
> first.
You can also include the '.' (current directory) to the "build-in" library paths of the executable. Read about the -rpath linker option (and you can set this via qmake/*.pro files, too).
Or you can also set something like ./lib as rpath, then your app will look in the subfolder lib for libraries, so given:
gcc -rpath ./lib ... // or similar, check man pages for exact syntax
/path/to/my/app
+- MyApp
+- lib
+- libFoo.so
That would work (without setting LD_LIBRARY_PATH to /path/to/my/app/lib!):
$> cd /path/to/my/app
$> ./MyApp
Like this your executable will find all the shared libraries in the same folder (just like on Windows) - as long as the current directory is set at the point when starting the app (e.g. by a shell script, as suggested above - but that shell script does not need to care about LD_LIBRARY_PATH anymore :)!
Cheers, Oliver
--
Oliver Knoll
Dipl. Informatik-Ing. ETH
COMIT AG - ++41 79 520 95 22
More information about the Qt-interest-old
mailing list