static linking with glib

Pavel Roskin proski at gnu.org
Mon Jan 27 21:45:30 UTC 2003


On Mon, 27 Jan 2003, Alexander Varakin wrote:

> How?

Good question :-)

Different methods I can think of:

1) Don't compile shared library if you don't have glib installed.

2) Make a directory, put a link to libglib.a there and add the directory
to LDFLAGS:

mkdir staticlibs
ln -s /usr/lib/libglib.a staticlibs/
make LDFLAGS=-L`pwd`/staticlibs
rm -rf staticlibs

3) Instruct the linker to pick the static library:
make GLIB_LIBS='-Wl,-Bstatic -lglib -Wl,-Bdynamic'

The same applies to all other libraries.

-- 
Regards,
Pavel Roskin



More information about the mc-devel mailing list