[GRASS5] GRASS-header-file locations changed?

Dear Developers,

Just compiled GRASS from a fresh CVS-Checkout with success. After
that i tried to compile QGIS-SVN with GRASS_support.

Then I realized that
the include-headers are living in $GRASSINST/include/grass/*.h, but
QGIS-configure searches them in $GRASSINST/include/*.h.

I checked back with fromer installations of GRASS-CVS and there were
$GRASSINST/include/grass/ and $GRASSINST/include/ with nearly the same
content.
$GRASSINST/include/grass/ has 2 more files, interpf.h and waterglobs.h.
$GRASSINST/include/ only has portable.h.

Is this the normal behavior or did I miss something?

Thanks for clearing this.

Best regards

  Stephan

--
GDF Hannover - Solutions for spatial data analysis and remote sensing
Hannover Office - Mengendamm 16d - D-30177 Hannover
Internet: www.gdf-hannover.de - Email: holl@gdf-hannover.de
Phone : ++49-(0)511.39088507 - Fax: ++49-(0)511.39088508

Stephan Holl wrote:

Just compiled GRASS from a fresh CVS-Checkout with success. After
that i tried to compile QGIS-SVN with GRASS_support.

Then I realized that
the include-headers are living in $GRASSINST/include/grass/*.h, but
QGIS-configure searches them in $GRASSINST/include/*.h.

I checked back with fromer installations of GRASS-CVS and there were
$GRASSINST/include/grass/ and $GRASSINST/include/ with nearly the same
content.
$GRASSINST/include/grass/ has 2 more files, interpf.h and waterglobs.h.
$GRASSINST/include/ only has portable.h.

Is this the normal behavior or did I miss something?

The duplicates have been removed. GRASS code (including the headers
themselves) now references headers as <grass/gis.h> etc.

For external packages which haven't been updated yet, create a symlink
e.g.:

  ln -s grass $GRASSINST/include/grass/grass

then tell the configure script that the GRASS headers are in
$GRASSINST/include/grass rather than in $GRASSINST/include.

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

On 2/14/06, Glynn Clements <glynn@gclements.plus.com> wrote:

Stephan Holl wrote:

> Just compiled GRASS from a fresh CVS-Checkout with success. After
> that i tried to compile QGIS-SVN with GRASS_support.
>
> Then I realized that
> the include-headers are living in $GRASSINST/include/grass/*.h, but
> QGIS-configure searches them in $GRASSINST/include/*.h.
>
> I checked back with fromer installations of GRASS-CVS and there were
> $GRASSINST/include/grass/ and $GRASSINST/include/ with nearly the same
> content.
> $GRASSINST/include/grass/ has 2 more files, interpf.h and waterglobs.h.
> $GRASSINST/include/ only has portable.h.
>
> Is this the normal behavior or did I miss something?

The duplicates have been removed. GRASS code (including the headers
themselves) now references headers as <grass/gis.h> etc.

For external packages which haven't been updated yet, create a symlink
e.g.:

        ln -s grass $GRASSINST/include/grass/grass

then tell the configure script that the GRASS headers are in
$GRASSINST/include/grass rather than in $GRASSINST/include.

The external packages are using --with-grass only,
not --with-grass-includes/libs.
I still believe that it is a wrong approach to make compilation of
other packages with GRASS support more difficult than it was before.

Radim

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

_______________________________________________
grass5 mailing list
grass5@grass.itc.it
http://grass.itc.it/mailman/listinfo/grass5

Radim Blazek wrote:

> > Just compiled GRASS from a fresh CVS-Checkout with success. After
> > that i tried to compile QGIS-SVN with GRASS_support.
> >
> > Then I realized that
> > the include-headers are living in $GRASSINST/include/grass/*.h, but
> > QGIS-configure searches them in $GRASSINST/include/*.h.
> >
> > I checked back with fromer installations of GRASS-CVS and there were
> > $GRASSINST/include/grass/ and $GRASSINST/include/ with nearly the same
> > content.
> > $GRASSINST/include/grass/ has 2 more files, interpf.h and waterglobs.h.
> > $GRASSINST/include/ only has portable.h.
> >
> > Is this the normal behavior or did I miss something?
>
> The duplicates have been removed. GRASS code (including the headers
> themselves) now references headers as <grass/gis.h> etc.
>
> For external packages which haven't been updated yet, create a symlink
> e.g.:
>
> ln -s grass $GRASSINST/include/grass/grass
>
> then tell the configure script that the GRASS headers are in
> $GRASSINST/include/grass rather than in $GRASSINST/include.

The external packages are using --with-grass only,
not --with-grass-includes/libs.

That's a bug.

I still believe that it is a wrong approach to make compilation of
other packages with GRASS support more difficult than it was before.

So GRASS' is obliged to install itself according to the demands of
third-party packages?

The existing layout is wrong; GRASS should be able to be installed
into /usr/{bin,lib,include,share} just like every other package.

Installing headers directly into /usr/include isn't practical, due to
the number of files and the fact that some of them have very common
names (e.g. bitmap.h or colors.h).

Like other sizeable packages, headers should go into their own
subdirectory, and the subdirectory should be used in #include
statements, as with <X11/Xlib.h>, <GL/gl.h> etc (PostgreSQL doesn't do
this, and it's responsible for a significant proportion of
configure-related queries to this list).

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

On 2/14/06, Glynn Clements <glynn@gclements.plus.com> wrote:

> The external packages are using --with-grass only,
> not --with-grass-includes/libs.

That's a bug.

Why? GRASS installs everything in GISBASE.
--with-grass is path to GISBASE.

> I still believe that it is a wrong approach to make compilation of
> other packages with GRASS support more difficult than it was before.

So GRASS' is obliged to install itself according to the demands of
third-party packages?

It breaks compilation for many people. Why we cannot
support both places untill updated GDAL/QGIS will be available?
It does not cost anything, until now there were 2 copies of header
file and it was not problem.

The existing layout is wrong; GRASS should be able to be installed
into /usr/{bin,lib,include,share} just like every other package.

Installing headers directly into /usr/include isn't practical, due to
the number of files and the fact that some of them have very common
names (e.g. bitmap.h or colors.h).

Of course, I agree, that was the reason for the change.

Like other sizeable packages, headers should go into their own
subdirectory, and the subdirectory should be used in #include
statements, as with <X11/Xlib.h>, <GL/gl.h> etc (PostgreSQL doesn't do
this, and it's responsible for a significant proportion of
configure-related queries to this list).

Should PostgreSQL follow demands of third-party packages?

Radim

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

Hello Glynn, Radim,

On Tue, 14 Feb 2006 10:05:11 +0000 Glynn Clements
<glynn@gclements.plus.com> wrote:

Radim Blazek wrote:

> > > Just compiled GRASS from a fresh CVS-Checkout with success.
> > > After that i tried to compile QGIS-SVN with GRASS_support.
> > >
> > > Then I realized that
> > > the include-headers are living in $GRASSINST/include/grass/*.h,
> > > but QGIS-configure searches them in $GRASSINST/include/*.h.
> > >
> > > I checked back with fromer installations of GRASS-CVS and there
> > > were $GRASSINST/include/grass/ and $GRASSINST/include/ with
> > > nearly the same content.
> > > $GRASSINST/include/grass/ has 2 more files, interpf.h and
> > > waterglobs.h. $GRASSINST/include/ only has portable.h.
> > >
> > > Is this the normal behavior or did I miss something?
> >
> > The duplicates have been removed. GRASS code (including the
> > headers themselves) now references headers as <grass/gis.h> etc.
> >
> > For external packages which haven't been updated yet, create a
> > symlink e.g.:
> >
> > ln -s grass $GRASSINST/include/grass/grass
> >
> > then tell the configure script that the GRASS headers are in
> > $GRASSINST/include/grass rather than in $GRASSINST/include.
>
> The external packages are using --with-grass only,
> not --with-grass-includes/libs.

That's a bug.

> I still believe that it is a wrong approach to make compilation of
> other packages with GRASS support more difficult than it was before.

So GRASS' is obliged to install itself according to the demands of
third-party packages?

The existing layout is wrong; GRASS should be able to be installed
into /usr/{bin,lib,include,share} just like every other package.

Installing headers directly into /usr/include isn't practical, due to
the number of files and the fact that some of them have very common
names (e.g. bitmap.h or colors.h).

Like other sizeable packages, headers should go into their own
subdirectory, and the subdirectory should be used in #include
statements, as with <X11/Xlib.h>, <GL/gl.h> etc (PostgreSQL doesn't do
this, and it's responsible for a significant proportion of
configure-related queries to this list).

So I think we should sort this issue out soon, otherwise we will run
into trouble with other packages which needs GRASS-libs and -header
(gdal-grass, QGIS, etc.).

What do you thing is the best approach? Patching gdal-grass and qgis
configure.in to accept with --with-grass-libs and
--with-grass-lincludes?

This should be done AFAIK. Does anybody feel doing this?

Thank you for commenting this.

Best
  Stephan

--
GDF Hannover - Solutions for spatial data analysis and remote sensing
Hannover Office - Mengendamm 16d - D-30177 Hannover
Internet: www.gdf-hannover.de - Email: holl@gdf-hannover.de
Phone : ++49-(0)511.39088507 - Fax: ++49-(0)511.39088508

Radim Blazek wrote:

...

I still believe that it is a wrong approach to make compilation of
other packages with GRASS support more difficult than it was before.

>>

So GRASS' is obliged to install itself according to the demands of
third-party packages?

The existing layout is wrong; GRASS should be able to be installed
into /usr/{bin,lib,include,share} just like every other package.

Radim,

(forgive me if I have attribution wrong)

GRASS is not obligated to install itself according to the "demands"
of third party packages. *But* there is a high cost in disruption and
software builder anguish to a change like moving the grass include files
into a subdirectory.

It is clearly a cleaner technical solution, but I just hope you are
aware of the implicit cost. We will basically see several years worth
of email from package builders about this and that external package
not building and them not knowing why. As an external package developer
trying to be cooperative with GRASS, I will also get frustrated.

That said, does GRASS have a "grass-config" type script that other packages
can use to determine correct libs, include and other information? I looked
around in my GRASS 6.0.1 install tree and didn't see anything. While it will
be a while before this helps, perhaps this would be a good time to introduce
this common convention into GRASS. Especially important would be to a
"grass-config --libs" option as the list of libraries tends to evolve
from release to release.

Best regards,
--
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up | Frank Warmerdam, warmerdam@pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush | Geospatial Programmer for Rent

Radim Blazek wrote:

> > The external packages are using --with-grass only,
> > not --with-grass-includes/libs.
>
> That's a bug.

Why? GRASS installs everything in GISBASE.
--with-grass is path to GISBASE.

As a general rule, there's no reason to assume any kind of correlation
between library directories and header directories. The files can
always be moved from their "default" locations, and ultimately you are
going to be defining two different sets of switches in two different
variables.

FWIW, autoconf's built-in AC_PATH_X[TRA] macros produce separate
switches for X:

  --x-includes=DIR X include files are in DIR
  --x-libraries=DIR X library files are in DIR

even though the same "optimisation" would have worked on every X
installation I've ever seen (whether /usr/X11R<something>,
/usr/openwin or, with recent versions of X, just /usr).

> > I still believe that it is a wrong approach to make compilation of
> > other packages with GRASS support more difficult than it was before.
>
> So GRASS' is obliged to install itself according to the demands of
> third-party packages?

It breaks compilation for many people. Why we cannot
support both places untill updated GDAL/QGIS will be available?
It does not cost anything, until now there were 2 copies of header
file and it was not problem.

Mostly because I wanted to ensure that GRASS itself wasn't relying
upon multiple copies of the headers. The only practical way to do that
was to ensure that, throughout the compilation process, only one copy
was present, so that anything relying upon additional copies produced
an error.

From that perspective, much of the problem is that the mechanism for
installing two copies was spread across multiple Makefiles. The
additional copy wasn't a final step performed as part of the
installation process; headers were being installed as individual
subdirectories were being built (sometimes at the beginning, sometimes
at the end).

If it is determined that either GDAL or QGIS can't easily be updated
to handle one copy of the headers and a single symlink (e.g. through
separate --with-grass-includes and --with-grass-libs switches), and
the copy actually *needs* to be reinstated, it needs to be done as a
single step in the top-level Makefile as part of the installation
process, so that compilation (and re-compilation) isn't affected.

Actually, I can't see how the inconvenience can ever be greater than
"cp -a $GISBASE/include/grass/* $GISBASE/include". Anyone who
considers that to be a major problem should try building some other
projects from their CVS HEAD version.

> Like other sizeable packages, headers should go into their own
> subdirectory, and the subdirectory should be used in #include
> statements, as with <X11/Xlib.h>, <GL/gl.h> etc (PostgreSQL doesn't do
> this, and it's responsible for a significant proportion of
> configure-related queries to this list).

Should PostgreSQL follow demands of third-party packages?

A public interface exists solely for third-party packages. The problem
with PostgreSQL's approach is that it is generally inconvenient. OTOH,
the recent changes to GRASS are only inconvenient in that specific
packages are:

a) relying upon the previous interface (the lack of a prefix
subdirectory in the header names); whilst backwards compatibility is
important, it doesn't mean that something which is broken must stay
broken indefinitely.

b) relying upon an "accidental" feature of previous versions (the fact
that the configure script's --libdir= and --includedir= switches are
ignored, with headers and libraries always being installed into
hardcoded subdirectories of the --prefix= directory).

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

Frank Warmerdam wrote:

>>> I still believe that it is a wrong approach to make compilation of
>>> other packages with GRASS support more difficult than it was before.
>>
>> So GRASS' is obliged to install itself according to the demands of
>> third-party packages?
>>
>> The existing layout is wrong; GRASS should be able to be installed
>> into /usr/{bin,lib,include,share} just like every other package.

Radim,

(forgive me if I have attribution wrong)

The first cited sentence is Radim's; the reply is mine. I'm the one
causing the problems.

GRASS is not obligated to install itself according to the "demands"
of third party packages. *But* there is a high cost in disruption and
software builder anguish to a change like moving the grass include files
into a subdirectory.

Sure; but it was bound to happen sooner or later.

GRASS can't realistically follow normal packaging rules (e.g.
honouring all of the built-in autoconf switches) without using a
separate subdirectory (at least four of its headers clash with files
already present in my /usr/include directory).

Additionally, the lack of a subdirectory prefix in header names risks
causing problems for third-party packages which need to include
headers from both GRASS and other packages (how do you ensure that
"#include <display.h>" includes GRASS' display.h rather than the one
from some other package?).

It is clearly a cleaner technical solution, but I just hope you are
aware of the implicit cost. We will basically see several years worth
of email from package builders about this and that external package
not building and them not knowing why. As an external package developer
trying to be cooperative with GRASS, I will also get frustrated.

I appreciate that it is bound to cause problems, but it had to be done
at some point. The only issue is how to handle the transition.

I don't mind adding (minor) "hacks" to GRASS to aid transition, but I
think that we need to provide some incentive for third party packages
to change so that the hacks can eventually be removed. I don't want a
situation where GRASS has to maintain "bug compatibility" forever so
that other packages can forever avoid updating.

IOW, there needs to be at least some trivial inconvenience to packages
which don't update. If their users have to type an explicit
--with-grass-includes= switch, that would be about right, IMHO.

That said, does GRASS have a "grass-config" type script that other packages
can use to determine correct libs, include and other information? I looked
around in my GRASS 6.0.1 install tree and didn't see anything. While it will
be a while before this helps, perhaps this would be a good time to introduce
this common convention into GRASS. Especially important would be to a
"grass-config --libs" option as the list of libraries tends to evolve
from release to release.

I don't think that a simple "grass-config --libs" will suffice. GRASS
has several identifiable subsystems, some of which can themselves
require substantial numbers of additional libraries.

What should "grass-config --libs" output? Just libgis and its
dependencies (which won't suffice if you need e.g. the vector
functionality), or all of the libraries?

For the latter option, look at the the dependency list for the OGSF
library if --with-ffmpeg was used:

$ ldd /opt/grass-6.1.cvs/lib/libgrass_ogsf.so
  libgrass_gis.so => /opt/grass-6.1.cvs/lib/libgrass_gis.so (0x40084000)
  libgrass_datetime.so => /opt/grass-6.1.cvs/lib/libgrass_datetime.so (0x40134000)
  libz.so.1 => /lib/libz.so.1 (0x40150000)
  libgrass_bitmap.so => /opt/grass-6.1.cvs/lib/libgrass_bitmap.so (0x40161000)
  libgrass_vect.so => /opt/grass-6.1.cvs/lib/libgrass_vect.so (0x40164000)
  libgrass_dig2.so => /opt/grass-6.1.cvs/lib/libgrass_dig2.so (0x4019b000)
  libgrass_dgl.so => /opt/grass-6.1.cvs/lib/libgrass_dgl.so (0x401af000)
  libgrass_rtree.so => /opt/grass-6.1.cvs/lib/libgrass_rtree.so (0x401c8000)
  libgrass_linkm.so => /opt/grass-6.1.cvs/lib/libgrass_linkm.so (0x401cf000)
  libgrass_dbmiclient.so => /opt/grass-6.1.cvs/lib/libgrass_dbmiclient.so (0x401d1000)
  libgrass_dbmibase.so => /opt/grass-6.1.cvs/lib/libgrass_dbmibase.so (0x401db000)
  libgdal.so.1 => /usr/local/lib/libgdal.so.1 (0x401ea000)
  libGL.so.1 => /usr/lib/opengl/xorg-x11/lib/libGL.so.1 (0x404e3000)
  libGLU.so.1 => /usr/lib/libGLU.so.1 (0x4054f000)
  libtiff.so.3 => /usr/lib/libtiff.so.3 (0x405ca000)
  libavcodec.so.0 => /usr/lib/libavcodec.so.0 (0x4061a000)
  libgrass_image.so => /opt/grass-6.1.cvs/lib/libgrass_image.so (0x408e6000)
  libgrass_sites.so => /opt/grass-6.1.cvs/lib/libgrass_sites.so (0x408eb000)
  libgrass_g3d.so => /opt/grass-6.1.cvs/lib/libgrass_g3d.so (0x408f2000)
  libc.so.6 => /lib/libc.so.6 (0x40912000)
  libgif.so.4 => /usr/lib/libgif.so.4 (0x40a2a000)
  libjpeg.so.62 => /usr/lib/libjpeg.so.62 (0x40a32000)
  libgeotiff.so => /usr/lib/libgeotiff.so (0x40a50000)
  libpng.so.3 => /usr/lib/libpng.so.3 (0x40a71000)
  libdl.so.2 => /lib/libdl.so.2 (0x40aa1000)
  libstdc++.so.5 => /usr/lib/gcc-lib/i386-pc-linux-gnu/3.3.6/libstdc++.so.5 (0x40aa6000)
  libm.so.6 => /lib/libm.so.6 (0x40b60000)
  libgcc_s.so.1 => /usr/lib/gcc-lib/i386-pc-linux-gnu/3.3.6/libgcc_s.so.1 (0x40b83000)
  libpthread.so.0 => /lib/libpthread.so.0 (0x40b8b000)
  libXxf86vm.so.1 => /usr/lib/libXxf86vm.so.1 (0x40bde000)
  libXext.so.6 => /usr/lib/libXext.so.6 (0x40be3000)
  libX11.so.6 => /usr/lib/libX11.so.6 (0x40bf2000)
  libmp3lame.so.0 => /usr/lib/libmp3lame.so.0 (0x40cbb000)
  libogg.so.0 => /usr/lib/libogg.so.0 (0x40d50000)
  libvorbis.so.0 => /usr/lib/libvorbis.so.0 (0x40d55000)
  libvorbisenc.so.2 => /usr/lib/libvorbisenc.so.2 (0x40d7c000)
  libdts.so.0 => /usr/lib/libdts.so.0 (0x40e7a000)
  libfaad.so.0 => /usr/lib/libfaad.so.0 (0x40e9f000)
  libfaac.so.0 => /usr/lib/libfaac.so.0 (0x40ee2000)
  libavutil.so.0 => /usr/lib/libavutil.so.0 (0x40ef2000)
  libpostproc.so.0.0.1 => /usr/lib/libpostproc.so.0.0.1 (0x40ef6000)
  /lib/ld-linux.so.2 (0x80000000)
  libproj.so.0 => /usr/lib/libproj.so.0 (0x40efe000)
  libmp4v2.so.0 => /usr/lib/libmp4v2.so.0 (0x40f34000)

You don't want to be linking all of those in if you only need libgis.

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

On Tue, Feb 14, 2006 at 07:05:25PM +0000, Glynn Clements wrote:
...

GRASS can't realistically follow normal packaging rules (e.g.
honouring all of the built-in autoconf switches) without using a
separate subdirectory (at least four of its headers clash with files
already present in my /usr/include directory).

Additionally, the lack of a subdirectory prefix in header names risks
causing problems for third-party packages which need to include
headers from both GRASS and other packages (how do you ensure that
"#include <display.h>" includes GRASS' display.h rather than the one
from some other package?).

*If* things are currently changing, why not renaming files in the
same moment (sorry for being naive)?
E.g.,

#include <grass_display.h>

It would be now a rather easy search-replace job. Since we are
in 6.1 a.k.a. experimental, we can do it. Better to do it now that
waiting unless more applications link to GRASS directly.

Markus

Glynn Clements wrote:

I don't think that a simple "grass-config --libs" will suffice. GRASS
has several identifiable subsystems, some of which can themselves
require substantial numbers of additional libraries.

>

What should "grass-config --libs" output? Just libgis and its
dependencies (which won't suffice if you need e.g. the vector
functionality), or all of the libraries?

Glynn,

Well, I'm in favor of these logical subsystems being isolated
and appropriate options created for each. The current situation
is that the gdal-grass driver configure script has a hardcoded set
of libraries which is almost certain to be wrong each time GRASS
upgrades.

For the latter option, look at the the dependency list for the OGSF
library if --with-ffmpeg was used:

$ ldd /opt/grass-6.1.cvs/lib/libgrass_ogsf.so
  libgrass_gis.so => /opt/grass-6.1.cvs/lib/libgrass_gis.so (0x40084000)
  libgrass_datetime.so => /opt/grass-6.1.cvs/lib/libgrass_datetime.so (0x40134000)
  libz.so.1 => /lib/libz.so.1 (0x40150000)

...

You don't want to be linking all of those in if you only need libgis.

Most of those are already pulled in as dependencies of other libraries,
and would not need to be listed on a link line. Currently my configure
has:

     G_RASTLIBS="-lgrass_I"
     G_VECTLIBS="-lgrass_vect -lgrass_dig2 -lgrass_dgl -lgrass_rtree -lgrass_linkm -lgrass_dbmiclient -lgrass_dbmibase"
     LIBS="-L$with_grass/lib $G_VECTLIBS $G_RASTLIBS -lgrass_gproj -lgrass_vask -lgrass_gmath -lgrass_gis -lgrass_datetime $LIBS"

As you can imagine, this is pretty fragile.

Best regards,
--
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up | Frank Warmerdam, warmerdam@pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush | Geospatial Programmer for Rent

Markus Neteler wrote:

> GRASS can't realistically follow normal packaging rules (e.g.
> honouring all of the built-in autoconf switches) without using a
> separate subdirectory (at least four of its headers clash with files
> already present in my /usr/include directory).
>
> Additionally, the lack of a subdirectory prefix in header names risks
> causing problems for third-party packages which need to include
> headers from both GRASS and other packages (how do you ensure that
> "#include <display.h>" includes GRASS' display.h rather than the one
> from some other package?).

*If* things are currently changing, why not renaming files in the
same moment (sorry for being naive)?
E.g.,

#include <grass_display.h>

That's almost exactly what I've done, except that the header is called
<grass/display.h> rather than <grass_display.h>.

Any form of renaming will cause problems for a third party package
using just <display.h>. The advantage of using a directory is that
it's feasible to make both <grass/display.h> and <display.h> work: the
former by using e.g. -I/opt/grass6/include and the latter by using
e.g. -I/opt/grass6/include/grass.

As headers include each other using e.g. <grass/gis.h>, the directory
containing the grass subdirectory always has to be in the include
path, and <grass/gis.h> etc will always work. You can decide whether
or not <gis.h> works by adding or not adding the grass subdirectory
itself to the include path.

To ensure that GRASS' own source code always uses the <grass/gis.h>
form, the grass subdirectory isn't present in the include path during
the GRASS build process.

You can avoid the need for two -I switches by making a symlink, e.g.

  ln -s grass /opt/grass6/include/grass

Thus /opt/grass6/include/grass/grass will be a symlink to
/opt/grass6/include/grass. If you use -I/opt/grass6/include/grass, you
can use either <gis.h> or <grass/gis.h> (or, if you really want,
<grass/grass/grass/grass/gis.h>).

The only real problem I know of so far is that you can't make QGIS use
-I/opt/grass6/include/grass and -L/opt/grass6/lib, because it expects
both the include and lib directories to have exactly the same parent
directory.

Whilst this has been true to date (due to installing everything into
specific subdirectories of $GISBASE), GRASS' build system should
really be honouring the built-in autoconf switches such as --libdir=,
--includedir= etc and installing files wherever the user tells it to
(e.g. native MacOSX packages don't use a "lib" directory, they use
"Libraries").

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

Frank Warmerdam wrote:

> For the latter option, look at the the dependency list for the OGSF
> library if --with-ffmpeg was used:
>
> $ ldd /opt/grass-6.1.cvs/lib/libgrass_ogsf.so
> libgrass_gis.so => /opt/grass-6.1.cvs/lib/libgrass_gis.so (0x40084000)
> libgrass_datetime.so => /opt/grass-6.1.cvs/lib/libgrass_datetime.so (0x40134000)
> libz.so.1 => /lib/libz.so.1 (0x40150000)

...

> You don't want to be linking all of those in if you only need libgis.

Most of those are already pulled in as dependencies of other libraries,
and would not need to be listed on a link line.

Sure. My point was that third-party packages won't be linking against
"GRASS", but against specific components of it, and that linking in
unnecessary GRASS libraries could have a high cost.

Thus, rather than e.g. "pkg-config grass", we would need many separate
packages, e.g. "pkg-config grass" (just gis and datetime),
"pkg-config grass-vect" (also add the vector libraries) etc.

[Having said that, for static libraries, you have to explicitly list
all of the depenendcies in the link command.]

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