Static library dependency

Hi.

What command would you use to find the object files, static library libc.a depends on in /usr/lib

is it whereis libc.a
or ldd /usr/lib/libc

ldd libc.a /usr/lib says no such file or directory
Sorry if it is not directly relevant to c++

Last edited on
whereis: locate the binary, source, and manual page files for a command
ldd: print shared library dependencies

you may see the undefined symbols on the *.a with a `nm' command
nm: list symbols from object files


now, to know where (in which .a those symbols are defined) I don't have a good answer.
You could traverse all the .a in the directory and perform a nm | grep to see if they define the symbol
1
2
3
4
5
6
//not tested
for K in *.a; do
   if nm "$K" | grep "a symbol that I need" | grep "T"; then
      echo "may be here $K"
   fi
done


Or you could better use pkg-config to manage such dependencies. It would look on files the order and which libraries you need to link against
thank you
Topic archived. No new replies allowed.