Problem description
Target:a.out
So:libmyfile.so
Dependency Description :
A.out:libmyfile.so
libmyfile.so:libssl.so.1.0.0
libssl.so.1.0.0:libcrypto.so.1.0.0
Because of the problem of make parameter, it is shown that when generating a.out, error myfile.so has reference to undefined symbol, and the symbol appears in libcrypto.so.1.0.0;
Suspicious scenario
Specify the-l parameter, then add the Ssl,crypto dependency to the-l parameter to make, and compile successfully;
Questions:
From the dependencies, it is obvious that my build target is dependent on libmyfile.so, and the relationship with Libmyfile.so's dependencies should be transparent. Why it needs to be added to the parameters of the target in this layer;
Formal methods
Careful inspection of the error message will find that this is an LD error, LD indicates the use of-rpath designated library loading directory;
Therefore, in addition to the libmyfile.so dependency and the library search directory, we should specify the path of the library load-time dependencies for the LD when generating the a.out target;
It is very simple to place so in the same directory, specifying the-rpath parameter when generating an executable target, so that the LD automatically searches for dependencies.
Troubleshooting Link-time symbolic dependency issues for Linux. So