Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the clang analogue of ldd?

Tags:

clang

ldd

How do I find out what DLLs an executable depends on?

On systems with the GNU development toolchain (gcc &c) I use ldd for that, but what about the clang systems, like, e.g., Mac OS X (which does not have ldd)?

like image 441
sds Avatar asked May 16 '14 14:05

sds


People also ask

What is ldd on Mac?

ldd uses ld to load executable files, and recursively loads dynamically-linked libraries. So using ldd requires being on the target system (e.g., Linux). Thus, ldd cannot be used for ELF files on macOS.

Does Mac have ldd?

On Mac OS there is no ldd and people recommend using otool -L , but that shows which shared libraries are expected, not weather or not they are there.


1 Answers

llvm-readelf ---needed-libs is the clang analogue of ldd. Here's is the official documentation

~/weechat $ llvm-readelf --needed-libs bin/weechat
NeededLibraries [
  libc.so
  libcurl.so
  libdl.so
  libgcrypt.so
  libgnutls.so
  libgpg-error.so
  libiconv.so
  libm.so
  libncursesw.so.6
]
like image 97
Arun Avatar answered Oct 22 '22 07:10

Arun