[GRASS5] Shared Libraries

Glynn Clements glynn.clements at virgin.net
Sun Apr 21 17:08:11 EDT 2002


Bernhard Reiter wrote:

> > compliments to Glynn - I was able to compile GRASS
> > with shared libraries and reduce the binaries size to
> > 31MB (was around 100MB before, if I recall correctly).
> 
> A useful addition.
> We could ship it with 5.0.0, but we should not make it the default,
> as this usually is a part that will create difficulties on several platforms.
> 
> Glynn: Are you using something platform portable like libtool already?

No, and I don't intend to; actually, if GRASS ever starts using
libtool, I'm off.

At present, the situation is complicated by the fact that the
Gmakefiles have to work with two separate build systems: the original
"gmake" system, plus the GNU make based stuff in "mk". You have to use
the latter if you want shared libraries (or if you want to build
outside of the source tree).

My approach would be to have a selection of "lib.mk" files. The
configure script would select one of them, according to the target
platform, to be included from each makefile.

If there isn't a lib.mk file for a particular platform (either because
the platform doesn't support shared libraries, or because no-one has
written the lib.mk file yet), it would fall back to producing static
libraries.

The current mechanism for building shared libraries is just a
substitute mid.mk file with different settings for the make variables
which control linking.

Also, while this might be useful for binary distributions (I'm not
sure whether the advantages outweight the potential problems), I did
it primarily for the benefit of developers.

First, if you're modifying library code, you only need to rebuild the
library; you don't have to re-link the programs. Second, the
information obtained from running "nm" or "ldd" on an executable is
more useful when the executable is linked against shared versions of
the GRASS libraries.

-- 
Glynn Clements <glynn.clements at virgin.net>



More information about the grass-dev mailing list