LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 11-10-2013, 02:06 AM   #1
WhiteHotLoveTiger
Member
 
Registered: Jun 2012
Location: NB, Canada
Distribution: Slackware
Posts: 73

Rep: Reputation: 2
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.
 
Old 11-10-2013, 02:09 AM   #2
jtsn
Member
 
Registered: Sep 2011
Posts: 925

Rep: Reputation: 483Reputation: 483Reputation: 483Reputation: 483Reputation: 483
Welcome back to Slackware. There are no package dependencies in Slackware, so there can be no command to list them. :-)
 
Old 11-10-2013, 02:21 AM   #3
WhiteHotLoveTiger
Member
 
Registered: Jun 2012
Location: NB, Canada
Distribution: Slackware
Posts: 73

Original Poster
Rep: Reputation: 2
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.
 
Old 11-10-2013, 02:24 AM   #4
Woodsman
Senior Member
 
Registered: Oct 2005
Distribution: Slackware 14.1
Posts: 3,482

Rep: Reputation: 546Reputation: 546Reputation: 546Reputation: 546Reputation: 546Reputation: 546
Perhaps you are thinking about /usr/bin/ldd?
 
2 members found this post helpful.
Old 11-10-2013, 02:27 AM   #5
WhiteHotLoveTiger
Member
 
Registered: Jun 2012
Location: NB, Canada
Distribution: Slackware
Posts: 73

Original Poster
Rep: Reputation: 2
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...
 
Old 11-10-2013, 02:29 AM   #6
a4z
Senior Member
 
Registered: Feb 2009
Posts: 1,727

Rep: Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743
if you are looking for info about binary dependencies, try this

https://bitbucket.org/a4z/sbbdep/wiki/Home
 
2 members found this post helpful.
Old 11-10-2013, 02:37 AM   #7
WhiteHotLoveTiger
Member
 
Registered: Jun 2012
Location: NB, Canada
Distribution: Slackware
Posts: 73

Original Poster
Rep: Reputation: 2
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.
 
Old 11-10-2013, 03:33 AM   #8
a4z
Senior Member
 
Registered: Feb 2009
Posts: 1,727

Rep: Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743
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
 
Old 11-10-2013, 03:49 AM   #9
a4z
Senior Member
 
Registered: Feb 2009
Posts: 1,727

Rep: Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743
seems to be a bitbucket issue, bug is already reported
https://bitbucket.org/site/master/is...i-page-getting
 
Old 11-12-2013, 12:45 AM   #10
a4z
Senior Member
 
Registered: Feb 2009
Posts: 1,727

Rep: Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743
bitbucket fixed the issue so the expample page is back
https://bitbucket.org/a4z/sbbdep/wiki/examples
 
Old 11-12-2013, 04:48 AM   #11
arsivci0
Member
 
Registered: Nov 2013
Location: Antalya
Distribution: Slackware64 current
Posts: 119

Rep: Reputation: 23
From ldd man page:

Quote:
$ objdump -p /path/to/program | grep NEEDED
 
Old 11-12-2013, 04:54 AM   #12
arsivci0
Member
 
Registered: Nov 2013
Location: Antalya
Distribution: Slackware64 current
Posts: 119

Rep: Reputation: 23
Quote:
Originally Posted by a4z View Post
if you are looking for info about binary dependencies, try this

https://bitbucket.org/a4z/sbbdep/wiki/Home
Bookmarked! Thanks.
 
Old 11-12-2013, 07:18 AM   #13
sebre
LQ Newbie
 
Registered: Jun 2013
Location: France
Distribution: Slackware
Posts: 28

Rep: Reputation: Disabled
Quote:
Originally Posted by WhiteHotLoveTiger View Post
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 View Post
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.
 
Old 11-12-2013, 07:57 AM   #14
a4z
Senior Member
 
Registered: Feb 2009
Posts: 1,727

Rep: Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743
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
 
Old 11-12-2013, 11:49 AM   #15
gnashley
Amigo developer
 
Registered: Dec 2003
Location: Germany
Distribution: Slackware
Posts: 4,928

Rep: Reputation: 613Reputation: 613Reputation: 613Reputation: 613Reputation: 613Reputation: 613
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
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How can I get full list of dependencies? (RPM) adisan82 Linux - Software 2 01-26-2011 08:29 AM
[SOLVED] Script to list dependencies MTK358 Programming 25 12-22-2009 09:23 AM
list all dependencies when one, or more, blocked by 'masked by: ~amd64 keyword'? zymos Gentoo 2 08-18-2009 11:28 PM
yum and packagekit - list installed packages and dependencies allele Linux - Newbie 2 06-24-2009 04:31 PM
Sources list and Packages dependencies varaonsite Debian 2 07-31-2006 05:43 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 01:23 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration