Static vs Shared

Gerard Beekmans gerard at linuxfromscratch.org
Tue Jun 27 09:32:36 PDT 2000


> Is there any reason to compile static support if your using
> shared libraries.  Is I am ./configuring, I often see support
> for both configured, but am wondering if static is needed.

In addition to what others have already told (and I hope I'm not
misinterpreting your question): when you configure a library package you
can often choose to configure it to build a static library, a shared
library or both. You have to ask yourself the question whether you would
use a static library. If you ever plan on linking a program statically
you need to have it's support libraries available as static programs.

Imagine the dynamically linked program apache:

chaser:~/pictures$ ldd /usr/apache/bin/httpd 
        libm.so.6 => /lib/libm.so.6 (0x4001a000)
        libcrypt.so.1 => /lib/libcrypt.so.1 (0x40037000)
        libdl.so.2 => /lib/libdl.so.2 (0x40064000)
        libc.so.6 => /lib/libc.so.6 (0x40068000)
        /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x40000000)

If you want to have a static apache (a program that does not need
dynamic libraries) you'll need to have the above libraries available as
static ones. All the above are from the GNU C Library. You can always
choose not have any static libraries installed on your system if you
never link anything static. And if you, at some point, do need to
link a program statically you can always install the needed static
libraries.

-- 
Gerard Beekmans
www.linuxfromscratch.org

-*- If Linux doesn't have the solution, you have the wrong problem -*-
--
Mail archive: http://www.pcrdallas.com/mail-archives/lfs-discuss
IRC access: server: irc.linuxfromscratch.org port: 6667 channel: #LFS
Unsubscribe: email lfs-discuss-request at linuxfromscratch.org and put
"unsubscribe" (without the quotation marks) in the body of the message
(no subject is required)



More information about the lfs-dev mailing list