How to Figure Out What the Linker is Looking for
Refer to this stackoverflow answer.
For example,
/usr/bin/ld: cannot find -lnvinfer
# try the following command
$ ld -lnvinfer --verbose
# the possible output would look like
=========================================================
attempt to open /usr/....../libnvinfer.so failed
attempt to open /usr/.../libnvinfer.so failed
.
.
.
# then fix this issue by creating a symlink
$ sudo ln -s /usr/.../libnvinfer.so /usr/.../libnvinfer.so
General Tricks about Compiling / Build
Display info about ELF (Executable and Linkable Format) files
# -d flag stands for --dynamic
$ readelf -d <bin> | grep NEEDED