[Qt-interest] [OT] Specify location of DLL dependencies on Windows

Thiago Macieira thiago.macieira at trolltech.com
Tue Jan 20 17:52:49 CET 2009


Em Terça-feira 20 Janeiro 2009, às 17:12:58, Paul Floyd escreveu:
> Quoting Thiago Macieira <thiago.macieira at trolltech.com>:
> > Em Terça-feira 20 Janeiro 2009, às 12:23:06, Paul Floyd escreveu:
> > > IMO LD_LIBRARY_PATH is a bad idea, and should only be used as a last
> > > resort. The best way is to use the RPATH.
> >
> > Distributions recommend against both solutions. They prefer that all
> > libraries
> > get installed to locations defined in /etc/ld.so.conf. That way, ldconfig
> > can cache the locations and be faster. Also, prelinking will work.
>
> Are you saying that linux distributions suggest installing user shared libs
> in system directories? Or using ldconfig to include user paths?

Well, that's what they suggest for themselves... :-)
See http://wiki.debian.org/RpathIssue [*]

They only put libraries in /usr/lib and very few other places. When they do 
put in other places, they add it to ld.so.conf (which has even a subdir now: 
/etc/ld.so.conf.d/, yay for having three dots in the same name!).

If the application gets installed to /usr/local, there's no need for RPATH, 
since /usr/local/lib is usually already searched by the dynamic linker.

However, if you're installing to a non-standard location, then yes, you need 
RPATH or LD_LIBRARY_PATH trickery (commercial apps like Google Earth do that).

BTW, one detail: I do not advocate using RPATH. It should be RUNPATH. It's set 
with the same linker option (-Wl,-rpath,....), but it's not enabled by default 
in a source build of GNU binutils.

[*] the wiki is wrong: RPATH is searched before LD_LIBRARY_PATH. RUNPATH is 
searched after LD_LIBRARY_PATH, which is why it's recommended.

> What would you suggest for a binary package that includes "myapp",
> "libfoo.so" using Qt 4.3, targeting RHEL 4.0 and later?

In order of preference:

Option 1: make it open source and let the distribution package it

Option 2: install it to /usr/local/{bin,lib}

Option 3: install it to /opt/uniquename/ and use RUNPATH/LD_LIBRARY_PATH.

Note that, even with option 3, if you want to add entries to the XDG menu 
structure or MIME-type system, the .desktop files have to be installed to 
/usr/local/share or they won't be picked up.

-- 
Thiago Macieira - thiago.macieira (AT) nokia.com
  Senior Software Engineer - Nokia, Qt Software
  Qt Software is hiring - ask me
      Sandakerveien 116, NO-0402 Oslo, Norway
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part.
Url : http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20090120/f66876a1/attachment.bin 


More information about the Qt-interest-old mailing list