The Haiku/BeOS Tip Server
Tips and tricks for Haiku/BeOS users

Get needed libraries for an application

Contributed by: Thorbjörn Jemander
This tip is valid for: Both BeOS and Haiku

To get a nice printout of which libraries are required by a given application, cut and paste the text below into your .profile. Once you’ve done that, you can just type

getlibs appname

(where appname is the name of the application you want to investigate) in your Terminal to find the needed libraries.




getlibs()
{
        if [ "$#" = "0" ]; then
                echo "No executable specified."
                return 1
        fi
        if [ -f "$1" ]; then
                objdump --all-headers "$1" | grep NEEDED | awk '{
print $2 }'
        else
                echo "Can't find executable '$1'."
                return 1
        fi
        return 0
}

Posted in Scripting


(comments are closed).