0

I was going to link a program statically with libcurl, libssl, libcryto. Then I found this behaviour.

If i link with -lssl, ldd shows that compiled binary depends on libssl.so shared object.

But if i link with libssl.a, ldd shows that compiled binary doesn't depends on that (This is what i wants).

The case is similar for libssl and libcrypto but not for libcurl.

I always thought/read before those are same(link options -lssl and libcurl.a). Can you please put some light on this or any tutorial about this?

Al Mamun
  • 944
  • 9
  • 27
  • 2
    `libssl.a` is the static library, while `libssl.so` is the dynamic library. When you use `libssl.a` you *explicitly* link with that library. When you use the `-l` option the linker will decide which library to use (if multiple variants are available). – Some programmer dude May 02 '21 at 08:40
  • @Someprogrammerdude my whole life is a lie :( Thanks a lot. – Al Mamun May 02 '21 at 09:40
  • The question isn't really duplicate, but the answer is "read some general information about static/dynamic libraries", so I closed this as duplicate pointing to a question rich of relevant information. – arrowd May 02 '21 at 09:59

0 Answers0