[Nix-dev] Qt Oxygen style in nixpkgs
Thomas Tuegel
ttuegel at gmail.com
Fri Mar 13 23:34:46 CET 2015
On Fri, Mar 13, 2015 at 5:18 PM, Kirill Elagin <kirelagin at gmail.com> wrote:
> Versions of Qt are the same. And you are right, I checked strace on
> `qtconfig` and both programs load oxygen from `/usr/lib64`.
>
> There are many differences in the outputs of `strace` but what seems to be
> relevant is that soon after opening
> `/usr/lib64/kde4/plugins/styles/oxygen.so` the distro version of `qtconfig`
> opens `/etc/ld.so.cache` and then `/usr/lib64/libkdeui.so.5` while the one
> from nixpkgs tries to open `/nix/store/<hash>-glibc-2.20/etc/ld.so.cache`
> and `/nix/store/<hash>-glibc-2.20/lib/libkdeui.so.5` and fails to do so
> because there are no such files.
>
> I’m attaching both straces hoping that some of you might have an idea what’s
> going on.
Here's what's going on:
Nix sets RPATH for libraries and executables so they can find the
libraries they depend on. Your distro's libraries, like oxygen.so,
will not do this; instead, they rely on the interpreter ld.so to find
the right libraries on the system path. Because oxygen.so is being
loaded as a plugin, it uses the interpreter of whatever program loads
it. So, when you use your distro's qtconfig, it uses your distro's
ld.so and all is well. But, when you use the nixpkgs qtconfig, it uses
the nixpkgs ld.so. The nixpkgs ld.so does not have libkdeui.so.5 in
its system path because the system path is only
/nix/store/<hash>-glibc-2.20/lib (otherwise, glibc would have to
depend on every package in the system!).
Note that in this scenario, there is no problem with distro-installed
programs using the nixpkgs oxygen.so, so we should fix this by making
everything use the nixpkgs Oxygen. You should be able to do this by
setting the environment variable
QT_PLUGIN_PATH="$HOME/.nix-profile/lib/qt4/plugins:$HOME/.nix-profile/lib/kde4/plugins:$HOME/.nix-profile/lib/qt5/plugins".
Technically, you only need the first path in the list in this case,
but I wouldn't want you to be surprised later when something else
breaks!
--
Thomas Tuegel
More information about the nix-dev
mailing list