[Development] RPATH in libraries
Dmitry Ashkadov
dmitry.ashkadov at gmail.com
Sun Aug 4 08:20:51 CEST 2013
Hello!
I have a problem with Qt 5.1. All Qt libraries have RPATH installed:
system Qt:
> $ objdump -x /usr/lib64/libQt5Quick.so | grep RPATH
> RPATH /usr/lib64
local Qt:
> $ objdump -x ~/build/qt5/install/lib/libQt5Quick.so | grep RPATH
> RPATH /home/dmitry/build/qt5/install/lib
If a local Qt works fine, the system Qt doesn't work (:. because RPATH
is set. I have a Nvidia video and nvidia provides its implementation of
OpenGL. But because RPATH is set then Qt runs with mesa openGL and fails:
> $ ./customgeometry
> libGL error: failed to load driver: swrast
> libGL error: Try again with LIBGL_DEBUG=verbose for more details.
> QOpenGLShaderProgram: could not create shader program
> QOpenGLShader: could not create shader
> QSGMaterialShader: Shader compilation failed:
> $ ldd ./customgeometry
> libGL.so.1 => /usr/lib64/libGL.so.1 (0x00007fc076491000)
> $ ldd /usr/lib64/libQt5Quick.so
> libGL.so.1 => /usr/lib64/libGL.so.1 (0x00007f9d0909c000)
The right implementation is:
> $ ldd /usr/bin/glxinfo
> libGL.so.1 => /usr/lib64/nvidia-current/libGL.so.1
> (0x00007fc1e4dae000)
> libnvidia-tls.so.319.17 =>
> /usr/lib64/nvidia-current/tls/libnvidia-tls.so.319.17 (0x00007fc1e44b7000)
> libnvidia-glcore.so.319.17 =>
> /usr/lib64/nvidia-current/libnvidia-glcore.so.319.17 (0x00007fc1e1f62000)
LDD finds library using RPATH first of all, so, for local installed Qt5
it cannot find linGL.so in RPATH and then uses right implementation:
> $ ldd ~/build/qt5/install/lib/libQt5Quick.so
> libGL.so.1 => /usr/lib64/nvidia-current/libGL.so.1
> (0x00007f790e1c4000)
> libnvidia-tls.so.319.17 =>
> /usr/lib64/nvidia-current/tls/libnvidia-tls.so.319.17 (0x00007f790bcc4000)
> libnvidia-glcore.so.319.17 =>
> /usr/lib64/nvidia-current/libnvidia-glcore.so.319.17 (0x00007f790976e000)
Thank you.
More information about the Development
mailing list