static linking libssl and libcrypto

Jakob Bohm jb-openssl at wisemo.com
Wed Nov 6 08:38:20 UTC 2019


Regarding #1: Using libSSL.a instead of libSSL.so should avoid using
libSSL.so by definition.  Otherwise something went seriously wrong
with the linking.  Same for any other library.

On 05/11/2019 18:22, Aijaz Baig wrote:
> Thank you for the information.
>
> I will address your points here:
> 1. I was not aware of the fact that only those symbols that have been 
> used get imported when linking a library statically. So that very well 
> could be the case. I didn't get what you mentioned about the static 
> linking preventing the program from requiring libSSL.so. I mean the 
> way I am linking my library should be of no concern to the source code 
> right? Or so I think.
>
> 2. when I downloaded and compiled the openssl library (from source), I 
> followed the INSTALL read me. All it resulted was libssl.a and 
> libcrypto.a. I didn't find any file name libSSL.so. So how will this 
> static library (archive) have references to libSSL.so on the system?? 
> I am kind of confused here now.
>
>
> On Mon, Nov 4, 2019 at 4:59 PM Brice André <brice at famille-andre.be 
> <mailto:brice at famille-andre.be>> wrote:
>
>     Hello,
>
>     It's not an open-ssl issue, but more a compiler specific one.
>
>     With info you provided, I cannot tell you what you get as results,
>     but two points that may help:
>
>      1. regarding the 87 ssl symbols : when you link with a library,
>         only the useful symbols are imported. So, if the code in you
>         libAPP library only uses some sparse functions of libSSL, it's
>         normal you only have corresponding symbols in your final
>         image. I don't know what you plan to do, but note that
>         statically linking your dll with open-ssl will prevent this
>         dll from needing the openssl dynamic library. But it will not
>         prevent your main program to require the open-ssl library to
>         run properly if some part of it is dynamically linked with
>         open-ssl !
>      2. depending on how you compiled your libssl.a, it can be either
>         a static library containing the full openssl binary code, or a
>         static library that just makes the "link" between you code and
>         the ssl dynamic library. In the second case, even if you
>         properly statically link with this lib, you will still need
>         the dll to execute your program.
>
>

Enjoy

Jakob
-- 
Jakob Bohm, CIO, Partner, WiseMo A/S.  https://www.wisemo.com
Transformervej 29, 2860 Søborg, Denmark.  Direct +45 31 13 16 10
This public discussion message is non-binding and may contain errors.
WiseMo - Remote Service Management for PCs, Phones and Embedded



More information about the openssl-users mailing list