This is a kind of question that tech writers would want to know: What packages or dependencies are there of our product.
There's two kinds of dependency in C/C++ as opposed to a singular list of Python dependency (I'm not talking test-specific dependency found in some Python packages or that kind of sort).
There are:
- header include dependency
- library dependency
Header Include Dependency
There is a C/C++ compiler option that list out all non-system include files:
gcc -c -MMD <source.c>
For all include files:
gcc -c -MD <source.c>
And with those list of include files, you can find out the packages that provides it, for example, in Debian:
dpkg-query -S <include-file.h>
Library Dependencies
Best approach to securing a complete list of libraries used for a particular platform/distro is to use the ldd to extract a list of external object codes that your program requires before it can get up and running.
#!/bin/bash
# List Debian packages that a given executable is dependent on
BINARY_FILE=$1
LIB_LIST=$(ldd $1 | gawk '{ print $1 }' | tr '\n' ' ')
for THIS_LIB in $LIB_LIST; do
dpkg-query -S $THIS_LIB
done
Output result of /bin/ls gives you a multi-platform list of packages that ls executable file depends on:
~/bin/dpkg-dependency-by-executable.sh /bin/ls
dpkg-query: no path found matching pattern *linux-vdso.so.1*
libselinux1:amd64: /lib/x86_64-linux-gnu/libselinux.so.1
libc6-x32: /libx32/libc.so.6
libc6:amd64: /lib/x86_64-linux-gnu/libc.so.6
libc6-i386: /lib32/libc.so.6
libpcre3:amd64: /lib/x86_64-linux-gnu/libpcre.so.3
libpcre3:amd64: /lib/x86_64-linux-gnu/libpcre.so.3.13.3
libc6-i386: /lib32/libdl.so.2
libc6-x32: /libx32/libdl.so.2
libc6:amd64: /lib/x86_64-linux-gnu/libdl.so.2
libc6:amd64: /lib64/ld-linux-x86-64.so.2
libc6-i386: /lib32/libpthread.so.0
libc6-x32: /libx32/libpthread.so.0
libc6:amd64: /lib/x86_64-linux-gnu/libpthread.so.0
root#
With those list, you can ascertain that your autotools has properly make dependency test for them (and often without the system-related ones).