[Qt-interest] Setting library path before running?
Thiago Macieira
thiago at kde.org
Fri Mar 26 08:34:19 CET 2010
Em Sexta-feira 26. Março 2010, às 05.45.39, Nikos Chantziaras escreveu:
> On 03/23/2010 03:12 AM, Anatoly Burakov wrote:
> > Hi all
> >
> > I have an app with plugins. They all end up in appropriate directories
> > (via DESTDIR), everything works fine, except one thing. On Windows,
> > whenever the library is in the same folder - it gets loaded fine, that
> > is, i am able to launch my program right from QT Creator. On Linux,
> > however, everything works fine except i can't launch the program without
> > resorting to manually launching it from command-line (env
> > LD_LIBRARY_PATH=/path/to/my/dir). Are there any ways around this without
> > setting permanent environment variable in rc files?
>
> Doesn't QCoreApplication::addLibraryPath() work?
Depends on the use-case. It works for finding plugins, but not for libraries
that either the main application or the plugins depend on.
First of all, that's too late for the application. You can only run code after
the application has been loaded, which means the libraries it depends on must
have already been found.
Second, it doesn't affect the LD_LIBRARY_PATH variable. It will tell the Qt
classes where to look for plugins, but it won't tell the dynamic linker where
to look for libraries the plugins depend on.
--
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
Senior Product Manager - Nokia, Qt Development Frameworks
PGP/GPG: 0x6EF45358; fingerprint:
E067 918B B660 DBD1 105C 966C 33F5 F005 6EF4 5358
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 190 bytes
Desc: This is a digitally signed message part.
Url : http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20100326/8ef806a0/attachment.bin
More information about the Qt-interest-old
mailing list