Slackware This Forum is for the discussion of Slackware Linux.
|
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
11-10-2013, 02:06 AM
|
#1
|
Member
Registered: Jun 2012
Location: NB, Canada
Distribution: Slackware
Posts: 73
Rep:
|
What is that command to list dependencies?
I haven't used it in a while, so I've forgotten it, and it's really frustrating me. I know there's a command in Slackware (or maybe it's more general than Slackware, I can't recall) which lists a package's dependencies and indicates which of those are installed.
I've been searching through these forums, docs.slackware.com, & the rest of the web. I'm sure the answer's out there somewhere, but I must be using the wrong search terms.
|
|
|
11-10-2013, 02:09 AM
|
#2
|
Member
Registered: Sep 2011
Posts: 925
|
Welcome back to Slackware. There are no package dependencies in Slackware, so there can be no command to list them. :-)
|
|
|
11-10-2013, 02:21 AM
|
#3
|
Member
Registered: Jun 2012
Location: NB, Canada
Distribution: Slackware
Posts: 73
Original Poster
Rep:
|
hmmmm...
I must be using the wrong terms.
As I think about it more, I'm thinking that maybe it's not specific to Slackware, and maybe it takes only an installed program name as input as lists the libraries it links to? Does that sound more reasonable? I think this might be what it does.
|
|
|
11-10-2013, 02:24 AM
|
#4
|
Senior Member
Registered: Oct 2005
Distribution: Slackware 14.1
Posts: 3,482
|
Perhaps you are thinking about /usr/bin/ldd?
|
|
2 members found this post helpful.
|
11-10-2013, 02:27 AM
|
#5
|
Member
Registered: Jun 2012
Location: NB, Canada
Distribution: Slackware
Posts: 73
Original Poster
Rep:
|
ah ha! The command I was searching for is ldd !
Thanks Woodsman.
On a not-entirely unrelated note, the default Slackware install on linode is terrible in terms of the installed libraries & packages...
|
|
|
11-10-2013, 02:37 AM
|
#7
|
Member
Registered: Jun 2012
Location: NB, Canada
Distribution: Slackware
Posts: 73
Original Poster
Rep:
|
a4z, that looks interesting. I wish the examples page was working though.
edit: I now see that there are examples on the main page. This is really cool. Thanks for making it.
Last edited by WhiteHotLoveTiger; 11-10-2013 at 02:54 AM.
|
|
|
11-10-2013, 03:33 AM
|
#8
|
Senior Member
Registered: Feb 2009
Posts: 1,727
|
hm, have to check what's the problem with the example page is.
the page exists, and it worked, now it stopped working, so possible a bitbucket issue
thank's for the hint, will see what I can do
|
|
|
11-12-2013, 04:48 AM
|
#11
|
Member
Registered: Nov 2013
Location: Antalya
Distribution: Slackware64 current
Posts: 119
Rep:
|
From ldd man page:
Quote:
$ objdump -p /path/to/program | grep NEEDED
|
|
|
|
11-12-2013, 04:54 AM
|
#12
|
Member
Registered: Nov 2013
Location: Antalya
Distribution: Slackware64 current
Posts: 119
Rep:
|
Quote:
Originally Posted by a4z
|
Bookmarked! Thanks.
|
|
|
11-12-2013, 07:18 AM
|
#13
|
LQ Newbie
Registered: Jun 2013
Location: France
Distribution: Slackware
Posts: 28
Rep: 
|
Quote:
Originally Posted by WhiteHotLoveTiger
As I think about it more, I'm thinking that maybe it's not specific to Slackware, and maybe it takes only an installed program name as input as lists the libraries it links to? Does that sound more reasonable? I think this might be what it does.
|
P.V. recommends "readelf -d", See http://http://www.linuxquestions.org/questions/slackware-14/best-practices-for-mainlining-sanity-installing-and-removing-packages-4175469854/page2.html#post4992159 :
Quote:
Originally Posted by volkerdi
IMHO, it's better to use "readelf -d" to check for library dependencies than it is to use "ldd". That way you only see which libraries are directly linked with the binary (and not all the libraries linked to those libraries, etc.)
Using ldd can leave you thinking that there's a lot more stuff to rebuild after an soname bump than there actually is.
|
|
|
|
11-12-2013, 07:57 AM
|
#14
|
Senior Member
Registered: Feb 2009
Posts: 1,727
|
readelf is basically what sbbdep does. it uses elfio to explore the binaries
since it caches information it reports the packages and possible alternatives, or reports something as missing if not available
and it tells what programs do need a library/package
it has also a ldd option to use the ldd lookup,
and some other stuff
so in some sense it is like a swiss army knive that brings together some functionality
|
|
|
11-12-2013, 11:49 AM
|
#15
|
Amigo developer
Registered: Dec 2003
Location: Germany
Distribution: Slackware
Posts: 4,928
|
The objdump command shown does the same as the readelf command shown. Either of them are much safer than using ldd because using ldd actually executes(tries anyway) the command in order to track what it gets linked to. If the binary in question is malicious then simply having a look with ldd lets it do its thing, whereas reading the ELF header using objdump or readelf makes no attempt to execute the thing.
This is not perfect, but makes a nice replacement to using ldd:
Code:
#!/bin/bash
# Copyright 2009-2013 Gilbert Ashley <amigo@ibiblio.org>
# re-written from an idea by
# Ricardo Garcia Gonzalez.
# His version needed bash-4, awk, cat, cut, grep and tr -plus objdump
# This only needs bash >=3.0 and objdump :-)
# I added the "not found" report
# version 0.1
# version 0.2 added a commented-out alternative method using readelf
if [[ -n $1 ]] ; then
declare MY_LIBS="$(objdump -p $@ |grep NEEDED)"
# results look like this:
#' NEEDED libc.so.6'
# Hmm, we can get similar output using:
# readelf -d $@ |grep '(NEEDED)'
# which returns something like this:
#'0x00000001 (NEEDED) Shared library: [libc.so.6]'
# declare MY_LIBS=$(readelf -d $@ |grep '(NEEDED)'|cut -f2 -d'[' |cut -f1 -d ']')
# Library directories.
LIBDIRS=${LD_LIBRARY_PATH//:/ }"/lib$LIBDIRSUFFIX /usr/lib$LIBDIRSUFFIX"
if [[ -r /etc/ld.so.conf ]] ; then
while read LINE ; do
LIBDIRS=${LIBDIRS}" $LINE"
done < /etc/ld.so.conf
fi
#LIBDIRS=${LIBDIRS}${LD_LIBRARY_PATH//:/ }
for LINE in $(echo $MY_LIBS) ; do
HAVE_LIB=0
if [[ $LINE != "NEEDED" ]] ; then
for LIBDIR in $LIBDIRS ; do
if [[ -e "$LIBDIR/$LINE" ]] ; then
# don't use '-x' which requires the lib to be executable
HAVE_LIB=1
echo "$LIBDIR/$LINE"
# for an output more like the real ldd:
# echo "$LINE => $LIBDIR/$LINE"
break
else
continue
fi
done
if [[ $HAVE_LIB != 1 ]] ; then
echo "$LINE"" not found"
# for an output more like the real ldd:
# echo "$LINE => not found"
fi
fi
done
fi
|
|
|
All times are GMT -5. The time now is 01:23 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|