My Qt application should run on Linux distributions that don't have Qt installed and even have older version of glibc and so on. So I decided to distribute those libraries with my apllication. How could I get the complete list of dependencies for my application, including the dependencies of Qt and system libraries like glibc and others? And is there any other way I could get my application running on Linux distributions that don't have glibc and other packages of expected versions?
-
3Use [ldd](http://en.wikipedia.org/wiki/Ldd_(Unix)). – devnull Sep 06 '13 at 08:12
-
It is usually a bad idea to use a different `libc` than the one that is installed on the system, because it's tricky to do it right. Also, the Linux way is to depend on the system's package manager to drag dependencies in, not to bundle them with your program. What are you gonna do when you realize your bundled `libx11` isn't compatible with the machine's X server? – syam Sep 06 '13 at 08:50
-
@LaszloPapp not the way it was intended. We end up with building separate package almost for every distribution… – artplastika May 26 '14 at 04:57
-
@artplastika: ok, was just asking because there was no selected answer, thanks. – László Papp May 26 '14 at 06:21
2 Answers
It is possible, but it is a bit tricky, especially if you need glibc as well. In that case, you even need to make sure that not only libc is appropriate, but you bring your corresponding ld
'so' with it as well. Otherwise, you might get a segfault after the libc entry point, but before your main function.
Essentially, when you will try to run your application, you will see the missing libraries until you add all.
Try: ldd -r foo
-> That will tell you what libraries are necessary for an executable or library. Here you can find the man page of it.
Here is an example from my system: ldd -r /usr/lib/libQt5Quick.so.5.1.0
linux-vdso.so.1 (0x00007fffbb3fe000)
libQt5Qml.so.5 => /usr/lib/libQt5Qml.so.5 (0x00007f376576b000)
libQt5Network.so.5 => /usr/lib/libQt5Network.so.5 (0x00007f3765433000)
libQt5Gui.so.5 => /usr/lib/libQt5Gui.so.5 (0x00007f3764e13000)
libQt5Core.so.5 => /usr/lib/libQt5Core.so.5 (0x00007f3764800000)
libQt5V8.so.5 => /usr/lib/libQt5V8.so.5 (0x00007f376415a000)
libGL.so.1 => /usr/lib/libGL.so.1 (0x00007f3763e2c000)
libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x00007f3763b27000)
libm.so.6 => /usr/lib/libm.so.6 (0x00007f3763824000)
libc.so.6 => /usr/lib/libc.so.6 (0x00007f376347a000)
libpthread.so.0 => /usr/lib/libpthread.so.0 (0x00007f376325b000)
libz.so.1 => /usr/lib/libz.so.1 (0x00007f3763045000)
libssl.so.1.0.0 => /usr/lib/libssl.so.1.0.0 (0x00007f3762dd9000)
libcrypto.so.1.0.0 => /usr/lib/libcrypto.so.1.0.0 (0x00007f37629ce000)
libpng16.so.16 => /usr/lib/libpng16.so.16 (0x00007f3762799000)
libicui18n.so.51 => /usr/lib/libicui18n.so.51 (0x00007f3762398000)
libicuuc.so.51 => /usr/lib/libicuuc.so.51 (0x00007f3762021000)
libpcre16.so.0 => /usr/lib/libpcre16.so.0 (0x00007f3761dc4000)
libdl.so.2 => /usr/lib/libdl.so.2 (0x00007f3761bc0000)
libglib-2.0.so.0 => /usr/lib/libglib-2.0.so.0 (0x00007f37618c1000)
librt.so.1 => /usr/lib/librt.so.1 (0x00007f37616b9000)
libgcc_s.so.1 => /usr/lib/libgcc_s.so.1 (0x00007f37614a3000)
/usr/lib64/ld-linux-x86-64.so.2 (0x00007f3766166000)
libnvidia-tls.so.325.15 => /usr/lib/libnvidia-tls.so.325.15 (0x00007f376129f000)
libnvidia-glcore.so.325.15 => /usr/lib/libnvidia-glcore.so.325.15 (0x00007f375ebbf000)
libX11.so.6 => /usr/lib/libX11.so.6 (0x00007f375e884000)
libXext.so.6 => /usr/lib/libXext.so.6 (0x00007f375e671000)
libicudata.so.51 => /usr/lib/libicudata.so.51 (0x00007f375cf27000)
libpcre.so.1 => /usr/lib/libpcre.so.1 (0x00007f375ccbc000)
libxcb.so.1 => /usr/lib/libxcb.so.1 (0x00007f375ca9d000)
libXau.so.6 => /usr/lib/libXau.so.6 (0x00007f375c898000)
libXdmcp.so.6 => /usr/lib/libXdmcp.so.6 (0x00007f375c692000)

- 51,870
- 39
- 111
- 135
-
Thank you Laszlo! I need some time to investigate all dependencies. I would accept your answer when I get my app running! – artplastika Sep 06 '13 at 08:36
-
You're very unlikely to get your application running on a Linux system without glibc
; there's no other likely candidate for a full libc
implementation. That said, use the ldd
command on your binary; it will list all of the dynamic libraries that binary wants as well as the resolved versions on that system.

- 75,269
- 21
- 115
- 152
-
S/he does have glibc, just not the expected version as s/he wrote... – László Papp Sep 06 '13 at 08:14
-
The phrasing is unclear; I can understand your interpretation, but it looks like "don't have `glibc`". – chrylis -cautiouslyoptimistic- Sep 06 '13 at 08:15
-
1He explicitly asks: "And is there any other way I could get my application running on Linux distributions that don't have glibc and other packages of expected versions?" Note the "expected versions" part. I do not see how it is unclear. – László Papp Sep 06 '13 at 08:16