Ldd (linux) equivalent on haiku?

Hi All,

is thereis command equivalent with ldd linux on haiku? i want to check application dependecies…

best regards


Objdump -x filename
Can help you

“readelf -d filename” does list dependencies too.

thanks @korli and @extrowerk … i still dont get information as i need… (full path lib/file needed)
problem is like this:

i try to run lazarus on haiku that provide by turboG http://www.turbog.com/lazarus-binaries-for-haiku-os/
and follow what write there (i use their compiled binary) . extract lazarus on /boot/home/lazarus/lazarus
and then problem come when i run from console
show error:

runtime loader cannot open file libQt4pas.so.5

usually in linux i’m just “ldd executable file”
i’ll find the dependencies file and place libQT4pas.so.5 on appropiate place…

right now i have libQt4pas.so.5 but dont know where to put this file…
-right now i place on folder same as executeable → failed to run …

runtime loader cannot open file libQt4pas.so.5
-copy to /boot/system/lib - cannot because cannot write to write protected volume

any help is really appreciated.

Create a lib folder in the Same folder where your executable is.
Or use the /Boot/system/non-packaged/lib folder.

The runtime_loader should find the required stuff then.

Or you can try to package it. Read more about the packaged file-system in the haikuporter wiki.

The dependencies in Haiku are rarely path-based. Instead, we use just the soname, and the runtime_loader searches several places (from the LIBRARY_PATH environment variable) to locate the library.

thank you both @extrowerk and @PulkoMandy
big thank for the knowledge you share to us
finally above error is gone…
but unfortunately it turn another problem (out of memory…) maybe i’ll try to another nightly build i have and maybe try to compile fpc/lazarus…

You should contact Olivier Coursière (oco), our freepascal maintainer, I think he is aware of the problem.
Freepascal used some tricks in the BeOS days to workaround limitations in mmap, I think, and it does not play well with ASLR in Haiku. This should be cleaned up to use a memory allocation strategy similar to what is done in Freepascal for Linux if I remember correctly.

thank you @PulkoMandy for your suggestion… i will try to contact @oco

thanks all

I ended up with the following and simple solution:

make a shell script with the following content:



function grepdep() {
    objdump -x $1 | grep NEEDED

grepdep "$ID"

Name it grepdep and place this script in /boot/home/config/non-packaged/bin

Then, when you want to get dependencies of an application, open a Terminal and type:

grepdep /boot/home/config/apps/SMPlayer/bin/smplayer
(I made example with smplayer)

And you will get:

1 Like

Hah! Thanks, G. – that works rather well!

Of course I’ve turned it into a xicon script :grin: and put it on my desktop, so that I can just drop an executable or library on it and see the list.

1 Like

Hi Pete! Can you share such xicon script? :slight_smile:

Kind regards.

Well actually all you need to make it useful as a xicon one is to add a ‘read’ command at the end, so the Terminal window doesn’t quit until you’ve read it. (Then you just drop it on the “Convert to xicon script” script to make it active.)

Since you ask, though :slight_smile:, I did modify it a bit… I like using my “matt” utility that reformats the text to be a bit neater:

 #! /bin/sh
 objdump -x $1|matt 'NEEDED[ /t]*(.*)' -o '$1\n'

(In case it’s not obvious, that strips out the “NEEDED” part, so you just get the libs.)

1 Like

Can’t resist twiddling! :grinning: I put back your function, and call it in a loop, so that you can drop multiple files at once. And I replaced my matt with more common calls:

#! /bin/sh

function getlibs {
echo $(basename "$1") uses:
#objdump -x "$1"|matt 'NEEDED[ /t]*(.*)' -o '  $1\n'
objdump -x "$1"|grep NEEDED |cut -b 14-

for x; do getlibs "$x"; done

Good improvements, Pete! :+1:

wow… really nice script… thank you for sharing… i’ll try for sure