[GRASS5] 5.3 shared libraries and other experimental changes

Hello everyone
I made some changes to the 5.3 CVS that are quite experimental and will
probably break some things. However it allows to build the core GRASS
libraries as shared, which hugely reduces the size of the binary
distribution.

Please test it by adding the following option to the configure script:
--enable-gmake=no

This enables the alternate build mechanism, and I made some changes to the
Makefiles and used a more up-to-date version of the SC_CONFIG_CFLAGS macro
from the 5.7 aclocal.m4 (I took the latest from the Tcl CVS). This
SC_CONFIG_CFLAGS seems to have already fixed a lot of the issues discussed
in bug 2232 http://intevation.de/rt/webrt?serial_num=2232&display=History

I also added a section for Cygwin. This does not work currently as there
are problems with circular dependencies and resulting undefined symbols
when compiling libraries. In particular the dig2 and vect libraries had
circular dependencies. I didn't look into this more but it may just be a
compiler/linker flag we need like the "-undefined suppress" on OSX. There
was a new version of the OSX flags in Tcl but I commented this and copied
Markus's tried and tested version instead. Somebody could try changing
these flags just to see what happens if they have time.

r.terraflow doesn't compile properly also as its Gmakefile is non-standard
and the mk/genmake.sed conversion filter doesn't work on it. So it can't
be compiled with the alternate build mechanism.

If you wish to use the alternate build mechanism to build static
libraries, add --enable-shared=no as well. (--enable-shared=yes is the
default).

Feel free to fix up and tidy the changes I have made. Seems to work on
Linux (Red Hat 9) and IRIX (6.2) but I haven't tested anywhere else and
much needs tidied anyway. E.g. generating the makefiles for the alternate
build mechanism only needs to be done once but is done every time the
configure script is run, the way I have left it.

Other changes I made were

1) Change the name of the start-up script to grass53 (also for gmake and
gmakelinks). This is quite an important change and should probably go
higher up in this mail or maybe to the users' list.

2) Make --with-gdal the default as there are now several reports that the
gdalbridge code doesn't work.

3) Re-generate the binary nadgrids datum transformation files when
installing a binary distribution, as these are architecture-specific
files.

(For the alternate build mechanism make must be run from a separate build
directory; for make bindist and make srcdist you need to change back to
the top-level source directory and run make there.)

Something I kind of removed was that with mk/mid.mk.shlib (the old shared
library mechanism) the shared libraries had nice version numbers as part
of the filenames. SC_CONFIG_CFLAGS seems to put version numbers in for
some platforms but not very many. I hope it is all right without them as
the GRASS libraries will all be in their own version-specific
sub-directory anyway.

Please test with ./configure --enable-gmake=no and I would hope to make
this the default before the 5.3.0 release.
I will try to fix any bugs I have introduced with these changes but feel
free to tidy things and help with the Cygwin shared dll problem and
r.terraflow's Gmakefile would be much appreciated as well.

Paul

Paul Kelly said:

Hello everyone
I made some changes to the 5.3 CVS that are quite experimental and will
probably break some things. However it allows to build the core GRASS
libraries as shared, which hugely reduces the size of the binary
distribution.

Please test it by adding the following option to the configure script:
--enable-gmake=no

Works perfectly on Debian testing/unstable with following config:

/data/CVS/GRASSCVS/grass/configure --with-gdal --with-readline
--with-tcltk-includes=/usr/include/tcl8.4/
--with-postgres-includes="/usr/include/postgresql/
/usr/include/postgresql/internal/" --with-motif --with-proj
--enable-gmake=no

Very superficial testing has been succesful up to now.

However, when I add

--with-freetype --with-freetype-includes=/usr/include/freetype2

I get the following error in config.log (which I didn't get last time I
compiled):

configure:10927: checking for freetype/freetype.h
configure:10935: gcc -E -I/usr/include/freetype2 conftest.c >/dev/null
2>conftest.out
In file included from configure:10931:
/usr/include/freetype2/freetype/freetype.h:20:2: #error "`ft2build.h'
hasn't been included yet!"
/usr/include/freetype2/freetype/freetype.h:21:2: #error "Please always use
macros to include FreeType header files."
/usr/include/freetype2/freetype/freetype.h:22:2: #error "Example:"
/usr/include/freetype2/freetype/freetype.h:23:2: #error " #include
<ft2build.h>"
/usr/include/freetype2/freetype/freetype.h:24:2: #error " #include
FT_FREETYPE_H"
configure: failed program was:
#line 10930 "configure"
#include "confdefs.h"
#include <freetype/freetype.h>

I use debain package libfreetype6-dev version 2.1.7-1 which installs
ft2build.h in /usr/include/.

Moritz

Moritz Lennert wrote:

> I made some changes to the 5.3 CVS that are quite experimental and will
> probably break some things. However it allows to build the core GRASS
> libraries as shared, which hugely reduces the size of the binary
> distribution.
>
> Please test it by adding the following option to the configure script:
> --enable-gmake=no
>

Works perfectly on Debian testing/unstable with following config:

/data/CVS/GRASSCVS/grass/configure --with-gdal --with-readline
--with-tcltk-includes=/usr/include/tcl8.4/
--with-postgres-includes="/usr/include/postgresql/
/usr/include/postgresql/internal/" --with-motif --with-proj
--enable-gmake=no

Very superficial testing has been succesful up to now.

However, when I add

--with-freetype --with-freetype-includes=/usr/include/freetype2

I get the following error in config.log (which I didn't get last time I
compiled):

configure:10927: checking for freetype/freetype.h
configure:10935: gcc -E -I/usr/include/freetype2 conftest.c >/dev/null
2>conftest.out
In file included from configure:10931:
/usr/include/freetype2/freetype/freetype.h:20:2: #error "`ft2build.h'
hasn't been included yet!"
/usr/include/freetype2/freetype/freetype.h:21:2: #error "Please always use
macros to include FreeType header files."
/usr/include/freetype2/freetype/freetype.h:22:2: #error "Example:"
/usr/include/freetype2/freetype/freetype.h:23:2: #error " #include
<ft2build.h>"
/usr/include/freetype2/freetype/freetype.h:24:2: #error " #include
FT_FREETYPE_H"
configure: failed program was:
#line 10930 "configure"
#include "confdefs.h"
#include <freetype/freetype.h>

This has nothing to do with Paul's changes; you will get the same
error from any other version of GRASS.

Either use a different version of FreeType2, or build without it.

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

Hello Paul,

thanks for the improvements - it compiles perfectly on Mandrake 9.1.
(I have modified the mk/Makefile.docs slightly).

I have no troubles to run 'make' in the main directory.

A (un)related question:

Must the links to front.end necessarily be hard links?
They are created in:
src/CMD/generic/MAKELINKS.sh

Markus

On Mon, Jan 05, 2004 at 12:47:08PM +0000, Paul Kelly wrote:

Hello everyone
I made some changes to the 5.3 CVS that are quite experimental and will
probably break some things. However it allows to build the core GRASS
libraries as shared, which hugely reduces the size of the binary
distribution.

Please test it by adding the following option to the configure script:
--enable-gmake=no

This enables the alternate build mechanism, and I made some changes to the
Makefiles and used a more up-to-date version of the SC_CONFIG_CFLAGS macro
from the 5.7 aclocal.m4 (I took the latest from the Tcl CVS). This
SC_CONFIG_CFLAGS seems to have already fixed a lot of the issues discussed
in bug 2232 http://intevation.de/rt/webrt?serial_num=2232&display=History

I also added a section for Cygwin. This does not work currently as there
are problems with circular dependencies and resulting undefined symbols
when compiling libraries. In particular the dig2 and vect libraries had
circular dependencies. I didn't look into this more but it may just be a
compiler/linker flag we need like the "-undefined suppress" on OSX. There
was a new version of the OSX flags in Tcl but I commented this and copied
Markus's tried and tested version instead. Somebody could try changing
these flags just to see what happens if they have time.

r.terraflow doesn't compile properly also as its Gmakefile is non-standard
and the mk/genmake.sed conversion filter doesn't work on it. So it can't
be compiled with the alternate build mechanism.

If you wish to use the alternate build mechanism to build static
libraries, add --enable-shared=no as well. (--enable-shared=yes is the
default).

Feel free to fix up and tidy the changes I have made. Seems to work on
Linux (Red Hat 9) and IRIX (6.2) but I haven't tested anywhere else and
much needs tidied anyway. E.g. generating the makefiles for the alternate
build mechanism only needs to be done once but is done every time the
configure script is run, the way I have left it.

Other changes I made were

1) Change the name of the start-up script to grass53 (also for gmake and
gmakelinks). This is quite an important change and should probably go
higher up in this mail or maybe to the users' list.

2) Make --with-gdal the default as there are now several reports that the
gdalbridge code doesn't work.

3) Re-generate the binary nadgrids datum transformation files when
installing a binary distribution, as these are architecture-specific
files.

(For the alternate build mechanism make must be run from a separate build
directory; for make bindist and make srcdist you need to change back to
the top-level source directory and run make there.)

Something I kind of removed was that with mk/mid.mk.shlib (the old shared
library mechanism) the shared libraries had nice version numbers as part
of the filenames. SC_CONFIG_CFLAGS seems to put version numbers in for
some platforms but not very many. I hope it is all right without them as
the GRASS libraries will all be in their own version-specific
sub-directory anyway.

Please test with ./configure --enable-gmake=no and I would hope to make
this the default before the 5.3.0 release.
I will try to fix any bugs I have introduced with these changes but feel
free to tidy things and help with the Cygwin shared dll problem and
r.terraflow's Gmakefile would be much appreciated as well.

Paul

--
Markus Neteler <neteler itc it> http://mpa.itc.it
ITC-irst - Centro per la Ricerca Scientifica e Tecnologica
MPBA - Predictive Models for Biol. & Environ. Data Analysis
Via Sommarive, 18 - 38050 Povo (Trento), Italy

Markus Neteler wrote:

thanks for the improvements - it compiles perfectly on Mandrake 9.1.
(I have modified the mk/Makefile.docs slightly).

I have no troubles to run 'make' in the main directory.

A (un)related question:

Must the links to front.end necessarily be hard links?

No; so long as front.end can get the module name from argv[0], it will
work.

The main advantage of using hard links is that all Unix systems
support them, whereas symbolic links were a BSD extension. OTOH, any
Unix system which doesn't have symbolic links probably wouldn't have a
lot of other things which GRASS requires, and probably wouldn't be
much use for anything except a museum exhibit.

They are created in:
src/CMD/generic/MAKELINKS.sh

The alternate build system doesn't use that script; "ln" is called
directly from the "links" target in the Makefile.

BTW, the other stuff which was tacked onto the end of the "links"
target doesn't belong there; I'll add a separate "post-compile"
target.

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