[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: static linking?

Drake Mobius writes:

> The question is, how do I do that? I apt-get source dialog, for example, and
> then ./configure and edit the resultant makefile to include -static on the
> LDFLAGS line...but it doesn't seem to be working. ldd /usr/bin/local/dialog
> returns 'not a dynamic executable' instead of 'statically linked'.

ldd returning 'not a dynamic executable' on your executable, means
that your executable *is* statically linked.

It will not resolve symbols using dynamic libraries, since all symbols
will reside in the executable itself.

A dynamic executable would say:

$ ldd foo
        libpthread.so.0 => /lib/i686/libpthread.so.0 (0x4001f000)
        libm.so.6 => /lib/i686/libm.so.6 (0x40070000)
        libwibucmlin.so => /usr/lib/libwibucmlin.so (0x40093000)
        libc.so.6 => /lib/i686/libc.so.6 (0x403b4000)
        /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x40000000)
        libstdc++.so.5 => /usr/lib/libstdc++.so.5 (0x404e8000)
        libdl.so.2 => /lib/libdl.so.2 (0x405a8000)
        libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x405ab000)

And a statically linked executable would say:

$ ldd foo
not a dynamic executable

$ file foo
file foo: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV),
for GNU/Linux 2.2.5, statically linked, not stripped
-- Jhair

Reply to: