[GRASS5] grass5 on darwin - problem w/init

hello all:

i gave compiling grass5.0 a whirl today; this is my error.log:

GRASS GIS compilation log
-------------------------
Start of compilation: Mon Sep 9 12:02:03 CDT 2002
Errors:
Compilation error in module: src/libes/vect32/georef (ignored)
Compilation error in module: src/general/init (ignored)
Compilation error in module: src/display/d.zoom (ignored)
Compilation error in module: src/general/g.region (ignored)
Compilation error in module: src/imagery/i.pca (ignored)
Compilation error in module: src/mapdev/v.reclass (ignored)
Compilation error in module: src/raster/r.in.gdal (ignored)
Compilation error in module: src/raster/r.reclass (ignored)
Compilation error in module: src/raster/r.sun (ignored)
Compilation error in module: src/raster/r.support (ignored)
Compilation error in module: src/raster/r.weight (ignored)
Compilation error in module: src.contrib/GMSL/g3d/src3d/sites/s.vol.rst (ignored)
Compilation error in module: src.garden/grass.postgresql (ignored)
End of compilation: Mon Sep 9 12:41:46 CDT 2002
DONE generating GRASS GIS binary code

(i have a make.log--1.7mb--let me know if you want me to send it along)

trying to start grass, i get:

% ./grass5
/sw/grass5/etc/Init.sh: /sw/grass5/etc/lock: No such file or directory
Unable to properly access /Users/andya/.gislock5
Please notify system personel.

looking through my make.log, there are a lot of entries for 'init' like this:

init_commands.c:145: warning: passing arg 3 of `Tcl_CreateCommand' from incompatible pointer type

so i tried:

% /sw/bin/gmake5 src/general/init
   SRC = /Users/andya/Desktop/grass-5_0_0_src_0/grass-5.0.0/src
   CMD = /Users/andya/Desktop/grass-5_0_0_src_0/grass-5.0.0/src/CMD
   UNUSED = /Users/andya/Desktop/grass-5_0_0_src_0/grass-5.0.0/unused
   HEADER = head.powerpc-apple-darwin6.0
   ARCH = powerpc-apple-darwin6.0
   GISBASE = /Users/andya/Desktop/grass-5_0_0_src_0/grass-5.0.0/dist.powerpc-apple-darwin6.0
   VERSION = 5.0.0 August 2002
#################################################################
/Users/andya/Desktop/grass-5_0_0_src_0/grass-5.0.0/src/general/init
   make -f OBJ.powerpc-apple-darwin6.0/make.rules

rm -f /Users/andya/Desktop/grass-5_0_0_src_0/grass-5.0.0/bin.powerpc-apple-darwin6.0/grass`cat /Users/andya/Desktop/grass-5_0_0_src_0/grass-5.0.0/src/CMD/VERSION | head -1 | sed 's/\..*//'` ; true
/bin/sh -c "sed -e \"s#GISBASE_VALUE#/Users/andya/Desktop/grass-5_0_0_src_0/grass-5.0.0/dist.powerpc-apple-darwin6.0#\" -e \"s#PERL_COMMAND#/usr/bin/perl#\" grass.src > /Users/andya/Desktop/grass-5_0_0_src_0/grass-5.0.0/bin.powerpc-apple-darwin6.0/grass`cat /Users/andya/Desktop/grass-5_0_0_src_0/grass-5.0.0/src/CMD/VERSION | head -1 | sed 's/\..*//'` 2>/dev/null ; true"
chmod a+x /Users/andya/Desktop/grass-5_0_0_src_0/grass-5.0.0/bin.powerpc-apple-darwin6.0/grass`cat /Users/andya/Desktop/grass-5_0_0_src_0/grass-5.0.0/src/CMD/VERSION | head -1 | sed 's/\..*//'`
gcc -L/Users/andya/Desktop/grass-5_0_0_src_0/grass-5.0.0/src/libes/LIB.powerpc-apple-darwin6.0 -L/sw/lib -o /Users/andya/Desktop/grass-5_0_0_src_0/grass-5.0.0/dist.powerpc-apple-darwin6.0/etc/set_data OBJ.powerpc-apple-darwin6.0/set_data.o OBJ.powerpc-apple-darwin6.0/mke_mapset.o OBJ.powerpc-apple-darwin6.0/mke_loc.o OBJ.powerpc-apple-darwin6.0/chk_dbase.o OBJ.powerpc-apple-darwin6.0/other.o -ledit -lgis -lvask -lncurses -ltermcap -lz
ld: Undefined symbols:
_E_edit_cellhd
make: *** [/Users/andya/Desktop/grass-5_0_0_src_0/grass-5.0.0/dist.powerpc-apple-darwin6.0/etc/set_data] Error 1

thanks,
andy a.

andy agena wrote:

i gave compiling grass5.0 a whirl today; this is my error.log:

GRASS GIS compilation log
-------------------------
Start of compilation: Mon Sep 9 12:02:03 CDT 2002
Errors:
Compilation error in module: src/libes/vect32/georef (ignored)
Compilation error in module: src/general/init (ignored)
Compilation error in module: src/display/d.zoom (ignored)
Compilation error in module: src/general/g.region (ignored)
Compilation error in module: src/imagery/i.pca (ignored)
Compilation error in module: src/mapdev/v.reclass (ignored)
Compilation error in module: src/raster/r.in.gdal (ignored)
Compilation error in module: src/raster/r.reclass (ignored)
Compilation error in module: src/raster/r.sun (ignored)
Compilation error in module: src/raster/r.support (ignored)
Compilation error in module: src/raster/r.weight (ignored)
Compilation error in module: src.contrib/GMSL/g3d/src3d/sites/s.vol.rst
(ignored)
Compilation error in module: src.garden/grass.postgresql (ignored)
End of compilation: Mon Sep 9 12:41:46 CDT 2002
DONE generating GRASS GIS binary code

(i have a make.log--1.7mb--let me know if you want me to send it along)

Compress it with "gzip -9" (this should reduce it to ~100Kb), then
send it to me.

trying to start grass, i get:

% ./grass5
/sw/grass5/etc/Init.sh: /sw/grass5/etc/lock: No such file or directory
Unable to properly access /Users/andya/.gislock5
Please notify system personel.

This is due to:

Compilation error in module: src/general/init (ignored)

At present, *all* failures are ignored; even for components which
(like src/general/init) are essential for using GRASS.

looking through my make.log, there are a lot of entries for 'init'
like this:

init_commands.c:145: warning: passing arg 3 of `Tcl_CreateCommand' from
incompatible pointer type

This is harmless, and unrelated.

so i tried:

% /sw/bin/gmake5 src/general/init
   SRC = /Users/andya/Desktop/grass-5_0_0_src_0/grass-5.0.0/src
   CMD = /Users/andya/Desktop/grass-5_0_0_src_0/grass-5.0.0/src/CMD
   UNUSED = /Users/andya/Desktop/grass-5_0_0_src_0/grass-5.0.0/unused
   HEADER = head.powerpc-apple-darwin6.0
   ARCH = powerpc-apple-darwin6.0
   GISBASE =
/Users/andya/Desktop/grass-5_0_0_src_0/grass-5.0.0/dist.powerpc-apple-
darwin6.0
   VERSION = 5.0.0 August 2002
#################################################################
/Users/andya/Desktop/grass-5_0_0_src_0/grass-5.0.0/src/general/init
   make -f OBJ.powerpc-apple-darwin6.0/make.rules

rm -f
/Users/andya/Desktop/grass-5_0_0_src_0/grass-5.0.0/bin.powerpc-apple-
darwin6.0/grass`cat
/Users/andya/Desktop/grass-5_0_0_src_0/grass-5.0.0/src/CMD/VERSION |
head -1 | sed 's/\..*//'` ; true
/bin/sh -c "sed -e
\"s#GISBASE_VALUE#/Users/andya/Desktop/grass-5_0_0_src_0/grass-5.0.0/
dist.powerpc-apple-darwin6.0#\" -e \"s#PERL_COMMAND#/usr/bin/perl#\"
grass.src >
/Users/andya/Desktop/grass-5_0_0_src_0/grass-5.0.0/bin.powerpc-apple-
darwin6.0/grass`cat
/Users/andya/Desktop/grass-5_0_0_src_0/grass-5.0.0/src/CMD/VERSION |
head -1 | sed 's/\..*//'` 2>/dev/null ; true"
chmod a+x
/Users/andya/Desktop/grass-5_0_0_src_0/grass-5.0.0/bin.powerpc-apple-
darwin6.0/grass`cat
/Users/andya/Desktop/grass-5_0_0_src_0/grass-5.0.0/src/CMD/VERSION |
head -1 | sed 's/\..*//'`
gcc
-L/Users/andya/Desktop/grass-5_0_0_src_0/grass-5.0.0/src/libes/
LIB.powerpc-apple-darwin6.0 -L/sw/lib -o
/Users/andya/Desktop/grass-5_0_0_src_0/grass-5.0.0/dist.powerpc-apple-
darwin6.0/etc/set_data OBJ.powerpc-apple-darwin6.0/set_data.o
OBJ.powerpc-apple-darwin6.0/mke_mapset.o
OBJ.powerpc-apple-darwin6.0/mke_loc.o
OBJ.powerpc-apple-darwin6.0/chk_dbase.o
OBJ.powerpc-apple-darwin6.0/other.o -ledit -lgis -lvask -lncurses
-ltermcap -lz
ld: Undefined symbols:
_E_edit_cellhd
make: ***
[/Users/andya/Desktop/grass-5_0_0_src_0/grass-5.0.0/dist.powerpc-apple-
darwin6.0/etc/set_data] Error 1

1. Do you have a libedit.a in the directory:

/Users/andya/Desktop/grass-5_0_0_src_0/grass-5.0.0/src/libes/LIB.powerpc-apple-darwin6.0

?

If not, there should have been an error for src/libes/edit. OTOH, if
that file exists, then ...

2. Do you have a libedit.a, libedit.dylib, or libedit.<anything> (or,
for that matter, anything else which looks like a library and is
called something-edit-something) in /sw/lib, or in any "system"
library directory?

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


If you are using OSX 10.2 (Jaguar), you might be interested in the following corrections to your autoconf file:

good luck,

RafDouglas CTC


From:

http://www.osxgnu.org/#jagbugs

In the file /usr/share/autoconf/autoconf.m4f line 7294 should read:

exit (setpgrp (0,0) == -1);])],

not

exit (setpgrp (1,1) == -1);])],

As a result any program using GNU configure may not compile (just about all of them). You may wish to edit this file to reflect the above changes

What has changed in 10.2?
The biggest changes seem to be that the System linked libraries in OS X have moved to separate libraries so the LDFLAGS and CFLAGS have to be set.
The most common new settings are:

CFLAGS=-no-cpp-precomp
LDFLAGS=-ltinfo -lgcc
( setenv CFLAGS -no-cpp-precomp;setenv LDFLAGS ‘-ltinfo -lgcc’)

If a program did not use any of libraries that were moved it still works on 10.2.
Example :bzip2, gnutar, rpm etc.

hello all:

i gave compiling grass5.0 a whirl today; this is my error.log:


RafDouglas Candidi Tommasi Crudeli

ct@ehleng.com

“To know, to will, to dare, to be silent.”

Crudeli wrote:

If you are using OSX 10.2 (Jaguar), you might be interested in the
following corrections to your autoconf file:

good luck,

RafDouglas CTC
____________________________
From:

http://www.osxgnu.org/#jagbugs

In the file /usr/share/autoconf/autoconf.m4f line 7294 should read:

exit (setpgrp (0,0) == -1);])],

  not

exit (setpgrp (1,1) == -1);])],

1. Can you provide any background information for this issue? I don't
generally do things without knowing *why* I'm doing them.

2. I'm not so sure that this change is correct. AFAICT, the idea is
that the call is meant to fail (return -1) if the function accepts any
arguments. However, setpgrp(0,0) will normally succeed.

3. I don't think that it's reasonable to expect developers to hack
their autoconf installation. If this is necessary, I would rather just
add a local definition to GRASS' aclocal.m4, and use that.

4. AC_FUNC_SETPGRP throws an error if cross-compiling, as it needs to
actually *run* the test program.

Unfortunately, simply compiling it isn't sufficient; passing the wrong
number of parameters might only generate a warning. However, gcc will
generate an error if a conflicting prototype is in scope; this might
be good enough for the cross-compiling case.

Alternatively, we might be able to just replace setpgrp() with
setpgid(), which is more standardised, and doesn't require any messy
configure checks.

Note: setpgrp() is only used in two places:

1. src/display/devices/lib/main.c, in main()
2. src/libes/gis/fork.c, in G_fork().

In both cases, the purpose is to move the child process into a new
process group, so that it isn't part of the terminal's foreground
process group.

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

andy agena wrote:

> 1. Do you have a libedit.a in the directory:
>
> /Users/andya/Desktop/grass-5_0_0_src_0/grass-5.0.0/src/libes/
> LIB.powerpc-apple-darwin6.0?

this file does exist.

[And this is confirmed by your make.log]

OK, so that isn't the problem.

> If not, there should have been an error for src/libes/edit. OTOH, if
> that file exists, then ...
>
> 2. Do you have a libedit.a, libedit.dylib, or libedit.<anything> (or,
> for that matter, anything else which looks like a library and is
> called something-edit-something) in /sw/lib, or in any "system"
> library directory?

my libedit.dylib was in /usr/local, so i: ln -s /usr/lib/libedit.dylib
/sw/lib/libedit.dylib

This appears to be the problem; there is another "libedit", and that
is being used instead of the GRASS library of the same name.

The first instance of the problem is in src/general/init, when
compiling etc/set_data:

gcc
-L/Users/andyagena/Desktop/grass-5_0_0_src_0/grass-5.0.0/src/libes/LIB.powerpc-apple-darwin6.0
-L/sw/lib -o
/Users/andyagena/Desktop/grass-5_0_0_src_0/grass-5.0.0/dist.powerpc-apple-darwin6.0/etc/set_data
OBJ.powerpc-apple-darwin6.0/set_data.o
OBJ.powerpc-apple-darwin6.0/mke_mapset.o
OBJ.powerpc-apple-darwin6.0/mke_loc.o
OBJ.powerpc-apple-darwin6.0/chk_dbase.o
OBJ.powerpc-apple-darwin6.0/other.o -ledit -lgis -lvask -lncurses
-ltermcap -lz

This is presumably picking up libedit.dylib instead of GRASS'
libedit.a.

I had thought that the fact that the switch:

-L/Users/andyagena/Desktop/grass-5_0_0_src_0/grass-5.0.0/src/libes/LIB.powerpc-apple-darwin6.0

came first would ensure that any libraries found there would take
precedence, but obviously not.

It may be that the linker prefers *.dylib to *.a, regardless of
location. In which case, the only solution would be to change the
name. Try changing the corresponding lines in src/CMD/generic/make.mid
from:

  DEPEDITLIB = $(LIBDIR)/libedit.a
  EDITLIB = -ledit
to:
  DEPEDITLIB = $(LIBDIR)/libgedit.a
  EDITLIB = -lgedit

Then re-compile (you might need to run "make clean" first).

If this fixes the problem, then I really need to find out more about
the details of how linking works on MacOS X. Simply hoping that name
clashes don't occur isn't really a solution.

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

Hi Glynn:

adding the 'g' below did the trick and GRASS is functioning again! thanks for your help.

however, I still need to add 'TCLTKGRASSBASE: /sw/grass5/tcltkgrass' to my ~/.grassrc5 (which is no big deal, of course).

as for details on Darwin's linking, I couldn't find any good documentation Apple's site, but the Darwin developers' list might be a place to start <http://search.lists.apple.com/darwin-development&gt;\.

as I'm poking around GRASS, 'g.select.pg' isn't in the bin directory, and I'm assuming this is another error in my make.log file. Can you see any reason why this module failed to build?

Thanks again.

Take care,
Andy

On Tuesday, Sep 10, 2002, at 10:26 US/Central, Glynn Clements wrote:

andy agena wrote:

1. Do you have a libedit.a in the directory:

/Users/andya/Desktop/grass-5_0_0_src_0/grass-5.0.0/src/libes/
LIB.powerpc-apple-darwin6.0?

this file does exist.

[And this is confirmed by your make.log]

OK, so that isn't the problem.

If not, there should have been an error for src/libes/edit. OTOH, if
that file exists, then ...

2. Do you have a libedit.a, libedit.dylib, or libedit.<anything> (or,
for that matter, anything else which looks like a library and is
called something-edit-something) in /sw/lib, or in any "system"
library directory?

my libedit.dylib was in /usr/local, so i: ln -s /usr/lib/libedit.dylib
/sw/lib/libedit.dylib

This appears to be the problem; there is another "libedit", and that
is being used instead of the GRASS library of the same name.

The first instance of the problem is in src/general/init, when
compiling etc/set_data:

gcc
-L/Users/andyagena/Desktop/grass-5_0_0_src_0/grass-5.0.0/src/libes/LIB.powerpc-apple-darwin6.0
-L/sw/lib -o
/Users/andyagena/Desktop/grass-5_0_0_src_0/grass-5.0.0/dist.powerpc-apple-darwin6.0/etc/set_data
OBJ.powerpc-apple-darwin6.0/set_data.o
OBJ.powerpc-apple-darwin6.0/mke_mapset.o
OBJ.powerpc-apple-darwin6.0/mke_loc.o
OBJ.powerpc-apple-darwin6.0/chk_dbase.o
OBJ.powerpc-apple-darwin6.0/other.o -ledit -lgis -lvask -lncurses
-ltermcap -lz

This is presumably picking up libedit.dylib instead of GRASS'
libedit.a.

I had thought that the fact that the switch:

-L/Users/andyagena/Desktop/grass-5_0_0_src_0/grass-5.0.0/src/libes/LIB.powerpc-apple-darwin6.0

came first would ensure that any libraries found there would take
precedence, but obviously not.

It may be that the linker prefers *.dylib to *.a, regardless of
location. In which case, the only solution would be to change the
name. Try changing the corresponding lines in src/CMD/generic/make.mid
from:

  DEPEDITLIB = $(LIBDIR)/libedit.a
  EDITLIB = -ledit
to:
  DEPEDITLIB = $(LIBDIR)/libgedit.a
  EDITLIB = -lgedit

Then re-compile (you might need to run "make clean" first).

If this fixes the problem, then I really need to find out more about
the details of how linking works on MacOS X. Simply hoping that name
clashes don't occur isn't really a solution.

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

andy agena wrote:

adding the 'g' below did the trick and GRASS is functioning again!
thanks for your help.

however, I still need to add 'TCLTKGRASSBASE: /sw/grass5/tcltkgrass' to
my ~/.grassrc5 (which is no big deal, of course).

However, I still absolutely cannot figure out why this would help in
any way. Wherever tcltkgrass references TCLTKGRASSBASE, it does so as
$env(TCLTKGRASSBASE), and this is set in the tcltkgrass script as:

  set env(TCLTKGRASSBASE) $env(GISBASE)/tcltkgrass

The contents of $GISRC are no longer reflected into the environment at
startup; and even if they were, any setting would be overridden at the
start of the "tcltkgrass" script.

as for details on Darwin's linking, I couldn't find any good
documentation Apple's site, but the Darwin developers' list might be a
place to start <http://search.lists.apple.com/darwin-development&gt;\.

as I'm poking around GRASS, 'g.select.pg' isn't in the bin directory,
and I'm assuming this is another error in my make.log file. Can you
see any reason why this module failed to build?

"g.select.pg" isn't a module from the perspective of the build system.
The module is "src.garden/grass.postgresql", and it failed to compile
due to an error in g.column.pg:

gcc -I/Users/andyagena/Desktop/grass-5_0_0_src_0/grass-5.0.0/src/include -g -O2 -I/sw/include -I/usr/local/pgsql/include -Wall -DPACKAGE=\""g.column.pg"\" -c infxColumn.c -o OBJ.powerpc-apple-darwin6.0/infxColumn.o
infxColumn.c: In function `infxColumn':
infxColumn.c:43: warning: implicit declaration of function `exit'
infxColumn.c:66: `VARHDRSZ' undeclared (first use in this function)
infxColumn.c:66: (Each undeclared identifier is reported only once
infxColumn.c:66: for each function it appears in.)

This terminates the build of src.garden/grass.postgresql, and the
build process moves onto the next module. If you look, you should
notice that everything in src.garden/grass.postgresql/Gmakefile which
comes after g.column.pg is missing, not just g.select.pg.

Remove g.column.pg from src.garden/grass.postgresql/Gmakefile (or
comment it out), then re-compile.

BTW, VARHDRSZ is an "internal" definition, which isn't part of
PostgreSQL's public API. On my system (PostgreSQL 6.5.3, RedHat 6.2),
it's in postgres.h; on PostgreSQL 7.x (for unknown "x"), it's in
postgres_fe.h (which may be in the "internal" subdirectory). Note that
postgres_fe.h is only included if postgres.h wasn't detected.

IMHO, the reference to VARHDRSZ should be removed, and simply replaced
with the number 4.

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