ldd relies on capabilities provided by the glibc dynamic linker,
ld-linux.so.2, which presumably doesn't exist on win32. If you follow
what the ldd script actually does, "ldd /bin/ls" effectively ends up
doing "env LD_TRACE_LOADED_OBJECTS=1 LD_LIBRARY_VERSION=6 /bin/ls",
which will produce the same results when you run it interactively. But
it won't work if you don't have an ld.so(8) that gives
LD_TRACE_LOADED_OBJECTS=1 a special meaning.
Possibly you could hack together something that works using the output
of "objdump -p <filename>" instead. This will tell you the top level
shared library dependencies of the file (the "NEEDED" entries in
"Dynamic Section"), but it won't tell you about any indirect
dependencies (ie. what the dependent libraries themselves need), or
which library pathnames would be used to satisfy those dependencies.
> [Thinstation-developer] ldd on Win32
> "Kevin Ian Beaumont" <kevin.beaumont@...>
> Sun, 25 Feb 2007 19:09:41 +0000
> Hello chaps,
> I'm having adventures trying to get Thinstation to build natively on
> Win32. I've actually made very good progress, but one thing which
> stumps is this -- I can't get ldd working on Win32. From what I've
> found on Google so far, it appears nobody has tried to make a version
> of ldd which works on Linux binaries (instead they've made ldd.exe,
> which works on WinNT binaries).
> So, Thinstation won't build, as it can't figure out what to include.
> I'm trying to think of inventive ways around this. At the moment, I'm
> thinking about some kind of pre-made (on Linux) 'database', which a
> fake ldd queries. If anybody has any ideas, I'd loves them up.