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:
#!/bin/sh
cd "/opt/googleearth"
if [ -n "." ] ; then
if [ "${LD_LIBRARY_PATH+set}" = "set" ] ; then
export LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:."
else
export LD_LIBRARY_PATH="."
fi
fi
exec ./googleearth "$@"
#!/bin/sh
cd "/opt/googleearth"
if [ -n "." ] ; then
if [ "${LD_LIBRARY_PATH+set}" = "set" ] ; then
export LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:."
else
export LD_LIBRARY_PATH="."
fi
fi
exec ./googleearth "$@"
To copy to clipboard, switch view to plain text mode
Bookmarks