0

I compiled a c program which uses openssl, when I tried to run the executable file on other machine, I got some error:

error while loading shared libraries: libssl.so.1.1: cannot open shared object file: No such file or directory

This may be caused by the old version of openssl on the machine where I run the executable file. It is complicated if I should install the right version of openssl where I run the program.
How to get rid of this dependence?

anatolyg
  • 26,506
  • 9
  • 60
  • 134
Liu-Feng
  • 91
  • 2
  • 10
  • 1
    you get rid of the dependency by linking it statically instead of dynamically – Raildex Mar 07 '22 at 08:26
  • How to do that? – Liu-Feng Mar 07 '22 at 08:28
  • command the linker to link it statically. – Raildex Mar 07 '22 at 08:48
  • Thanks a lot. What if I want to do that in c++? – Liu-Feng Mar 07 '22 at 09:18
  • 2
    You can tell the linker to [statically link a library](https://stackoverflow.com/questions/6578484/telling-gcc-directly-to-link-a-library-statically). Linking is essentially the same for all languages compiled languages (including C/C++): the linker takes all object files and creates the object code for your software, which will then be assembled by the assembler. You need to find your linker settings and update those. – Simon Doppler Mar 07 '22 at 10:48
  • You can make an appimage https://stackoverflow.com/q/69319186/1216776 – stark Mar 08 '22 at 11:57

0 Answers0