[GRASS5] Re: [GRASSLIST:390] Re: compile grass51_exp_2003_06_07

Glynn Clements glynn.clements at virgin.net
Sun Jun 15 11:21:45 EDT 2003


[Moved to developers' list.]

Paul Kelly wrote:

> > I encountered the same problem, which I corrected with the following
> > modification to a makefile.
> >
> > include/Make/Grass.make: l.193
> >     added $(LAPACKLIB) and $(BLASLIB) to def of GMATHLIB, i.e,
> >     GMATHLIB    = -l$(GMATH_LIBNAME) $(LAPACKLIB) $(BLASLIB)
> >
> > The problem occurs because the missing functions are from the lapack
> > and/or blas libraries, which are required by GMATH_LIBNAME when you
> > configure with lapack and/or blas.
> 
> I think that looks right so I have fixed it in CVS.

It's semi-correct (i.e. it's the best that can be done with the
current build system).

Ideally, the shared libraries themselves should be linked against any
dependent libraries.

Where a shared library depends upon a static library, this would
result in the code from the static library being incorporated into the
shared library. Programs which link against the shared library
wouldn't need to explicitly link against the static library (unless
the program itself used the same static library directly).

OTOH, where a shared library depends upon another shared library, that
would be added as a dependency. Again, programs using the shared
library wouldn't need to explicitly link against the dependency.

However, static libraries can't be linked against other libraries so,
in that case, the programs would need to explicitly link against the
dependencies as well.

In this particular case, the net result would be that a shared gmath
library either wouldn't have any external references to the
BLAS/LAPACK libraries (when they are static libraries), or would have
them as explicit dependencies (when they are shared libraries).

More generally, the bottom line is that static libraries and shared
libraries are substantially different, and the build system needs some
enhancements to deal with the differences. Primarily, each library
needs a dependency list, e.g.

	GMATHDEPS	= $(LAPACKLIB) $(BLASLIB)

For shared libraries, the dependencies need to be used when building
the library; for static libraries, when building programs which use
the library, e.g.

	ifeq ($shared_libs, y)
	GMATHLIB	= -l$(GMATH_LIBNAME)
	GMATHSLIBDEPS	= $(GMATHDEPS)
	else
	GMATHLIB	= -l$(GMATH_LIBNAME) $(GMATHDEPS)
	GMATHSLIBDEPS	= 
	endif

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




More information about the grass-dev mailing list