[uClibc] Help required: compiler generates static binaries

Vanja Hrustic vanja at pobox.com
Thu Apr 29 15:21:35 UTC 2004


Hello!

I've started playing with uClibc, and have build the 'buildroot'
environment.

I later chroot to it, and compile stuff. Things seems to work okay.

However, I am puzzled with one thing. Most things I compile are linked
statically. For example, Boa webserver.

Now, I can see that /lib/ directory contains some shared libraries, and
/usr/lib/contains some static libraries. I assume linker uses libc.a from
/usr/lib/.

How could I 'force' linker to use shared libraries?

For example, if I compile 'hello world', it will be static binary (16K
big). But I'd like it to be linked against shared libraries. Command line
is like:

gcc -Wall -o hello hello.c

If I create shared library, and put it in /usr/lib (libtest, for example),
resulting binary (which invokes function from libtest) is linked to both
libtest.so and libc.so.

I am used to 'normal' (like, desktop/server installations :) Linux
behaviour where everything is dynamically linked, unless instructed
otherwise, so this is bit confusing to me.

Since I'm new to uClibc, any help on (or pointers to docs that talk about)
this is much appreciated.

Thanks.

Vanja



More information about the uClibc mailing list