
Shared Libraries: Understanding Dynamic Loading - sanojsubran
https://amir.rachum.com/blog/2016/09/17/shared-libraries/
======
TravisSc6tt
Copying the cheat sheet over for reference:

Find out what dependencies are missing with ldd <executable>. If you don’t
identify them, you can check if they are direct dependencies by running
readelf -d <executable> | grep NEEDED. Make sure the dependencies actually
exist. Maybe you forgot to compile them or move them to a libs directory? Find
out where dependencies are searched by using LD_DEBUG=libs ldd <executable>.
If you need to add a directory to the search: Ad-hoc: add the directory to the
LD_LIBRARY_PATH environment variable. Baked in the file: add the directory to
the executable or shared library’s rpath or runpath by passing
-Wl,-rpath,<dir> (for rpath) or -Wl,--enable-new-dtags,-rpath,<dir> (for
runpath). Use $ORIGIN for paths relative to the executable. If ldd shows that
no dependencies are missing, see if your application has elevated privileges.
If so, ldd might lie. See security concerns above.

