views:

77

answers:

2

I have a binary file on linux .. tclsh8.4. It depends on certain tcl*.so files.

  1. Is there a way to get this information from the binary file itself?

  2. The tcl*.so files on which the binary tclsh8.4 depends is in some other directory having limited permission. What should I do to the binary file in order to use the same .so files from some other location?

Would just copying oved .so files in the same location work?

+1  A: 

Use ldd for this.

Copying the shared objects over would not work since the Linux loader only look for shared objects in directories specified in /etc/ld.so.conf. You would need to use $LD_LIBRARY_PATH to tell the loader where to find extra shared objects.

Ignacio Vazquez-Abrams
thank you , ldd solved the problem. I will try adding LD_LIBRARY_PATH to see if it fixes this ssue. Thank you very much!
cppb
+1  A: 

To see the dependencies of dynamic .so file you can use the ldd command. To get info about the executable file, check the readelf command.

If you need to check the dependencies of multiple .so files, you can use the next script:

#!/bin/bash
# dependencies.sh

# Needs to specify the path to check for .so dependencies
if [ $# -ne 1 ] 
then
   echo 'You need to specify the path'
   exit 0
fi

path=$1

for file in "$(find $path -name '*.so')"
do
   ldd $file
done

exit 0

I hope it helps.

Carlos Tasada
thank you this is useful.
cppb