sergey-shambir / elflibviewer

elflibviewer - patched version of ldd visualizer (a.k.a. DependencyWalker for Linux)
9 stars 2 forks source link

Not working on cross setups #3

Open tgurr opened 9 years ago

tgurr commented 9 years ago

0.9 didn't work for me either. ldd lists the dependencies just fine:

# ldd /usr/x86_64-pc-linux-gnu/bin/elflibviewer
        linux-vdso.so.1 (0x00007ffd93df3000)
        libQt5Widgets.so.5 => /usr/x86_64-pc-linux-gnu/lib/libQt5Widgets.so.5 (0x00007fae855eb000)
        libQt5Gui.so.5 => /usr/x86_64-pc-linux-gnu/lib/libQt5Gui.so.5 (0x00007fae84e5f000)
        libQt5Core.so.5 => /usr/x86_64-pc-linux-gnu/lib/libQt5Core.so.5 (0x00007fae84784000)
        libGL.so.1 => /usr/x86_64-pc-linux-gnu/lib/libGL.so.1 (0x00007fae844ee000)
        libpthread.so.0 => /usr/x86_64-pc-linux-gnu/lib/libpthread.so.0 (0x00007fae842d1000)
        libstdc++.so.6 => /usr/x86_64-pc-linux-gnu/lib/libstdc++.so.6 (0x00007fae83fc1000)
        libm.so.6 => /usr/x86_64-pc-linux-gnu/lib/libm.so.6 (0x00007fae83cc9000)
        libc.so.6 => /usr/x86_64-pc-linux-gnu/lib/libc.so.6 (0x00007fae83924000)
        libpng16.so.16 => /usr/x86_64-pc-linux-gnu/lib/libpng16.so.16 (0x00007fae836f3000)
        libz.so.1 => /usr/x86_64-pc-linux-gnu/lib/libz.so.1 (0x00007fae834de000)
        libicui18n.so.55 => /usr/x86_64-pc-linux-gnu/lib/libicui18n.so.55 (0x00007fae8307a000)
        libicuuc.so.55 => /usr/x86_64-pc-linux-gnu/lib/libicuuc.so.55 (0x00007fae82ce6000)
        libicudata.so.55 => /usr/x86_64-pc-linux-gnu/lib/libicudata.so.55 (0x00007fae81230000)
        libpcre16.so.0 => /usr/x86_64-pc-linux-gnu/lib/libpcre16.so.0 (0x00007fae80fcc000)
        libdl.so.2 => /usr/x86_64-pc-linux-gnu/lib/libdl.so.2 (0x00007fae80dc8000)
        libgthread-2.0.so.0 => /usr/x86_64-pc-linux-gnu/lib/libgthread-2.0.so.0 (0x00007fae80bc7000)
        libglib-2.0.so.0 => /usr/x86_64-pc-linux-gnu/lib/libglib-2.0.so.0 (0x00007fae80890000)
        librt.so.1 => /usr/x86_64-pc-linux-gnu/lib/librt.so.1 (0x00007fae80688000)
        libsystemd.so.0 => /usr/x86_64-pc-linux-gnu/lib/libsystemd.so.0 (0x00007fae85fb7000)
        /usr/x86_64-pc-linux-gnu/lib/ld-linux-x86-64.so.2 (0x00007fae85e4d000)
        libexpat.so.1 => /usr/x86_64-pc-linux-gnu/lib/libexpat.so.1 (0x00007fae8045f000)
        libglapi.so.0 => /usr/x86_64-pc-linux-gnu/lib/libglapi.so.0 (0x00007fae8020a000)
        libXdamage.so.1 => /usr/x86_64-pc-linux-gnu/lib/libXdamage.so.1 (0x00007fae80008000)
        libXfixes.so.3 => /usr/x86_64-pc-linux-gnu/lib/libXfixes.so.3 (0x00007fae7fe03000)
        libX11-xcb.so.1 => /usr/x86_64-pc-linux-gnu/lib/libX11-xcb.so.1 (0x00007fae7fc02000)
        libxcb-glx.so.0 => /usr/x86_64-pc-linux-gnu/lib/libxcb-glx.so.0 (0x00007fae7f9ec000)
        libxcb-dri2.so.0 => /usr/x86_64-pc-linux-gnu/lib/libxcb-dri2.so.0 (0x00007fae7f7e8000)
        libxcb-dri3.so.0 => /usr/x86_64-pc-linux-gnu/lib/libxcb-dri3.so.0 (0x00007fae7f5e6000)
        libxcb-present.so.0 => /usr/x86_64-pc-linux-gnu/lib/libxcb-present.so.0 (0x00007fae7f3e4000)
        libxcb-randr.so.0 => /usr/x86_64-pc-linux-gnu/lib/libxcb-randr.so.0 (0x00007fae7f1d8000)
        libxcb-xfixes.so.0 => /usr/x86_64-pc-linux-gnu/lib/libxcb-xfixes.so.0 (0x00007fae7efd2000)
        libxcb-render.so.0 => /usr/x86_64-pc-linux-gnu/lib/libxcb-render.so.0 (0x00007fae7edc9000)
        libxcb-shape.so.0 => /usr/x86_64-pc-linux-gnu/lib/libxcb-shape.so.0 (0x00007fae7ebc6000)
        libxcb-sync.so.1 => /usr/x86_64-pc-linux-gnu/lib/libxcb-sync.so.1 (0x00007fae7e9c1000)
        libXdmcp.so.6 => /usr/x86_64-pc-linux-gnu/lib/libXdmcp.so.6 (0x00007fae7e7bc000)
        libxshmfence.so.1 => /usr/x86_64-pc-linux-gnu/lib/libxshmfence.so.1 (0x00007fae7e5bb000)
        libXxf86vm.so.1 => /usr/x86_64-pc-linux-gnu/lib/libXxf86vm.so.1 (0x00007fae7e3b6000)
        libXext.so.6 => /usr/x86_64-pc-linux-gnu/lib/libXext.so.6 (0x00007fae7e1a4000)
        libX11.so.6 => /usr/x86_64-pc-linux-gnu/lib/libX11.so.6 (0x00007fae7de68000)
        libxcb.so.1 => /usr/x86_64-pc-linux-gnu/lib/libxcb.so.1 (0x00007fae7dc49000)
        libXau.so.6 => /usr/x86_64-pc-linux-gnu/lib/libXau.so.6 (0x00007fae7da46000)
        libdrm.so.2 => /usr/x86_64-pc-linux-gnu/lib/libdrm.so.2 (0x00007fae7d838000)
        libresolv.so.2 => /usr/x86_64-pc-linux-gnu/lib/libresolv.so.2 (0x00007fae7d621000)
        liblzma.so.5 => /usr/x86_64-pc-linux-gnu/lib/liblzma.so.5 (0x00007fae7d3fc000)
        libdw.so.1 => /usr/x86_64-pc-linux-gnu/lib/libdw.so.1 (0x00007fae7d1b5000)
        libcap.so.2 => /usr/x86_64-pc-linux-gnu/lib/libcap.so.2 (0x00007fae7cfb0000)
        libelf.so.1 => /usr/x86_64-pc-linux-gnu/lib/libelf.so.1 (0x00007fae7cd99000)
        libbz2.so.1.0 => /usr/x86_64-pc-linux-gnu/lib/libbz2.so.1.0 (0x00007fae7cb89000)
        libattr.so.1 => /usr/x86_64-pc-linux-gnu/lib/libattr.so.1 (0x00007fae7c985000)

But elflibviewer doesn't list anything: elflibviewer

sergey-shambir commented 9 years ago

Ok, 2 years ago there was issues with Debian/Ubuntu multiarch - ElgLibViewer was unable to find any lbiraries. I'd improved search algorithm, but it still isn't ideal. Can you please clarify on which system search failed? (which distribution, which version, i686 or AMD64).

tgurr commented 9 years ago

The distribution is Exherbo Linux, which is a rolling release distribution so we don't have any specific release versions, I'm on AMD64/x86_64.

We moved from multilib to multiarch/cross which allows native cross compiling support with full support from the package manager to track installed packages in the various cross targets.

Everything arch specific is installed to /usr/arch e.g. /usr/x86_64-pc-linux-gnu/{bin,include,lib,libexec}, /usr/i686-pc-linux-gnu/{bin,include,lib,libexec} and so on.

ls -la /usr:

bin -> host/bin
host -> x86_64-pc-linux-gnu
include -> host/include
lib -> host/lib
libexec -> host/libexec
sbin -> host/sbin

ls -la /:

bin -> usr/host/bin
lib -> usr/host/lib
sbin -> usr/host/sbin

so by changing the /usr/host symlink you can switch the whole system on the fly between the various installed cross targets.

More detailed information can be found here: https://exherbo.org/docs/multiarch-pr.html https://exherbo.org/docs/multiarch.txt

I hope this information is of any help and I was able to explain our layout, if I can be of further assistance please let me know.

sergey-shambir commented 9 years ago

Can you please also attach content of /etc/ld.so.conf and all files in /etc/ld.so.conf.d?

tgurr commented 9 years ago

We have /etc/env.d/ instead of /etc/ld.so.conf.d:

-rw-r--r--  1 root root  176 Sep  7 11:06 00basic
-rw-r--r--  1 root root   16 Aug 10 11:49 02locale
-rw-r--r--  1 root root   64 Sep 15 11:04 20udev
-rw-r--r--  1 root root   25 Aug 25 17:39 40nss
-rw-r--r--  1 root root  142 Sep 16 10:52 44kde-4
-rw-r--r--  1 root root   27 Sep 15 12:03 44qt4
-rw-r--r--  1 root root   66 Sep 22 10:58 44qt5
-rw-r--r--  1 root root  310 Jul 27 18:09 45java
-rw-r--r--  1 root root  156 Sep 14 18:17 45kf5
-rw-r--r--  1 root root   42 Jul 30 16:13 46mysql
-rw-r--r--  1 root root  122 Sep 18 11:29 50firefox
-rw-r--r--  1 root root   74 Mai 12 16:06 60googletalk
-rw-r--r--  1 root root   23 Sep  3 11:48 70less
-rw-r--r--  1 root root   48 Sep 15 10:51 98ca-certificates
drwxr-xr-x 75 root root 4096 Sep 15 11:22 alternatives

And running # eclectic env update then (re-)generates /etc/ld.so.{cache,conf}. The package manager also runs that command when instaling/removing any package so that it is always up to date:

# ld.so.conf autogenerated by eclectic
# Make all changes to /etc/env.d files
/usr/local/lib
/usr/host/lib/nss                                                                                                                                                                                               
/usr/host/lib/qt4                                                                                                                                                                                               
/usr/host/lib/qt5                                                                                                                                                                                               
/usr/x86_64-pc-linux-gnu/lib/mysql

$ env | grep LDPATH

LDPATH=/usr/local/lib:/usr/host/lib/nss:/usr/host/lib/qt4:/usr/host/lib/qt5:/usr/x86_64-pc-linux-gnu/lib/mysql

And in /etc/profile we have:

PATH=/usr/local/bin:/usr/host/bin:${PATH}                                                                                                                                                                                                                                      
export PATH

$ env | grep PATH

PATH=/usr/x86_64-pc-linux-gnu/bin:/usr/local/bin:/usr/host/bin:/opt/bin:/usr/x86_64-pc-linux-gnu/lib/jdk/bin:/usr/x86_64-pc-linux-gnu/lib/jre/bin