I use CMake and Ninja to build a test executable of mine written in C++. I use gcc 4.8. I'm on Ubuntu 14.
I run CMake to configure the ninja build scripts, then I run ninja to build. I specify the
libcrypto.so and other openssl
*.so files as target dependencies in the CMake script.
When running the executable, I get the following error:
error while loading shared libraries: libcrypto.so.1.0.0: cannot open shared object file: No such file or directory
I have my
libcrypto.so file sitting right next to the test executable:
-rw-r--r-- 1 robert domain users 1796847 Apr 20 15:43 libboost_wave.so -rw-r--r-- 1 robert domain users 410916 Apr 20 15:43 libboost_wserialization.so -rw-r--r-- 1 robert domain users 2251519 Apr 21 11:28 libcrypto.so -rw-r--r-- 1 robert domain users 701627 Apr 20 15:43 libEGL.so -rw-r--r-- 1 robert domain users 4255871 Apr 20 15:43 libGLES_CM.so -rw-r--r-- 1 robert domain users 7550551 Apr 20 15:43 libGLESv2.so -rw-r--r-- 1 robert domain users 949113 Apr 17 14:34 libsqlite.so -rw-r--r-- 1 robert domain users 496298 Apr 21 11:28 libssl.so -rwxr-xr-x 1 robert domain users 3099250 Apr 21 11:30 Test_UI_String*
(The executable I'm running is named
CMake is setup to output shared libraries right next to executables because on other platforms like Windows (where I am most familiar with development) the DLL files need to be right next to the EXE for it to be found and loaded.
I'm confused about why it has appended
1.0.0 to the end of the library file. It should be looking for it without a version number at the end, since when I linked the dependency it had the same name as
libcrypto.so does now in the directory shown above.
I'd like to better understand the behavior here, however my main question is basically about how to get this working as intended (Find the library dependencies that are located in the same directory as the executable).