RE: [GRASS5] Solaris, GRASS 5.1, and Proj

Thanks for the advice. I've installed PROJ 4.4.7.

I ran "make distclean" and configured both 50 and 51 for the external PROJ.
There were no problems making 50.

But I have trouble making lib/proj in 51. I'm using GNU make.

It fails with the following message:
  gcc
  -L/sim/home1/Grass/grass5.1/grass51_exp_2003_09_06/dist.sparc-sun-solaris2.9/lib
    -Wl,-R, -shared \
          OBJ.sparc-sun-solaris2.9/get_proj.o OBJ.sparc-sun-solaris2.9/do_proj.o
  OBJ.sparc-sun-solaris2.9/convert.o OBJ.sparc-sun-solaris2.9/datum.o
  OBJ.sparc-sun-solaris2.9/ellipse.o -o
  /sim/home1/Grass/grass5.1/grass51_exp_2003_09_06/dist.sparc-sun-solaris2.9/lib/l
  ibgrass_gproj.so
  make[2]: *** No rule to make target
  `/sim/home1/Grass/grass5.1/grass51_exp_2003_09_06/dist.sparc-sun-solaris2.9/etc/
  nad', needed by `default'. Stop.
  make[2]: Leaving directory
  `/sim/home1/Grass/grass5.1/grass51_exp_2003_09_06/lib/proj'
  make[1]: *** [subdirs] Error 1
Note, the $(GISBASE)/etc/nad directory does not yet exist. If I create etc/nad, "make" does nothing and leaves the directory empty.

The Makefile looks like:
  MODULE_TOPDIR = ../..

  LIB_NAME = $(GPROJ_LIBNAME)

  EXTRA_CFLAGS = $(PICFLAGS)
  EXTRA_INC = $(PROJINC)

  LIB_OBJS = get_proj.o do_proj.o convert.o datum.o ellipse.o

  NAD_TABLES = FL.lla MD.lla TN.lla WI.lla WO.lla alaska.lla conus.lla \
               hawaii.lla prvi.lla stgeorge.lla stlrnc.lla stpaul.lla

  NT_TABLES = ntv1_can.dat nzgd2kgrid0005.gsb

  $(NAD2BIN): nad2bin.o
    $(CC) $(LDFLAGS) $? -o $@

  $(NAD_DIR): $(NAD_TABLES) $(NT_TABLES) $(NAD2BIN)
    @ if [ ! -d $@ ] ; then mkdir $@ ; fi
    for i in $(NAD_TABLES) ; do $(NAD2BIN) < $$i $@/`echo $$i | sed
  's/.lla//'`; done
    cp -f $(NT_TABLES) $@
    @ touch $@

  NAD_DIR = $(GISBASE)/etc/nad

  include $(MODULE_TOPDIR)/include/Make/Lib.make

  default: lib $(NAD_DIR)

If I modify the Makefile to move the "NAD_DIR =" line after the "NT_TABLE=" line, I get a different error message:
  mkdir: Failed to make directory "/etc/nad"; Permission denied
  make: *** [/etc/nad] Error 2
It seems to have lost $(GISBASE).

If I also change $@ to $(NAD_DIR) in the $(NAD_DIR) target, the error messages are:
  wallace<640> make
  for i in FL.lla MD.lla TN.lla WI.lla WO.lla alaska.lla conus.lla hawaii.lla
  prvi.lla stgeorge.lla stlrnc.lla stpaul.lla ; do < $i
  /sim/home1/Grass/grass5.1/grass51_exp_2003_09_06/dist.sparc-sun-solaris2.9/etc/n
  ad/`echo $i | sed 's/.lla//'`; done
  /bin/sh:
  /sim/home1/Grass/grass5.1/grass51_exp_2003_09_06/dist.sparc-sun-solaris2.9/etc/n
  ad/FL: not found
  /bin/sh:
  /sim/home1/Grass/grass5.1/grass51_exp_2003_09_06/dist.sparc-sun-solaris2.9/etc/n
  ad/MD: not found
  [snip]
  /bin/sh:
  /sim/home1/Grass/grass5.1/grass51_exp_2003_09_06/dist.sparc-sun-solaris2.9/etc/n
  ad/stpaul: not found
  make: *** [/etc/nad] Error 1

Does anyone know what the problem could be?

- Bev Wallace

-----Original Message-----
From: Paul Kelly [SMTP:paul-grass@stjohnspoint.co.uk]
Sent: Thursday, September 11, 2003 12:43 PM
To: Wallace, Beverly T
Cc: grass5@grass.itc.it
Subject: Re: [GRASS5] Solaris, GRASS 5.1, and Proj

Hello

On Thu, 11 Sep 2003, Wallace, Beverly T wrote:

> Hi Grass Developers,
>
> I am trying to build the experimental GRASS 5.1.
>
> I downloaded the 2003_09_06 snapshots for 5.0 and 5.1.
> I successfully built 5.0.
> I am using a Sun with Solaris 9, gcc version 2.95.3, and GNU make.
> I used configure --with-motif --without-postgres --without-odbc --without-fftw --without_gdal.
>
> (1) When I tried to configure with proj, configure failed while trying to find proj_api.h. But proj_api.h does not exist in either snapshot. So I added --without_proj to the configure.

You need to have an external PROJ library from remotesensing.org>
installed, version 4.4.6 or later. GRASS 5.7 (as it is now) does not
include the internal copy of PROJ any more so an external PROJ is an
absolute requirement. This should probably be documented somewhere; I'm
not familiar with all the 5.1/5.7 documentation and am not sure where is
the best place; can you suggest a file this information could be added to?

>
> (2) There is no setenv function for Solaris. I solved that by adding a setenv function in lib/db/dbmi_client/start.c.

No setenv in IRIX either. It was suggested to me before to replace
setenv() by putenv() and I recall that that worked. I haven't had that
particular error compiling on IRIX; maybe I have disabled something in
configure that doesn't compile that part of the database code.

>
> (3) It then fails in lib/proj with the message
> proj_api.h: No such file or directory
> Is there supposed to be a proj_api.h file?
> Since I configured without-proj, why is it trying to compile lib/proj?

(See above) It is set up that you are expected to have PROJ; quite a lot
of modules depend on it and it would need more changes to all their
Makefiles to disable compiling them if PROJ was not present. But could be
done if we decided it was worthwhile. The PROJ library is small and easy
to compile and install however.

Paul Kelly

Yes, that was a bug in the lib/proj/Makefile in 5.1. I fixed it on the 8th
September so your snapshot is just two days too old...you can get the
updated file from
http://freegis.org/cgi-bin/viewcvs.cgi/*checkout*/grass51/lib/proj/Makefile

There were actually two bugs in the file, which is why you were having so
much trouble: you correctly saw that the NAD_DIR= line should be above the
$(NAD_DIR): line, but also all references to $(NAD2BIN) should have been
replaced by nad2bin, as in 5.1/5.7 we use the installed nad2bin command
from the PROJ.4 distribution and don't compile it from source (I had
copied the Makefile over from 5.0 and forgot to change some things).

Paul

If I modify the Makefile to move the "NAD_DIR =" line after the "NT_TABLE=" line, I get a different error message:
  mkdir: Failed to make directory "/etc/nad"; Permission denied
  make: *** [/etc/nad] Error 2
It seems to have lost $(GISBASE).

Don't know how that would happen---must be something to do with the order
of things in the Makefile again

If I also change $@ to $(NAD_DIR) in the $(NAD_DIR) target, the error messages are:
  wallace<640> make
  for i in FL.lla MD.lla TN.lla WI.lla WO.lla alaska.lla conus.lla hawaii.lla
  prvi.lla stgeorge.lla stlrnc.lla stpaul.lla ; do < $i
  /sim/home1/Grass/grass5.1/grass51_exp_2003_09_06/dist.sparc-sun-solaris2.9/etc/n
  ad/`echo $i | sed 's/.lla//'`; done
  /bin/sh:
  /sim/home1/Grass/grass5.1/grass51_exp_2003_09_06/dist.sparc-sun-solaris2.9/etc/n
  ad/FL: not found

Yes nothing was subtituted for $(NAD2BIN) in the above command line so it
didn't make sense---the Makefile rules for compiling nad2bin from the 5.0
Gmakefile don't seem to work here (I don't understand why) but it doesn't
matter anyway as the installed nad2bin from PROJ.4 is used now.