0

I have own project - security_storage - with own OpenSSL package.

The openssl libs are next:

  1. libcrypto.so
  2. libssl.so

I build my project with cmake. Project have several dependcies, including openssl libs:

target_link_libraries(${LIBRARY_NAME} PUBLIC
my_static_lib
...
crypto
ssl
)

After compilation my binary have next dependecies:

ldd ./bin/security_storage 
libssl.so.1.1 => not found
libcrypto.so.1.1 => not found

But there are no shared libs with version, because my OpenSSL libs doesn't have version number. How to remove version number from binary dependecies?

synacker
  • 1,722
  • 13
  • 32
  • 1
    Why is this question tagged CMake? Did you use CMake with your project? If so, please add your CMake code to your question post. – Kevin Sep 24 '19 at 14:58
  • Thank you for comment, add info about cmake – synacker Sep 24 '19 at 15:07
  • "because my OpenSSL libs doesn't have version number" - When link with `ssl` library, the linker thought that you have these versioned files. Looks like you have `libssl.so` in non-system directory, but linker uses the `libssl.so` installed system-wide. In that case you may try to pass absolute path to the library when link with it. – Tsyvarev Sep 24 '19 at 15:11
  • But, how to disable link from system directory ? I cann't use absolute paths, my openssl lib is placed in folder with application – synacker Sep 24 '19 at 16:28
  • "I can't use absolute paths, my openssl lib is placed in folder with application" - this changes nothing. Note, that path for the linker and path for the runtime loader (RPATH) are **different things**. Having absolute path for one doesn't imply absolute path for the other. BTW, how have you obtained your `libssl.so`? If it was so-versioned on creation, it still contains that information. If you want the library without soversion, then you need to build it so. – Tsyvarev Sep 24 '19 at 16:40
  • You can use absolute paths by doing something like this: `target_link_libraries(${LIBRARY_NAME} PUBLIC my_static_lib ... ${PROJECT_SOURCE_DIR}/MyOpenSSL/libs/libssl.so ...)`, but a more preferable approach is probably to use `find_library()` with `PATHS` to locate the library, or the answer [here](https://stackoverflow.com/a/10550334/3987854). – Kevin Sep 24 '19 at 21:34

1 Answers1

0

I resolved my issue!

The problem were next:

  1. I copy my openssl lib from another folder
  2. The source folder contains symlinks.
  3. I copied only symlinks without library.
  4. Symlinks without library are referenced to the system openssl lib!

The solution is copy from custom openssl folder with symlinks and libs.

synacker
  • 1,722
  • 13
  • 32