Page 1 of 1

How to find all executables dependent on a library?

Posted: Sat 29 Jul 2006, 04:13
by toddyjoe
I know that one can use "ldd" followed by the name of an executable file to find and list all the library files that the executable file is dependent upon and requires. However, is there anything that does the opposite, i.e., lists all executable files that depend upon a given library file? I thought Jonathan Marsden worked on something like that in an older version of Puppy but I could never get the commands he was using to work on the Puppy versions I had. I am trying to customize my own Puppy and want to efficiently figure out which library files can be safely deleted after certain executable files are also deleted.

Posted: Sat 29 Jul 2006, 10:29
by Dougal
I remember Jonathan Marsden's script, I tried it and it worked for me. I think I had to create some bash script that run his perl script.

I can try searching for it later and possibly post it here tomorrow, if you're interested.

Posted: Sat 29 Jul 2006, 20:12
by toddyjoe
If you find it, I would be interested in seeing it. It may make my efforts a whole lot less time-consuming. Thanks!

Posted: Sun 30 Jul 2006, 17:06
by Dougal
Ok, here we go:

The "scripts" tarball contains the Jonathan M perl script with the bash script that runs it. (I didn't try it again, but I don't see why it shouldn't work.)

I also wrote a bash script that does the same job and more: it creates a file with a list of the libraries missing and one of "orphaned" libraries- that nothing depends on, so they might not be needed (not for sure, but at least worth investigating).

Posted: Sun 30 Jul 2006, 19:52
by fluxit
Keep in mind that executables which have been compressed by upx can't be read by ldd. They have the same dependencies as executables that are not compressed.

--Lee

Posted: Sun 30 Jul 2006, 21:05
by toddyjoe
Thanks for the files, Dougal, and thanks for the information, fluxit! I will try them out tonight.

Posted: Mon 31 Jul 2006, 13:10
by Dougal
Lee: I'm ashamed to say I don't know what upx compressed execs are...
However, I don't think Puppy has any.

Anyway, there is another problem: "find" doesn't seem to recognise some directories!
I tried my best to get it to find files within the /usr/lib/perl5 directory and it just wouldn't do it!
I'll probably post a bug report about it tomorrow...

Posted: Tue 01 Aug 2006, 08:29
by fluxit
http://upx.sourceforge.net/

I usually upx executables that I install into my Puppy save file to save space.

--Lee

Posted: Tue 01 Aug 2006, 12:33
by Dougal
Looks interesting, but I assume it's pointless for files inside a squashfs file, right? Otherwise it could be useful to use on the iso...

Posted: Wed 02 Aug 2006, 12:51
by Dougal
Toddyjoe: look at the message I posted about the problem with "find".

I actually have another script, which goes over all the paths and finds everything, but it's much slower. If you want I can post it here for you.

Lee, I could actually add an exception for UPX in my script -- have each UPX file extracted to a temp folder and then lld'd...

Posted: Wed 02 Aug 2006, 15:51
by toddyjoe
It seems to me I saw similar problems and discussions with the "find" function pop up somewhere else when I was first researching Linux in general. I will follow these two threads and revise the script you already provided as developments and progress are made. Thank you for the warning!

Posted: Thu 03 Aug 2006, 07:00
by fluxit
Dougal,

Yeah, compressing already compressed files often leads to more overhead thus taking up more space instead of less.

You're right, singling out the upx's and decompressing them will definitely work. I'm not sure what the exact header id string is for UPX, but it has UPX in it :)

--Lee