[GRASS-dev] [GRASS GIS] #3091: The RUN_GISBASE variable is not set correctly on FreeBSD

#3091: The RUN_GISBASE variable is not set correctly on FreeBSD
------------------------+-------------------------
Reporter: pieside | Owner: grass-dev@…
     Type: defect | Status: new
Priority: normal | Milestone: 7.0.5
Component: Default | Version: 7.0.4
Keywords: FreeBSD | CPU: x86-64
Platform: Other Unix |
------------------------+-------------------------
I'm trying to port Grass7 in the ports tree to make the installation
easier on FreeBSD.

The include/Make/Platform.make file contains the RUN_GISBASE variable with
the following value:
{{{
dist.amd64.portbld-freebsd11.0
}}}

The compilation search the includes files (e.g., gis.h) in this directory.
But it is empty. All the includes are located in another directory:

{{{
dist.amd64
}}}

Why is the first directory empty?

This thread [https://forums.freebsd.org/threads/56766/#post-323057]
suggests the Makefile contains rules to create those directories. I
presume the solution lives somewhere in a file in the include/Make/
directory but I can't figure it out

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/3091&gt;
GRASS GIS <https://grass.osgeo.org>

#3091: The RUN_GISBASE variable is not set correctly on FreeBSD
----------------------+-------------------------
  Reporter: pieside | Owner: grass-dev@…
      Type: defect | Status: new
  Priority: normal | Milestone: 7.0.5
Component: Default | Version: 7.0.4
Resolution: | Keywords: FreeBSD
       CPU: x86-64 | Platform: Other Unix
----------------------+-------------------------
Changes (by pieside):

* Attachment "Platform.make" added.

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/3091&gt;
GRASS GIS <https://grass.osgeo.org>

#3091: The RUN_GISBASE variable is not set correctly on FreeBSD
----------------------+-------------------------
  Reporter: pieside | Owner: grass-dev@…
      Type: defect | Status: new
  Priority: normal | Milestone: 7.0.5
Component: Default | Version: 7.0.4
Resolution: | Keywords: FreeBSD
       CPU: x86-64 | Platform: Other Unix
----------------------+-------------------------

Comment (by glynn):

Replying to [ticket:3091 pieside]:

> The compilation search the includes files (e.g., gis.h) in this
directory.

The include flags are actually:
{{{
INC = -I$(ARCH_DISTDIR)/include -I$(GISBASE)/include
}}}
from Grass.make.

> But it is empty. All the includes are located in another directory:
>
{{{
dist.amd64
}}}

Headers are supposed to be installed in $(ARCH_INCDIR), which is set to
{{{
ARCH_INCDIR = $(ARCH_DISTDIR)/include/grass
}}}

Note that ARCH_DISTDIR is set thus:
{{{
ARCH_DISTDIR = $(GRASS_HOME)/dist.$(ARCH)
}}}
and both GRASS_HOME and ARCH appear to be set correctly in your attached
Platform.make file:
{{{
ARCH = amd64-portbld-freebsd11.0

GRASS_HOME = /usr/ports/databases/grass7/work/grass-7.0.4
}}}

> Why is the first directory empty?

Is it only headers that are in dist.amd64? Everything that will eventually
be installed should be within the dist.amd64-portbld-freebsd11.0 directory
except for the grass71 startup script, which should be in bin.amd64
-portbld-freebsd11.0. Knowing which files go where would provide some
clues as to the source of the problem.

I suggest that you examine the output from "make". If you didn't capture
it to a file, run "make clean" then re-build with e.g.
{{{
make >build.log 2>&1
}}}

Check for the "install" commands which install headers, e.g.
{{{
/usr/bin/install -c -m 644 gmath.h
/usr/ports/databases/grass7/work/grass-7.0.4/dist.amd64-portbld-
freebsd11.0/include/grass/gmath.h
}}}

If those look okay, there's something wrong with the install program (or
the install-sh script, if that's being used). Otherwise, the issue may be
with the build system.

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/3091#comment:1&gt;
GRASS GIS <https://grass.osgeo.org>

#3091: The RUN_GISBASE variable is not set correctly on FreeBSD
----------------------+-------------------------
  Reporter: pieside | Owner: grass-dev@…
      Type: defect | Status: new
  Priority: normal | Milestone: 7.0.5
Component: Default | Version: 7.0.4
Resolution: | Keywords: FreeBSD
       CPU: x86-64 | Platform: Other Unix
----------------------+-------------------------

Comment (by pieside):

After some tests, I found that the issue is probably coming from the ports
tree framework which overrides the value of ARCH. This seems to comfort
that the issue may be with the build system.

To avoid duplicate and because it seems to be FreeBSD specific, I continue
the discussion here:
[https://forums.freebsd.org/threads/56766/#post-323073]

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/3091#comment:2&gt;
GRASS GIS <https://grass.osgeo.org>

#3091: The RUN_GISBASE variable is not set correctly on FreeBSD
----------------------+-------------------------
  Reporter: pieside | Owner: grass-dev@…
      Type: defect | Status: new
  Priority: normal | Milestone: 7.0.5
Component: Default | Version: 7.0.4
Resolution: | Keywords: FreeBSD
       CPU: x86-64 | Platform: Other Unix
----------------------+-------------------------

Comment (by glynn):

Replying to [comment:2 pieside]:
> After some tests, I found that the issue is probably coming from the
ports tree framework which overrides the value of ARCH. This seems to
comfort that the issue may be with the build system.

Setting ARCH= on the make command line will override the setting of ARCH
in Platform.make.

Ideally, that should work; i.e. you should be able to set ARCH to whatever
you feel like and everything should use that setting consistently. But it
doesn't, because configure.in does:
{{{
AC_SUBST(ARCH)

...

GISBASE="${WINDSTDIR}/dist.${ARCH}"
GRASS_BIN="${DSTDIR}/bin.${ARCH}"

AC_SUBST(GISBASE)
AC_SUBST(GRASS_BIN)
}}}

So the value of ARCH chosen by the configure script gets used to set 3
distinct variables, and overriding ARCH on the command line only changes
one of them (although GRASS_BIN isn't actually used).

GISBASE is actually used to set RUN_GISBASE, which is used when executing
GRASS commands or scripts as part of the build process. On Unix, this will
typically end up being identical to ARCH_DISTDIR, which is the base
directory where generated files are placed. But on Windows, RUN_GISBASE
needs to use Windows' native filename syntax, whereas everything else uses
the Unix-like syntax of MinGW/MSys.

One possible solution is to have configure substitute WINDSTDIR rather
than GISBASE and change Platform.make.in to:
{{{
RUN_GISBASE = @WINDSTDIR@/dist.$(ARCH)
}}}

That should ensure that ARCH_DISTDIR and RUN_GISBASE are equivalent even
if ARCH is overridden on the command line.

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/3091#comment:3&gt;
GRASS GIS <https://grass.osgeo.org>

#3091: The RUN_GISBASE variable is not set correctly on FreeBSD
----------------------+-------------------------
  Reporter: pieside | Owner: grass-dev@…
      Type: defect | Status: new
  Priority: normal | Milestone: 7.0.6
Component: Default | Version: 7.0.4
Resolution: | Keywords: FreeBSD
       CPU: x86-64 | Platform: Other Unix
----------------------+-------------------------

Comment (by lbartoletti):

Hi,

You can close this tickets, we have
[https://trac.osgeo.org/grass/ticket/2940 patched files] for FreeBSD.

Regards.

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/3091#comment:5&gt;
GRASS GIS <https://grass.osgeo.org>

#3091: The RUN_GISBASE variable is not set correctly on FreeBSD
----------------------+-------------------------
  Reporter: pieside | Owner: grass-dev@…
      Type: defect | Status: closed
  Priority: normal | Milestone: 7.2.2
Component: Default | Version: 7.0.4
Resolution: fixed | Keywords: FreeBSD
       CPU: x86-64 | Platform: Other Unix
----------------------+-------------------------
Changes (by neteler):

* status: new => closed
* resolution: => fixed
* milestone: 7.0.6 => 7.2.2

Comment:

Replying to [comment:5 lbartoletti]:
> Hi,
>
> You can close this tickets, we have
[https://trac.osgeo.org/grass/ticket/2940 patched files] for FreeBSD.

... solved in #2940, closing.

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/3091#comment:6&gt;
GRASS GIS <https://grass.osgeo.org>