Bad rpath/LD_LIBRARY_PATH settings in kdelibs build scripts?

David Faure faure at kde.org
Tue Jun 4 22:01:08 UTC 2013


On Tuesday 04 June 2013 23:36:47 Alexander Neundorf wrote:
> On Tuesday 04 June 2013, Alex Merry wrote:
> > On 03/06/13 22:51, Alexander Neundorf wrote:
> > > Can you please also post what the RPATH and RUNPATH entries of meinproc4
> > > look like, e.g. using readelf -a bin/meinproc4 | grep PATH ?
> > 
> > Hmm... it might just be caused by $LD_LIBRARY_PATH, which appears to
> > override rpath.
> > 
> > Meinproc rpath/runpath:
> > Library rpath:
> > [/home/kf5-devel/build/kdelibs-frameworks/libkdeqt5staging/src:/home/kf5-d
> > e
> > vel/build/kdelibs-frameworks/staging/ki18n/src:/home/kf5-devel/build/kdeli
> > b
> > s-frameworks/tier1/karchive/src:/home/kf5-devel/src/qt5/qtbase/lib:]
> > Library runpath:
> > [/home/kf5-devel/build/kdelibs-frameworks/libkdeqt5staging/src:/home/kf5-d
> > e
> > vel/build/kdelibs-frameworks/staging/ki18n/src:/home/kf5-devel/build/kdeli
> > b
> > s-frameworks/tier1/karchive/src:/home/kf5-devel/src/qt5/qtbase/lib:]
> > 
> > # ldd ./meinproc4 | grep libk
> > libkdeqt5staging.so.5 => /home/kf5-devel/kf5/lib64/libkdeqt5staging.so.5
> > libki18n.so.5 => /home/kf5-devel/kf5/lib64/libki18n.so.5
> > 
> > However, if I unset LD_LIBRARY_PATH (which was
> > /home/kf5-devel/kf5/lib64:/home/kf5-devel/kf5/lib:/home/kf5-devel/src/qt5/
> > q
> > tbase/lib64:/home/kf5-devel/src/qt5/qtbase/lib:/home/kf5-devel/GNUstep/Lib
> > r
> > ary/Libraries:/usr/lib), I get
> > 
> > # ldd ./meinproc4 | grep libk
> > libkdeqt5staging.so.5 =>
> > /home/kf5-devel/build/kdelibs-frameworks/libkdeqt5staging/src/libkdeqt5sta
> > g
> > ing.so.5 libki18n.so.5 =>
> > /home/kf5-devel/build/kdelibs-frameworks/staging/ki18n/src/libki18n.so.5
> > 
> > So the solution may be to change the wiki page
> > (http://community.kde.org/Frameworks/Building#Runtime_setup) to not
> > recommend setting LD_LIBRARY_PATH, since we are setting rpath.
> 
> Ah, yes, I think so.
> David, what was the reason to add LD_LIBRARY_PATH ?

Hmm, I have always set LD_LIBRARY_PATH :-)

But indeed, maybe it's time to rethink that. In the KDE4 times, the .shell 
wrapper would actually override it, that's why it worked.

This is interesting.
I never liked RPATH because it had priority over LD_LIBRARY_PATH, and I 
thought the user should be able to have final say. So I welcomed the invention 
of RUNPATH, which doesn't have priority over the env var.

But indeed the case of not-yet-installed libraries is a case where we want 
that to have priority over the env var....

Hm, but why doesn't it work then? I see builddir/libkdeqt5staging/src in both 
the RPATH and the RUNPATH, and one of these has priority over the env var, no?
I must be confused about how they work, then.


Anyway. If we're sure that nowadays all the KF5 stuff (and their deps, and 
later on, the apps) is able to find the libs from a custom prefix 
automatically, I'm perfectly fine with not setting LD_LIBRARY_PATH ever again.

I suppose QTDIR/lib is still necessary though? Or does qmake also "do the 
right thing" with RPATH/RUNPATH?

-- 
David Faure, faure at kde.org, http://www.davidfaure.fr
Working on KDE, in particular KDE Frameworks 5



More information about the Kde-frameworks-devel mailing list