[GRASS-dev] GRASS 6.4.2RC1 planning

Glynn Clements glynn at gclements.plus.com
Thu Sep 29 01:38:20 EDT 2011


Hamish wrote:

> > > one that failed was d.barb, it failed looking for
> > -lfreetype, although libfreetype6.so.* is found in /usr/lib.
> > 
> > That won't help; it would have to be using -lfreetype6
> > rather than -lfreetype.
> 
> sorry my mistake, /usr/lib/libfreetype.so.6* exists from the main
> debian package, while /usr/lib/libfreetype.so and *.a come from
> the -dev package.
> 
> so -lfreetype can't be found, but once the -dev package is
> installed and the addon module does build it seems to pick up
> the non-dev one:
> 
> $ ldd d.barb  | grep freetype
>     libfreetype.so.6 => /usr/lib/libfreetype.so.6 (0x00601000)
> 
> could resetting $ARCH_LIBPATH make it somehow forget to look in
> /usr/lib/ or follow ld.so.conf?

When the linker is passed -lfoo, it looks for libfoo.so or libfoo.a in
the library path (typically /usr/lib plus any directories specified by
-L switches). It will not look for libfoo.so.<something>.

libfoo.so would normally be a symlink to the actual library, which
will have a version number appended to it (e.g. libfoo.so.6).

If it finds libfoo.so (a shared library), and that library contains an
embedded "soname" (e.g. libfoo.so.6), the soname will be embedded into
the executable. Otherwise the orignal library name (e.g. libfoo.so)
will be embedded into the executable.

The loader uses whichever name is embedded in the executable to find
the library.

IOW, the unversioned symlink (libfoo.so) is only required for linking. 
Loading (i.e. running) an executable only requires the library proper. 
This is why the unversioned symlink is normally only included in the
-dev package.

In general, you can't build programs which use a library without the
library's -dev package.

While d.barb doesn't actually use the freetype library directly, 6.x's
Grass.make says otherwise:

	DRIVERLIB     = -l$(DRIVER_LIBNAME) $(GISLIB) $(FTLIB) $(ICONVLIB) 
	...
	RASTERLIB     = -l$(RASTER_LIBNAME) $(PNGDRIVERLIB) $(PSDRIVERLIB) $(DRIVERLIB) $(GISLIB) 

I.e. anything which links against $(RASTERLIB) will end up with
$(FTLIB) in the link command. If libfreetype.so or libfreetype.a
doesn't exist, the command will fail (in spite of the fact that the
library isn't actually required, insofar as the absence of the library
won't result in the executable having any unresolved symbols).

7.0 doesn't have this problem. There, Grass.make doesn't include the
dependencies in the various FOOLIB variables unless you opt to use
static libraries (--disable-shared).

-- 
Glynn Clements <glynn at gclements.plus.com>


More information about the grass-dev mailing list