12

I have read that .so is a dynamic library file and .a is a static library file.

While building openssl i gave the option ./Configure no-shared and it created a lot of .a files.

So, my question is will the other packages like apache will be able to use .a files from openssl?

for example libcrypto.a,

someone please advice me if im going enirely through wrong path.

Qben
  • 2,617
  • 2
  • 24
  • 36
Droider
  • 459
  • 2
  • 6
  • 14
  • Related post - [What's the difference between .so, .la and .a library files?](https://stackoverflow.com/q/12237282/465053) – RBT May 21 '18 at 23:42

3 Answers3

11

Basically the static library can be compiled into another application at link time. In your example Apache could use libcrypto.a during build time and include it in the Apache httpd application.

A dynamic .so library can be loaded and unloaded at runtime and you have a better flexibility to change what Apache should support without recompiling the Apache binaries.

Using Apache as example the dynamic loading of .so files are described in the Dynamic Shared Object (DSO) section in the documentation. You can also find links to the installation section which describe how to include static libraries at build time.

There is a good question about this that could be good to read, and that provide mote details in the subject.

Difference between shared objects (.so), static libraries (.a), and DLL's (.so)?

Community
  • 1
  • 1
Qben
  • 2,617
  • 2
  • 24
  • 36
  • Thanks for the effort. So, if libcrypto.a is statically linked during build time and included in httpd application. whether the module for httpd application like mod_ssl will be created as static or dynamic library ? If its a dynamic one i have to use LoadModule in the httpd.conf file. In case of static it is automatically loaded when the httpd starts right ? – Droider Oct 29 '13 at 05:23
  • If it's static you need to add it during compilation of httpd application, you can't load it dynamically at startup as with dynamic libraries. I have not worked with Solaris for years, but maybe this will help if you can consider running mod_ssl dynamically. http://stackoverflow.com/questions/11548943/compile-apache-2-4-2-in-solaris-10-in-a-x86-machine-64bits-errors or this http://docs.oracle.com/cd/E19830-01/819-4712/ablws/ – Qben Oct 29 '13 at 06:30
1

If A.a is static library and two different programs want to use it. A.a is created two times for each program. while If A.so is dynamic library than two programs access same file. Its mean that you are using reference in library.

If your library is going to be shared among several executables(like apache and openssl), it often makes sense to make it dynamic to reduce the size of the executables. Otherwise, definitely make it static.

In your case you must create dynamic library

Samar Haider
  • 862
  • 10
  • 21
  • Thanks for the answer. The problem is that I was not able to build FIPS capable openssl with shared libraries. while building openssl with configure no-shared it goes fine. so, i thought of compiling httpd against static openssl libraries and turned out here !! – Droider Oct 29 '13 at 05:28
  • By the way i use openss-1.0.1e httpd-2.4.6 openssl-fips-2.0.5 on Solaris 10 platform with SPARC architecture. Any help to build FIPS capable openssl with shared library support on the above platform would be helpful. – Droider Oct 29 '13 at 05:33
0

Please read - http://www.yolinux.com/TUTORIALS/LibraryArchives-StaticAndDynamic.html.

It is a very good tutorial with example.

you will learn -

  1. what is static library (.a) and how to make it.
  2. what is shared library (.so) and how to make it.
  3. difference with .ddl (windows os)
Monir
  • 1,402
  • 14
  • 16