The path /usr/local/lib must be in /etc/ld.so.conf or in one of the files in the /etc/ld.so.conf.d/ directory. Thus, the mongoc library will go into the cache when the ldconfig command is ldconfig as root.
You can check if the mongoc library mongoc in the dynamic linker cache by running this command
ldconfig -p | grep mongoc
If you can run your program without explicitly specifying LD_LIBRARY_PATH.
Another way to check if your executable is properly linked is to get the binding information using the ldd command. It will print all linked libraries.
ldd mongotest
If you see /usr/local/lib/libmongoc.so.[numbers] , it means that it is associated with the mongoc library.
source share