TcltkGRASS/Linux:1,2,3

Hi,

    I am trying to summarize the steps in compiling tcltkgrass on Linux.
Please feel free to correct me if I am wrong:

Step 1. Before compiling tcltkgrass:

     Get the tcltkgrass package from moon.cecer.army.mil in pub/incoming.
Then untar it in you Linux box. If you don't have the tcl/tk package, you
need to get the source code(and binaries) from sunsite.unc.edu in pub/Linux
/devel/tcl. Please note that the source codes for tcl/tk are needed because
it will look for some .h files such as tk.h when you compile tcltkgrass.

     Make sure that you have the binaries and the Xlib kit for X Window. You
will need files such as Xlib.h.

     Change the tcltkgrass Makefile in the ../grass/src directory to reflect
the configuration of your machine. Pay attention to the TCL and TK path
(should point to the source directories). GRASS should point to the GRASS
src directory. You do need the source codes for GRASS because it will look for
such things as gis.h.

     Add a line CC=gcc to use the gcc compiler, and add a flag on the EXTRAFLAG
line: -fwritable-strings(this will avoid the segmentation fault caused by the
env(TCLTKGRASSBASE). Thanks to Mark Line.

     To be safe, add #include <stdlib.h> in all .c files to avoid such problems
as "floating point exceptions" when zooming.

     Change to the ../grass/src directory and type "make"
     It takes a few minutes to compile.

Step 2. After tcltkgrass is compiled:

    Before you can run tcltkgrass, you need to make some changes in the
../script/tcltkgrass file. Mainly the TCLTKGRASS= and GISBASE = should be
modified to point to the right places on your system. Otherwise, it will
complain about it.
    TCLTKGRASSBASE = wherever your tcltkgrass packages is. ex: ../grass
    GISBASE=wherever your grass binary package is. ex: ../grass

    It's not necessary to move tcltkgrass to another directory. To run
tcltkgrass, cd to its script directory, for example, ../grass/script. Then
just type: tcltkgrass.

Step 3. Some problems and solutions:

    1) In the Makefile, the compiler flag "A 10" was not recongnized on my
system. Therefore, I only used the -O flag.
    2) The access(..., R_OK) in one of those .c files: the R_OK was not
recognized for some reason. Therefore, I changed R_OK to 0.
    3) Mark Line suggested to use gcc with the -fwritable-strings option to
compile in order to avoid segmentation fault caused by env(TCLTKGRASSBASE)
in the TclTkInit.c.
    4) Xin suggested to include stdlib.h in .c files to avoid the floating
point exception error(comes from the atof?) in SuperView when zooming.

Step 4. Unsolved mysteries...
    1) How to use those regular grass commands in the SuperView?
    2) What's the best way to run start tcltkgrass? Create a link in the
/usr/bin for tcltkgrass?
    ...
     Finally, please realize that this is the Alpha version of the summary.
So please do not complain if things go wrong.

    If you have suggestions or comments, please let me know.

    Thank you.

Changyong Cao
changyoc@daisy.siue.edu
   

First off, thanks *VERY MUCH* to Cao Changyong for supplying us with such
an excellent and exhaustive summary.

On Thu, 7 Apr 1994, Cao Changyong wrote:

     Change the tcltkgrass Makefile in the ../grass/src directory to reflect
the configuration of your machine. Pay attention to the TCL and TK path
(should point to the source directories). GRASS should point to the GRASS
src directory. You do need the source codes for GRASS because it will look for
such things as gis.h.

All it needs from the source tree is the include files and the libraries,
as nearly as I can make out. If you don't already have GRASS source
installed, and don't want to use the space for all 50MB, then you can just
extract what tcltkgrass needs. That's what I've done for now, so I could
provide a list of what I had to extract and install from the source tree
so that tcltkgrass would compile, if anybody's interested.

    1) In the Makefile, the compiler flag "A 10" was not recongnized on my
system. Therefore, I only used the -O flag.

Would somebody like to clue me in on what '-A 10' is supposed to do, and
what race of cc's it is from?

    2) The access(..., R_OK) in one of those .c files: the R_OK was not
recognized for some reason. Therefore, I changed R_OK to 0.

Yes, in src/tcltkgrass.c. POSIX standard R_OK is normally defined as 4 in
<unistd.h>. However, just including that file in tcltkgrass.c caused
collisions that I didn't have time to follow up -- I think it was with
tkConfig.h. So I just added a '#define R_OK 4' somewhere in tcltkgrass.c
before R_OK was used. Note that a value of 0 (POSIX constant F_OK) in the
call to access() will only determine whether or not a file exists, even if
it is not readable by your userid. This could conceivably lead to problems
if tcltkgrass.c later assumes that the file is readable when it's not. A
value of R_OK == 4 makes sure that the file is readable.

     Finally, please realize that this is the Alpha version of the summary.
So please do not complain if things go wrong.

:slight_smile: I think you're being overly polite. I'd like to see someone complain
about the lack of a beta-tested installation guide for alpha software. Go
ahead, make my day.

-- Mark

--------------------------------------------------------------------
Mark P. Line Phone: +1-206-733-6040
Open Pathways Fax: +1-206-733-6040
P.O. Box F Email: markline@henson.cc.wwu.edu
Bellingham, WA 98227-0296
--------------------------------------------------------------------