Linux run program if install two version Qt
-
I built version 5.4.2 of my program, if I run it on a PC, all is well. ldd command
linux-vdso.so.1 => (0x00007fffdabe8000) libquazip.so.1 => /usr/lib/libquazip.so.1 (0x00007f3e26600000) libQt5Widgets.so.5 => /home/red_spider/Qt5.4.2/5.4/gcc_64/lib/libQt5Widgets.so.5 (0x00007f3e25d78000) libQt5Quick.so.5 => /home/red_spider/Qt5.4.2/5.4/gcc_64/lib/libQt5Quick.so.5 (0x00007f3e25798000) libQt5Gui.so.5 => /home/red_spider/Qt5.4.2/5.4/gcc_64/lib/libQt5Gui.so.5 (0x00007f3e24fc8000) libQt5WebSockets.so.5 => /home/red_spider/Qt5.4.2/5.4/gcc_64/lib/libQt5WebSockets.so.5 (0x00007f3e24da0000) libQt5Qml.so.5 => /home/red_spider/Qt5.4.2/5.4/gcc_64/lib/libQt5Qml.so.5 (0x00007f3e24788000) libQt5Network.so.5 => /home/red_spider/Qt5.4.2/5.4/gcc_64/lib/libQt5Network.so.5 (0x00007f3e24420000) libQt5Sql.so.5 => /home/red_spider/Qt5.4.2/5.4/gcc_64/lib/libQt5Sql.so.5 (0x00007f3e241e0000) libQt5Xml.so.5 => /home/red_spider/Qt5.4.2/5.4/gcc_64/lib/libQt5Xml.so.5 (0x00007f3e23fa0000) libQt5Core.so.5 => /home/red_spider/Qt5.4.2/5.4/gcc_64/lib/libQt5Core.so.5 (0x00007f3e23860000) libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f3e23558000) libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f3e23340000) libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f3e22f78000) libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007f3e22d58000) libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f3e22b38000) libgobject-2.0.so.0 => /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0 (0x00007f3e228e0000) libglib-2.0.so.0 => /lib/x86_64-linux-gnu/libglib-2.0.so.0 (0x00007f3e225d8000) libX11.so.6 => /usr/lib/x86_64-linux-gnu/libX11.so.6 (0x00007f3e222a0000) libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f3e21f98000) libGL.so.1 => /usr/lib/nvidia-304/libGL.so.1 (0x00007f3e21c78000) libicui18n.so.53 => /home/red_spider/Qt5.4.2/5.4/gcc_64/lib/libicui18n.so.53 (0x00007f3e21828000) libicuuc.so.53 => /home/red_spider/Qt5.4.2/5.4/gcc_64/lib/libicuuc.so.53 (0x00007f3e21498000) libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f3e21290000) libgthread-2.0.so.0 => /usr/lib/x86_64-linux-gnu/libgthread-2.0.so.0 (0x00007f3e21088000) librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007f3e20e80000) /lib64/ld-linux-x86-64.so.2 (0x00007f3e26860000) libffi.so.6 => /usr/lib/x86_64-linux-gnu/libffi.so.6 (0x00007f3e20c78000) libpcre.so.3 => /lib/x86_64-linux-gnu/libpcre.so.3 (0x00007f3e20a38000) libxcb.so.1 => /usr/lib/x86_64-linux-gnu/libxcb.so.1 (0x00007f3e20818000) libnvidia-tls.so.304.125 => /usr/lib/nvidia-304/tls/libnvidia-tls.so.304.125 (0x00007f3e20610000) libnvidia-glcore.so.304.125 => /usr/lib/nvidia-304/libnvidia-glcore.so.304.125 (0x00007f3e1e220000) libXext.so.6 => /usr/lib/x86_64-linux-gnu/libXext.so.6 (0x00007f3e1e008000) libicudata.so.53 => /home/red_spider/Qt5.4.2/5.4/gcc_64/lib/libicudata.so.53 (0x00007f3e1c980000) libXau.so.6 => /usr/lib/x86_64-linux-gnu/libXau.so.6 (0x00007f3e1c778000) libXdmcp.so.6 => /usr/lib/x86_64-linux-gnu/libXdmcp.so.6 (0x00007f3e1c570000)
if install my packages for ubuntu 15.04 (there is already a version 5.4.1) and run ldd.....
linux-vdso.so.1 => (0x00007ffe507f2000) libquazip.so.1 => /usr/lib/libquazip.so.1 (0x00007fd675298000) libQt5Widgets.so.5 => /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5 (0x00007fd674bf0000) libQt5Quick.so.5 => /usr/lib/x86_64-linux-gnu/libQt5Quick.so.5 (0x00007fd674800000) libQt5Gui.so.5 => /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5 (0x00007fd6742b0000) libQt5WebSockets.so.5 => /usr/lib/libQt5WebSockets.so.5 (0x00007fd674088000) libQt5Qml.so.5 => /usr/lib/x86_64-linux-gnu/libQt5Qml.so.5 (0x00007fd673c50000) libQt5Network.so.5 => /usr/lib/x86_64-linux-gnu/libQt5Network.so.5 (0x00007fd673af0000) libQt5Sql.so.5 => /usr/lib/x86_64-linux-gnu/libQt5Sql.so.5 (0x00007fd673aa8000) libQt5Xml.so.5 => /usr/lib/x86_64-linux-gnu/libQt5Xml.so.5 (0x00007fd673a68000) libQt5Core.so.5 => /usr/lib/x86_64-linux-gnu/libQt5Core.so.5 (0x00007fd673520000) libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007fd673210000) libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007fd672ff8000) libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fd672c28000) libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007fd672a08000) libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007fd6727e8000) libgobject-2.0.so.0 => /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0 (0x00007fd672590000) libglib-2.0.so.0 => /lib/x86_64-linux-gnu/libglib-2.0.so.0 (0x00007fd672280000) libX11.so.6 => /usr/lib/x86_64-linux-gnu/libX11.so.6 (0x00007fd671f40000) libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007fd671c38000) libpng12.so.0 => /lib/x86_64-linux-gnu/libpng12.so.0 (0x00007fd671a10000) libharfbuzz.so.0 => /usr/lib/x86_64-linux-gnu/libharfbuzz.so.0 (0x00007fd6717b8000) libGL.so.1 => /usr/lib/x86_64-linux-gnu/mesa/libGL.so.1 (0x00007fd671518000) libdouble-conversion.so.1 => /usr/lib/x86_64-linux-gnu/libdouble-conversion.so.1 (0x00007fd671300000) libicui18n.so.52 => /usr/lib/x86_64-linux-gnu/libicui18n.so.52 (0x00007fd670ee8000) libicuuc.so.52 => /usr/lib/x86_64-linux-gnu/libicuuc.so.52 (0x00007fd670b68000) libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007fd670960000) librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007fd670758000) /lib64/ld-linux-x86-64.so.2 (0x00007fd6754f0000) libffi.so.6 => /usr/lib/x86_64-linux-gnu/libffi.so.6 (0x00007fd670550000) libpcre.so.3 => /lib/x86_64-linux-gnu/libpcre.so.3 (0x00007fd6702e0000) libxcb.so.1 => /usr/lib/x86_64-linux-gnu/libxcb.so.1 (0x00007fd6700c0000) libfreetype.so.6 => /usr/lib/x86_64-linux-gnu/libfreetype.so.6 (0x00007fd66fe18000) libgraphite2.so.3 => /usr/lib/x86_64-linux-gnu/libgraphite2.so.3 (0x00007fd66fbf8000) libexpat.so.1 => /lib/x86_64-linux-gnu/libexpat.so.1 (0x00007fd66f9c8000) libglapi.so.0 => /usr/lib/x86_64-linux-gnu/libglapi.so.0 (0x00007fd66f798000) libXext.so.6 => /usr/lib/x86_64-linux-gnu/libXext.so.6 (0x00007fd66f580000) libXdamage.so.1 => /usr/lib/x86_64-linux-gnu/libXdamage.so.1 (0x00007fd66f378000) libXfixes.so.3 => /usr/lib/x86_64-linux-gnu/libXfixes.so.3 (0x00007fd66f170000) libX11-xcb.so.1 => /usr/lib/x86_64-linux-gnu/libX11-xcb.so.1 (0x00007fd66ef68000) libxcb-glx.so.0 => /usr/lib/x86_64-linux-gnu/libxcb-glx.so.0 (0x00007fd66ed50000) libxcb-dri2.so.0 => /usr/lib/x86_64-linux-gnu/libxcb-dri2.so.0 (0x00007fd66eb48000) libxcb-dri3.so.0 => /usr/lib/x86_64-linux-gnu/libxcb-dri3.so.0 (0x00007fd66e940000) libxcb-present.so.0 => /usr/lib/x86_64-linux-gnu/libxcb-present.so.0 (0x00007fd66e738000) libxcb-sync.so.1 => /usr/lib/x86_64-linux-gnu/libxcb-sync.so.1 (0x00007fd66e530000) libxshmfence.so.1 => /usr/lib/x86_64-linux-gnu/libxshmfence.so.1 (0x00007fd66e328000) libXxf86vm.so.1 => /usr/lib/x86_64-linux-gnu/libXxf86vm.so.1 (0x00007fd66e120000) libdrm.so.2 => /usr/lib/x86_64-linux-gnu/libdrm.so.2 (0x00007fd66df10000) libicudata.so.52 => /usr/lib/x86_64-linux-gnu/libicudata.so.52 (0x00007fd66c6a0000) libXau.so.6 => /usr/lib/x86_64-linux-gnu/libXau.so.6 (0x00007fd66c498000) libXdmcp.so.6 => /usr/lib/x86_64-linux-gnu/libXdmcp.so.6 (0x00007fd66c290000)
loads the wrong versions of libraries
libicui18n.so.52 => /usr/lib/x86_64-linux-gnu/libicui18n.so.52 (0x00007fd670ee8000) libicuuc.so.52 => /usr/lib/x86_64-linux-gnu/libicuuc.so.52 (0x00007fd670b68000)
and error when run the program
Cannot mix incompatible Qt library (version 0x50402) with this library (version 0x50401)
Aborted (core dumped)or you can specify which version to use libraries?
-
Hi,
IIRC, you can use LD_LIBRARY_PATH to prepend a path to search for libraries when starting your application. Something like:
LD_LIBRARY_PATH=/home/red_spider/Qt5.4.2/5.4/gcc_64/lib/ ./yourCoolProgram
Depending on your needs, creating a little launcher script doing that will be simpler to start your application.
Hope it helps
-
Thank you for your response
I know this method, but it would avoid
I create .deb package and install all the libraries in / usr/libI just solved this problem)) I moved the library with /usr/lib in /usr/lib/x86_64-linux-gnu
perhaps it is not the best option....
the best solution would be to program sought specific version library. -
No it's not at all, you are overwriting system libraries.
Again, if you want to use a specific set of libraries, use a launcher script and set LD_LIBRARY_PATH. That's the right thing to do.
But since you want to integrate that in a debian environment, why not just use the installed version of Qt ?
-
This problem ..
because the program should work on different versions Kubuntu 14.04 used Qt 4.8.6, Kubuntu 15.04 used Qt 5.4.1
program should massively distributed, and then there will be problems ...maybe you're right and will have to use LD_LIBRARY_PATH
but I do not quite understand why Qt is not looking for the correct version.
-
@red_spider said:
but I do not quite understand why Qt is not looking for the correct version.
That's because you have multiple versions of Qt in your system that are visible to your application. The application doesn't know which is the correct version, so it loads the first one it finds.
This is not a Qt problem -- the same thing could happen with any other library. On Windows, this is called DLL Hell.
See http://www.tripleboot.org/?p=138 for alternate ways to deploy your files. Personally, I like to use RPATH.