Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum. |
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.
|
 |
09-04-2003, 01:52 PM
|
#1
|
Senior Member
Registered: Aug 2003
Location: Portland, Oregon
Distribution: Arch
Posts: 1,374
Rep:
|
libraries
a long tiem ago I was given a command that would tell me what libraries a binary calls, you ran it in this commandline
$ command binary
that simple it would then print a list of libraries.
does anyone knwo what this command/program is?
|
|
|
09-04-2003, 01:56 PM
|
#2
|
Moderator
Registered: Mar 2003
Location: Scotland
Distribution: Slackware, RedHat, Debian
Posts: 12,047
Rep:
|
You may be talking about strace:
strace your_command
|
|
|
09-04-2003, 01:56 PM
|
#3
|
Senior Member
Registered: Dec 2001
Location: 35.7480° N, 95.3690° W
Distribution: Debian, Gentoo, Red Hat, Solaris
Posts: 2,070
Rep:
|
ldd program
|
|
|
09-04-2003, 02:11 PM
|
#4
|
Senior Member
Registered: Aug 2003
Location: Portland, Oregon
Distribution: Arch
Posts: 1,374
Original Poster
Rep:
|
ldd is what I was looking for, now here is the tricky question:
lld lynx gives this:
ldd `which lynx`
libz.so.1 => /usr/lib/libz.so.1 (0x4002a000)
libncurses.so.5 => /lib/libncurses.so.5 (0x40038000)
libssl.so.0 => /usr/lib/libssl.so.0 (0x40074000)
libcrypto.so.0 => /usr/lib/libcrypto.so.0 (0x400a5000)
libc.so.6 => /lib/libc.so.6 (0x401a2000)
libdl.so.2 => /lib/libdl.so.2 (0x402d5000)
/lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x40000000)
what would I do in a shell script to make that output to this:
ldd ${i}
needed command to make that go into a variable like this:
echo ${out}
libz.so.1 libncurses.so.5 libssl.so.0 libcrypto.so.0 libc.so.6 libdl.so.2 linux.so.2
basically I need to get a list of the libraries a program (${i}) needs and have that list in the format of each one next to the other in a variable (${out})
any ideas?
|
|
|
09-04-2003, 02:21 PM
|
#5
|
Moderator
Registered: Mar 2003
Location: Scotland
Distribution: Slackware, RedHat, Debian
Posts: 12,047
Rep:
|
Try this:
echo -n `ldd \`which lynx\`| cut -d"=" -f1 | awk {'print $1'}`
|
|
|
09-04-2003, 02:28 PM
|
#6
|
Senior Member
Registered: Aug 2003
Location: Portland, Oregon
Distribution: Arch
Posts: 1,374
Original Poster
Rep:
|
that worked great, now 2 questions
1) when I add this to a script I am working on should I give you credit by saying: "I love it, I got it at Ross?"?
2) how do I cut /lib/ld-linux.so.2 out of the end of the output :-P I am not a newbie, but in the 4 years I have used linux I have never done anything in text/string manipulation.
|
|
|
09-04-2003, 02:41 PM
|
#7
|
Moderator
Registered: Mar 2003
Location: Scotland
Distribution: Slackware, RedHat, Debian
Posts: 12,047
Rep:
|
1) Completely up to you - I ain't exactly going to prosecute 
Clicking the Affero button is a good way to show appreciation and it helps LQ at the same time.
2) If you mean get rid of "/lib/" then you could use sed:
echo `ldd \`which lynx\`| cut -d"=" -f1 | sed {'s/\/lib\///'} | awk {'print $1'}`
|
|
|
09-04-2003, 02:45 PM
|
#8
|
Senior Member
Registered: Aug 2003
Location: Portland, Oregon
Distribution: Arch
Posts: 1,374
Original Poster
Rep:
|
I think I will be looking into these, sed, awk, and cut commands/programs
|
|
|
09-04-2003, 02:49 PM
|
#9
|
Moderator
Registered: Mar 2003
Location: Scotland
Distribution: Slackware, RedHat, Debian
Posts: 12,047
Rep:
|
They all have their uses - once you get used to them then it isn't too hard to see when tou use them. awk and sed can actually get quite complicated and involve large scripts in more complex cases.
|
|
|
09-04-2003, 03:10 PM
|
#10
|
Senior Member
Registered: Aug 2003
Location: Portland, Oregon
Distribution: Arch
Posts: 1,374
Original Poster
Rep:
|
well, actually I needed them for a script I am working on, it is a 2000 line *(so far) script that will take a directory of taballs/subdirectories, compile sourcecodes in configure/make perl, python, precompiled, then install or make packages of them using rpm, tgz, deb or a tar.bz2 with a few helpers inside. almost done, just needed this to help top it off.
|
|
|
All times are GMT -5. The time now is 07:17 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
|
|