embedded-linuxpetalinux

how to check for shared library dependancies in petalinux


I have successfully cross compiled a sample application for Zynq Zedboard using arm-linux-gnueabi. I am running petalinux on it. However running the application xiSample gives the following error:

./xiSample: error while loading shared libraries: /usr/lib/libm3api.so.2: internal error

Further, ls -l on /usr/lib/ gives:

root@xiAPI:/usr/lib# ls -l
lrwxrwxrwx    1 root     root            42 Mar 13  2018 ld-linux-
armhf.so.3 -> /usr/arm-linux-gnueabihf/lib/sf/ld-2.23.so
-rwxr-xr-x    1 root     root         45556 Mar 13  2018 libjbig.so.2
-rwxr-xr-x    1 root     root         15284 Mar 13  2018 
libjbig85.so.2.0
-rwxr-xr-x    1 root     root        222748 Mar 13  2018 libjpeg.so.8
-rwxr-xr-x    1 root     root        222748 Mar 13  2018 
libjpeg.so.8.1.2
-rwxr-xr-x    1 root     root        193248 Mar 13  2018 liblzma.so.5
-rwxr-xr-x    1 root     root        193248 Mar 13  2018 
liblzma.so.5.2.3
lrwxrwxrwx    1 root     root            13 Jan  1 00:54 libm3api.so -
> libm3api.so.2
lrwxrwxrwx    1 root     root            17 Jan  1 00:58 libm3api.so.0 
-> libm3api.so.0.0.0
-rwxr-xr-x    1 root     root      19850208 Jan  1 00:54 
libm3api.so.0.0.0
lrwxrwxrwx    1 root     root            17 Jan  1 00:58 libm3api.so.2 
-> libm3api.so.2.0.0
-rwxr-xr-x    1 root     root      23453232 Jan  1 00:54 
libm3api.so.2.0.0
-rwxr-xr-x    1 root     root        441068 Mar 13  2018 libtiff.so.5
-rwxr-xr-x    1 root     root        441068 Mar 13  2018 
libtiff.so.5.3.0
-rwxr-xr-x    1 root     root          9760 Mar 13  2018 
libtiffxx.so.5
-rwxr-xr-x    1 root     root          9760 Mar 13  2018 
libtiffxx.so.5.3.0
-rwxr-xr-x    1 root     root        106100 Mar 13  2018 libz.so.1
-rwxr-xr-x    1 root     root        106100 Mar 13  2018 
libz.so.1.2.11
lrwxrwxrwx    1 root     root            18 Jan  1 00:56 m3api -> 
/opt/XIMEA/include
drwxr-xr-x    3 root     root          4096 Feb 22  2018 opkg

How can I find the shared libraries my executable needs, as petalinux does not contain ldd or file. EDIT: I am having trouble further isolating error. Any suggestion on what might be causing this? I think it is a linking error.


Solution

  • In Petalinux environment, this is what you can do:

    readelf -d xiSample | grep NEEDED

    This will list the required dynamic dependencies.

    A similar answer here: https://unix.stackexchange.com/questions/120015/how-to-find-out-the-dynamic-libraries-executables-loads-when-run