Commit d7d23226 authored by Christian Kamm's avatar Christian Kamm
Browse files

Set LD_LIBRARY_PATH in unix run environments.

Similarly to how PATH is set up for Windows. The background is that
without it plugin loading can pull in incompatible Qt libraries if the
binary is compiled with RUNPATH instead of RPATH.

Reviewed-by: Daniel Teske
parent 0c8b4e38
......@@ -174,6 +174,27 @@ void Environment::prependOrSetPath(const QString &value)
prependOrSet(QLatin1String("PATH"), QDir::toNativeSeparators(value), QString(sep));
void Environment::prependOrSetLibrarySearchPath(const QString &value)
#ifdef Q_OS_WIN
const QChar sep = QLatin1Char(';');
const QChar sep = QLatin1Char(':');
#ifdef Q_OS_WIN
const QLatin1String path("PATH");
#elif defined(Q_OS_MAC)
const QLatin1String path("DYLD_LIBRARY_PATH");
#elif defined(Q_OS_UNIX)
const QLatin1String path("LD_LIBRARY_PATH");
prependOrSet(path, QDir::toNativeSeparators(value), QString(sep));
Environment Environment::systemEnvironment()
return Environment(QProcess::systemEnvironment());
......@@ -85,6 +85,8 @@ public:
void appendOrSetPath(const QString &value);
void prependOrSetPath(const QString &value);
void prependOrSetLibrarySearchPath(const QString &value);
void clear();
int size() const;
......@@ -600,15 +600,13 @@ Utils::Environment Qt4RunConfiguration::baseEnvironment() const
env.set("DYLD_IMAGE_SUFFIX", "_debug");
#ifdef Q_OS_WIN
// On windows the user could be linking to a library found via a -L/some/dir switch
// The user could be linking to a library found via a -L/some/dir switch
// to find those libraries while actually running we explicitly prepend those
// dirs to the path
// dirs to the library search path
const Qt4ProFileNode *node = qt4Target()->qt4Project()->rootProjectNode()->findProFileFor(m_proFilePath);
if (node)
foreach(const QString &dir, node->variableValue(LibDirectoriesVar))
return env;
......@@ -1722,6 +1722,7 @@ void QtVersion::addToEnvironment(Utils::Environment &env) const
// Generic:
env.set("QTDIR", QDir::toNativeSeparators(versionInfo().value("QT_INSTALL_DATA")));
// Symbian specific:
if (supportsTargetId(Constants::S60_DEVICE_TARGET_ID)
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment