From: sauer@chama.eece.unm.edu (Tom Sauer)
Newsgroups: comp.soft-sys.khoros
Subject: KHOROS COMPILE FAQ
Date: 16 Nov 92 17:43:43 GMT




        FREQUENTLY ASKED QUESTIONS ABOUT COMPILING KHOROS

		date last updated: Sept 25, 1992
			           Sept 28, 1992
				      fixed A3, A6, A9, Q28, added Q29
				   Oct  03, 1992
				      added new Q1, Q2, Q4, Q5, Q6, 
				      scooted other #'s down
				   Oct  27, 1992
				      added Q35 - Q37

                ( Please Read!  Please Redistribute! )

                ( Also - Please See the General Khoros FAQ )

        Contents:  Questions 1 - 37

                   * installing Khoros on IBM RS6000, 386/486, HP
		   * compiling Khoros with shared libraries
		   * compiling Khoros with X11R5
		   * Makefiles, Imakefiles (compiling new programs)
		   * compiling with/without FORTRAN
		   * compiling with gcc
		   * and more!


----------  Installing Khoros on various architectures -----

Q1.  What machines does Khoros currently run on?

Q2.  I have machine X running operating system Y (not listed in A1).
     Has anyone ported Khoros to this architecture?

Q3.  I want to install Khoros on an IBM RS/6000 workstation
     running under AIX x.x {and am getting error messages from the
     C compiler} {and would like more info} {has anybody done this}
     {are binaries available}?.

Q4.  I want to install Khoros on a 386/486 machine {and am getting 
     error messages from the C compiler} {and would like more info} 
     {has anybody done this} {are binaries available}?.
 
Q5.  I want to install Khoros on an HP under HP-UX x.x {9000/s370, 
     s400, s800, or s700}.  {and am getting error messages from the 
     C compiler} {and would like more info} {has anybody done this} 
     {are binaries available}?.

Q6.  I want to install Khoros on a Convex,  under ConvexOS x.x
     {and am getting error messages from the C compiler} {and 
     would like more info} {has anybody done this} {are binaries available}?.

Q7.  Can I run Khoros on my PC? Is Khoros available for PC's running DOS?

Q8.  Is there a port of Khoros for a VMS system?


-----------  Compiling with shared libraries -----

Q9.  What are shared libraries?  Does Khoros work with shared libraries?  
     What are the advantages/disadvantages of using shared libraries?
     Should I compile Khoros with shared libraries?

Q10. Why do I get unresolved references when I compile Khoros with
     shared libraries on a SUN4?

Q11. When compiling shared, I get a large set of errors from
     the loader listed in my make.World file, as in:

        rm -f vadd
        cc -o vadd vadd.o  -L/home/holst/khoros/lib -L/mnt/elocal/lang/SC1.0
        -O -Bdynamic -lghost  -lvexpr  -lnum_anal  -ldspl  -lformat
        -lgeo_surf  -lvipl  -lvutils  -lvmath  -lvrast  -lvgparm  -lverror
        -ltiff  -lm -ll -ldl
        ld: Undefined symbol
           _cg_
           _zgedi_
           _zgeco_
           _zgesl_
           _zsvdc_
           _ch_
           _dgesl_
           _dgefa_
           _e_wsfe
           _pow_ii
           _s_wsFe
           _s_stop
        *** Error code 2
        install in ./vipl/arith_binary/vadd done
        make: Warning: Target `install' not remade because of errors

Q12. I am compiling [some xvroutine] against X11R5 with shared libraries.
     The linker produces this error message:

     ld: /lib/libXaw.sa.5.0(sharedlib.o): _formWidgetClass: multiply defined
         /lib/libXaw.sa.5.0(sharedlib.o): _labelWidgetClass: multiply defined
     *** Error code 2
     make: Fatal error: Command failed for target `{xvroutine}'

Q13. I am having problems using cantata (or other xvroutine)
     after recently compiling on a SUN with shared libraries.  I get the
     error message:

     Warning: Widget class VendorShell version mismatch (recompilation needed):
       widget 11004 vs. intrinsics 11003.
     Warning: Widget class Form version mismatch (recompilation needed):
       widget 11004 vs. intrinsics 11003.


Q14. Warpimage {or other xvroutine} did not compile after on a SUN4
     architecture with static libraries;  in fact, it made the cc compiler
     segmentation fault and core dump!  What happened?


Q15. Khoros compiled ok under shared libraries.  However, when I try to
     use the programs, I get messages that say:
     lib{something}.so.1 not found

------------  Compiling with X11R5 -----

Q16. Can I compile Khoros with X11R5?

Q17. I am compiling Khoros with MIT's X11R5.  When linking xvroutines
     (cantata, editimage, etc), the compiler tells me that
     _viewportWidgetClass is multiply defined.  What's the problem?


------------  Makefiles, Imakefiles (compiling new programs) -----

Q18. I don't want to compile Khoros source, but I want to compile
     my own programs so I need the libraries. How can I obtain the
     Khoros libraries?

Q19. I am trying to compile an xvroutine, and when I run make install
     I get the error:
     installing in ./{xvroutine}...
     Make:  Don't know how to make {KHOROS_HOME}/lib/libdisplay.a.
     Stop.
     *** Error code 1

Q20. I want to link a {vroutine/xvroutine} for dbx.

Q21. I want my {vroutine/xvroutine} to use some specific 
     include files and special libraries.

Q22. Is there a way to get ghostwriter to automatically generate 
     the Makefile so that it will look for other include directories 
     and libraries?

------------  Compiling With gcc -----

Q23. I'm having a problem with gcc:

     % gcc test.c -I/usr/local/include -I$KHOROS_HOME/include

     In file included from KHOROS_HOME/include/vinclude.h:128,
     from test.c:3:
     KHOROS_HOME/include/vdefines.h:219: conflicting types for `malloc'
     /usr/local/{...}/include/malloc.h:41: previous declaration of `malloc'
     KHOROS_HOME/include/vdefines.h:223: conflicting types for `calloc'
     /usr/local/{...}/include/malloc.h:39: previous declaration of `calloc

Q24. I noticed in the make.World file is that a few files are compiled 
     using 'cc', while some others are compilied using 'gcc'. Is this normal? 
     Also, there were messages like: 
     gcc: file path prefix `dynamic' never used


------------  Compiling With/Without FORTRAN -----

Q25. Do I HAVE to have FORTRAN to compile Khoros?  Which Khoros programs
     will I miss out on if I don't compile with FORTRAN?

Q26. How do I compile the Khoros system without FORTRAN?

Q27. I don't have a FORTRAN compiler, but I need the Khoros programs that
     use FORTRAN.  What can I do?

Q28. I am writing a {vroutine/xvroutine} in which I need to make a call
     from my C code to a FORTRAN subroutine.  How do I do this?

Q29. I am setting up my *.cf configuration file in preparation for compiling
     Khoros.  How do I find out what libraries the linker expects in order
     to link C code against FORTRAN, in order to provide the proper
     libraries for the ForSysLibs option?

------------  Miscellaneous -----

Q30. I seem to be having some trouble getting Khoros working on our Sun 3.
     I have tried executing {cantata, editimage, etc}  {journal playbacks},
     but I keep getting the error "ld.so: libXaw.so.4: not found".

Q31. Since RPC isn't implemented yet, I defined UseSunRPC as NO in my 
     sun.cf file. Compiling phantomd results in the following message:
          ld: Undefined
          _sunrpc_tempnam
          _sunrpc_gethostname

Q32. On Sun3, OS 4.1.1, a segmentation fault results when cantata is run.

Q33. During the compile of Khoros, I get this error message:
         /: write failed, file system is full
         compiler(iropt) error:  write_irfile: No space left on device

Q34. I am trying to compile a {toolbox, new program, etc}, but "make"
     keeps giving me error messages that say:

     make: Fatal error:
     Don't know how to make target `{KHOROS_HOME}/lib/lib{something}.a

Q35. Where in the Khoros Manual is the documentation relating to installation
     of programs in Khoros?

Q36. How does one selectively fix a program and recompile it without doing
     the whole installation process again?

Q37. When I try to compile dzresp, dfilter, mat2viff, etc., I get 
     unresolved symbols for _dspl_parse, _format_parse, and _vexpr_parse.
     Where do I find these routines?

===============================================================================

===========   Installing Khoros on Various Architectures ======================

   Q1.  What machines does Khoros currently run on?

   A1.  Khoros 1.0 compiles on the following machines (MIT X unless
        otherwise noted):

        ApolloDN10000      OS 10.3, Fortran 10.8, cc 6.8
        CRAY YMP's, XMP's, Cray II's running UNICOS 6.0, and 6.1.
        DEC   5000/3100    Ultrix 4.2, mips cc 2.0, DEC f77 V3.0-2
        DEC   Vax 3600     Ultrix 4.1, cc1.37.1
        HP    9000/*       HP-UX 7.05, HP-UX 8.05
        IBM   RS/6000      AIX v3.1
        OMRON Luna88k      Mach 2.5, gcc 1.37, f77 1.8.5
        NeXT  68030,40     MACH 2.0, gcc 1.37, Absoft f77 2.0, Pensoft X
        SGI   All          OS 3.3.2, OS 4.0, X11 1.2, f77 3.3
        SUN   SPARCstations, SUN4   SUN OS 4.1.1, f77 1.4.5
        SUN   SUN3/        SUN OS 4.1.1, f77 1.3.1, gcc 1.39/2.0

        As of Patch 5, increased support was added for:

        Convex C220, running ConvexOS 9.1 with standard C compiler
        MacII running A/UX 2.0.1 using gcc-1.39 as C compiler.
        DG Aviion running DG/UX 4.3 (thanks to Bob Clark)
        Intel 386/486 running Interactive Unix  (thanks to Maurizio Davini)
        Luna 88K running Mach 2.0  (thanks to Ping-Kang Hsiung & Hideo Noro)

    ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
    ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~

   Q2.  I have machine X running operating system Y (not listed in A1).
        Has anyone ported Khoros to this architecture?

   A2.  Currently, Khoros is being / has been ported by various people
        in the Khoros user community to a variety of architectures,
        including the Alliant VFX/2800, Apollo 425T, Convex C220,
        DG Aviion, Fujitsu VP2200/10, IBM RS6000, Integraph
        Interpro, MacII, Sony 3710, and some 386/486 machines.

        At this time, these platforms are not directly supported by the
        Khoros group.  For more details, you may mail to
        danielle@bullwinkle.eece.unm.edu; she is compiling a list of Khoros
        ports, and can give you the information that she has so far.

        If YOU have done a port of Khoros to machine X running operating
        system Y, she would very much appreciate a letter from you,
        specifying:

           1) your name and place of employment (phone number optional)
           2) your return email address
           3) which version of Khoros you ported,
           4) which machine /operating system you ported to
           5) comments you might like to make.

        If you *do not* want to be contacted by other Khoros users, simply
        say so and your name / email address will not be released.




    ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
    ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~


   Q3.  I want to install KHOROS on an IBM RS/6000 workstation
	running under AIX x.x {and am getting error messages from the 
        C compiler} {and would like more info} {has anybody done this}
	{are binaries available}?.

   A3.  The Khoros group at UNM cannot help you directly with compiler errors
        from the RS/6000, as they do not have an RS/6000 to test on.  However, 
        binaries are available from an ftp site in Italy (thanks, Maurizio!) 
        and advice from Nagarajan Ramesh has proven valuable to many:

        (1) Maurizio Davini (mau@ipifidpt.difi.unipi.it)

            Has ported Khoros 1.0 P5 to the IBM RS6000 running AIX 3.2;

            He has an official ftp site in Pisa, Italy, which includes the
            Khoros source & system distribution, plus binaries for the
            IBM RS6000 and Interactive Unix 2.2.1, available via anonymous ftp:

            address   = ipifidpt.difi.unipi.it (131.114.8.130)
                 ftp  = anonymous (ftp)
              passwd  = user@machine
            directory = /pub/khoros
            binaries  = /pub/khoros/bin/RS6000

	    The khoros distribution is available also under our gopher server
	    ipifidpt.difi.unipi.it port 70

        (2) Nagarajan Ramesh (nagraj@watson.ibm.com)

            Has ported Khoros 1.0 P5 to IBM RS/6000 running AIX 3.1.5.
            Has these comments for compiling on the RS6000 with AIX 3.1.5:

            "I substituted the bsd compiler for the 'cc' compile command, and
            it works.  To do this you have to modify  your /etc/xlc.cfg file by
            including the following stanza - EXACTLY THE WAY IT IS.

            bsdcc:  use             = DEFLT
                    crt             = /lib/crt0.o
                    mcrt            = /lib/mcrt0.o
                    gcrt            = /lib/gcrt0.o
                    libraries       = -lbsd, -lc
                    proflibs        = -L/lib/profiled,-L/usr/lib/profiled
                    options         = -H512,-T512, -qlanglvl=extended, -qnoro,
                                      -D_BSD, -D_NONSTD_TYPES, -D_NO_PROTO,
                                      -D_BSD_INCLUDES, -bnodelcsect,
                                      -U__STR__, -U__MATH__

            Then, define a symbollic link from /bin/bsdcc to /bin/xlc.
            You also have to change the 'cc' to 'bsdcc' in the ibm.cf file."



        (3) In addition, the following people have ported Khoros 1.0 P5
            to IBM RS/6000 running AIX 3.2, and have been willing to answer
            questions in the past:

            * Roque Donizete De Oliveira (oliveria@caen.engin.umich.edu)
            * Edmond Mesrobian (edmond@cs.ucla.edu)
            * Nick Kisseberth (nkissebe@delphi.beckman.uiuc.edu)


    ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
    ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~

    Q4.  I want to install KHOROS on a 386/486 machine {and am getting 
	 error messages from the C compiler} {and would like more info} 
	 {has anybody done this} {are binaries available}?.
 
    A4.  (1) Scott Wilson (swilson@chama.eece.unm.edu)

            Khoros 1.0 P5 to Intel 486 based platform running Interactive
            Unix System V/386 Release 3.2, Version 3.0. All software was
            stock Interactive except  for the use of gcc2.2.2 as a compiler
            and f2c to handle the fortran code.

            He is providing the Khoros 1.0 P5 on the main Khoros server.

            address   = pprg.eece.unm.edu (129.24.24.10)
                 ftp  = anonymous (ftp)
              passwd  = user@machine
            directory = /pub/khoros
            binaries  = /pub/khoros/bin/bin486
            libraries = /pub/khoros/bin/lib486


        (2) Maurizio Davini (mau@ipifidpt.difi.unipi.it)

            Khoros 1.0 to Interactive unix 386 2.2.1, using gcc 1.40 ,f2c
            and X386 (the public domain version X11r4 of T.Roell).

            He is providing the Khoros 1.0 P5 binaries for Interactive
            Unix 2.2.1, plus binaries for IBM RS6000 running AIX 3.2 via
            anonymous ftp:

            address   = ipifidpt.difi.unipi.it (131.114.8.130)
                 ftp  = anonymous (ftp)
              passwd  = user@machine
            directory = /pub/khoros
            binaries  = /pub/khoros/bin/ISC-2.2.1
                        /pub/khoros/bin/RS6000

            In the directory 386ix, you can also find the X11R4,
            fortran compiler, and math library he used to compile Khoros.
            For more information, please contact Maurizio.


        (3) Dominic Richens (dominic@shamin.genie.uottawa.ca or
                             richens@panda1.uottawa.ca)

            Khoros 1.0 P5 to HP Vectra RS-25C (386 box) running
            SCO System V 3.2.2 ODT 1.1.

            He is providing the Khoros 1.0 P5 system with shell scripts
            and patches needed to build Khoros under SCO ODT 1.1
            via anonymous ftp:

            address   = popeye.genie.uottawa.ca (137.122.20.3)
                 ftp  = anonymous (ftp)
              passwd  = user@machine
            directory = /pub/khoros


        (4) Ulrich Breuer (breuer@pool.informatik.rwth-aachen.de)

            Used Maurizio Davini's port of Khoros 1.0 P5 as a starting point,
            in order to port Khoros 1.0 P5 to 386ix running ISC Version 2.2 with
            gcc-2.2.2 and no fortran.

            His configuration file, as well as a summary of the changes
            necessary for doing the port may be obtained from Danielle Argiro
            (danielle@chama.eece.unm.edu), or directly from him.


    ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
    ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~

    Q5.  I want to install Khoros on an HP {9000/s370, s400, s800, or s700}.
	 {and am getting error messages from the C compiler} {and would like 
	 more info} {has anybody done this} {are binaries available}?.
     
    A5.  (answer thanks to Konstantinos Konstaninides, Hewlett-Packard 
          Laboratories, Palo Alto, CA, kk@hpkronos.hpl.hp.com)

	 Binaries are not available for the HP, but you should be able to
	 compile quite easily provided you have the complete C compiler
	 and a Fortran compiler.  To port khoros 1 patch 5 to HP-UX on an 
	 HP9000/s370, s400, s800, or s700, the following steps were taken.
	 
	 1. Get the Xaw and Xmu libraries and include files
	    from hpcvaaz.cv.hp.com:~ftp/pub/MitX11R4/libs.s300.Z (or libs.s800.Z
	    for the snakes) using anonymous ftp.
	 
	    As an alternative, you can also get the X11R5 libraries from
	    ~ftp/pub/MitX11R5 (same machine). This is probably the preferred
	    approach if you want to use X11 shared libraries.
	 
	    Uncompress and untar them into your favorite directory.
	 
	    NOTE: Don't mix those binaries with HP binaries in /usr/lib/X11R4
	    and the include files with include files in /usr/include/X11R4.
	    Unpredictable core dumbs may happen!
	    Instead use /usr/local/X11R4 or /usr/lib/X11R5 or whatever else
	    you like.
	 
	    (Ignore this step if you already have somehow the above
	    include files and libraries in your system.)
	 
	 2. Edit src/xvroutines/Lib/xvforms/Imakefile
	    Remove:
	    #define UnsharedObjs
	    UNSHAREDOBJS =\
	            init.o
	 
	   and include init.o with the other objects.
	 
	 3. Edit $KHOROS_HOME/repos/config/imake_conf/hp.cf
	    and $KHOROS_HOME/repos/config/imake_conf/Lib/hpLib.rules
	 
	   as shown in the diffs file below
	   The changes fix the following problems:
	   a) Strip automatically the binaries (-s)
	   b) On the s700 solve the "too much defining" error message. (-Wp,..)
	   c) Include the appropriate Fortran libraries in the linking
	       of C code, since some khoros libraries use FORTRAN routines too.
	   d) Eliminate the -Dxxxx in f77 calls (with Shared Libraries).
	   e) Point to the correct place for the X11 Libraries
	   f) Install libraries with mode 555 (otherwise code with shared 
                libraries will not run)
	 
	 4. Depending on when you got your code you may want
	     a) get the fixed src/dspl/Lib/ldfilter.c routine
	       posted in the network. (4/9/92)
	     b) rm khoros/src/dspl/Lib/poly_yacc.c
	     (b) solves a linker problem on the s400.
	 
	 5. Run installit. Everything should compile with no problems.
	    After the compilation do
	 - ----------------------
	 
	 1. edit bin/kinstall_csh, and replace "mail -s" with "mailx -s"
	 2. You may want to edit bin/prnmanual
	    (Even if you don't have troff or groff, but you have a postscript 
            printer, you can still print the man pages. Only set up the printer 
            command and always accept the default answers. It should print the 
            existing xxxxx.ps files)
	 

	-------------Diffs----------------

*** hp.cf.orig	Fri Apr 10 10:44:33 1992
- --- hp.cf	Fri Apr 10 10:44:33 1992
***************
*** 7,15 ****
   */
  
  
! #define OSName                 HP-UX 8.05
  #define OSMajorVersion         8
! #define OSMinorVersion         5
  
  #define SystemV                YES
  
- --- 7,15 ----
   */
  
  
! #define OSName                 HP-UX 8.07
  #define OSMajorVersion         8
! #define OSMinorVersion         7
  
  #define SystemV                YES
  
***************
*** 76,87 ****
  #define InstallCmd $(SCRIPTSRC)/bsdinst.sh
  #define BaseName /bin/basename
  
  #ifdef hp9000s800
! #   define StandardDefines        -DSYSV
  #   define OptimizedCDebugFlags   +O1
  #else
  #  if OSMajorVersion == 8
! #      define StandardDefines        -DSYSV
  #  else
  #       define StandardDefines	-Wc,-Nd4000,-Ns4300,-Ne700,-Np300 -DSYSV -D_BSD -Drindex=strrchr -Dindex=strchr
  #  endif
- --- 76,88 ----
  #define InstallCmd $(SCRIPTSRC)/bsdinst.sh
  #define BaseName /bin/basename
  
+ #define InstLibFlags -m 0555
  #ifdef hp9000s800
! #   define StandardDefines        -s -Wp,-H512000 -DSYSV
  #   define OptimizedCDebugFlags   +O1
  #else
  #  if OSMajorVersion == 8
! #  define StandardDefines         -s -DSYSV
  #  else
  #       define StandardDefines	-Wc,-Nd4000,-Ns4300,-Ne700,-Np300 -DSYSV -D_BSD -Drindex=strrchr -Dindex=strchr
  #  endif
***************
*** 89,98 ****
  
  #if OSMajorVersion == 8
  #  if defined (hp9000s300) || defined (hp9000s400)
! #    define SysLibs -lBSD -lmalloc -lm -ll
  #    define ForSysLibs -lFext -lF77 -lI77
  #  else
! #    define SysLibs -lBSD -lmalloc -lm -ll
  #    define ForSysLibs -lcl -lfsys
  #  endif
  #else
- --- 90,99 ----
  
  #if OSMajorVersion == 8
  #  if defined (hp9000s300) || defined (hp9000s400)
! #    define SysLibs -lBSD -lmalloc -lm -ll -lIO77
  #    define ForSysLibs -lFext -lF77 -lI77
  #  else
! #    define SysLibs -lBSD -lmalloc -lm -ll -lcl
  #    define ForSysLibs -lcl -lfsys
  #  endif
  #else
***************
*** 100,106 ****
- --- 101,114 ----
  #   define ForSysLibs -lFext -lF77 -lI77
  #endif
  
+ #define XLibDir  /usr/local/x11r4/lib.s300
+ #define XIncludes -I/usr/local/x11r4
  /*
+ #define XLibDir  /usr/lib/X11R5
+ #define XIncludes -I/usr/include/X11R5
+ */
+ 
+ /*
   * The Shared libaries for HP may not be complete.  We do not
   * have an HP. This Lib/hpLib.rules is a guess at how hp
   * shared libs should be made. Please mail and changes
***************
*** 108,114 ****
   * update for the next version. 
   */
  
! #define HasSharedLibraries NO
  
  #if HasSharedLibraries
  #  define SharedLibRev 1.1                /* Use Khoros revision number */
- --- 116,122 ----
   * update for the next version. 
   */
  
! #define HasSharedLibraries YES
  
  #if HasSharedLibraries
  #  define SharedLibRev 1.1                /* Use Khoros revision number */
*** Lib/hpLib.rules.or	Mon Apr  6 13:38:05 1992
- --- Lib/hpLib.rules	Mon Apr  6 13:38:05 1992
***************
*** 73,81 ****
  									@@\
  .f.o:									@@\
  	$(RM) $@ shared/$@						@@\
! 	$(FC) -c $(SHAREDCODEDEF) $(SHLIBDEF) $(FLIBFLAGS) $*.f		@@\
  	$(MV) $*.o shared/$*.o						@@\
! 	$(FC) -c $(SHLIBDEF) $(FLIBFLAGS) $*.f				@@\
                                                                        @@\
  clean::								@@\
  	-@if [ -d shared ]; then echo " $(RM) shared/?*.o"; \		@@\
- --- 73,81 ----
  									@@\
  .f.o:									@@\
  	$(RM) $@ shared/$@						@@\
! 	$(FC) -c $(FLIBFLAGS) $*.f					@@\
  	$(MV) $*.o shared/$*.o						@@\
! 	$(FC) -c $(FLIBFLAGS) $*.f					@@\
                                                                        @@\
  clean::								@@\
  	-@if [ -d shared ]; then echo " $(RM) shared/?*.o"; \		@@\

    ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
    ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~

   Q6.  I want to install Khoros on a Convex,  under ConvexOS x.x
        {and am getting error messages from the C compiler} {and 
        would like more info} {has anybody done this} {are binaries available}?.

   A6.  (answer thanks to Tait Cyrus, CONVEX Computer Corp., Colorado 
	 Springs, CO, cyrus@convex.com) 

	Binaries for the Convex are not available;  however, building
        Khoros 1.0 P5 on the Convex is quite easy.  The following is a 
	convex.cf file which may be used for compiling Khoros under 
	ConvexOS 9.1.

/*
 * convex.cf - Provided by W. Tait Cyrus (cyrus@convex.com) April. 22, 1992
 * This is a configuration file for a Convex.
 * Thanks to Minaz Punjani <cziup09@pluto.ulcc.ac.uk> for verifying under
 *      ConvexOS 10.0.
 *
 * Khoros has been successfully compiled using the following:
 *      ConvexOS        9.1 & 10.0
 *      C               4.1, 4.3.1, and 4.3.2
 *      Fortran         6.1 & 7.0 [see note below]
 *      CXWindows       2.1 & 3.0
 *
 * SET VERSION NUMBERS BEFORE MAKING MAKEFILES
 */

/*
 * Set the major version number of the Fortran compiler you will be using
 * in the following #define.
 */

#define Convex_fc_MajorVersion 7

#if Convex_fc_MajorVersion >= 7
#   define Convex_fc_lib        -llfs
#else
#   define Convex_fc_lib
#endif

#define OSName                  ConvexOS V9.1
#define OSMajorVersion          9
#define OSMinorVersion          1 
/*
 * Uncommenting for a ConvexOS 10.0 system is not really necessary since 
 * nowhere in Khoros is a check of OSMajorVersion made for 10.  The only check
 * is the one below and it just checks against 8.
 *
 * #define OSName               ConvexOS V10.0
 * #define OSMajorVersion       10
 * #define OSMinorVersion       0 
 */

/*
 * does your machine support saber C
 */
#define HasSaberC               NO      /* for machines that have it */

/*
 * Do you want to Compile the tiff library and tiff2viff/viff2tiff
 * conversion routines? If set to NO, then the tiff library will
 * not be compiled and thus no programs will link against that
 * library.
 */

#define UseTiff YES


/*
 * are you using gcc? if yes then set HasGcc to YES
 */
#define HasGcc                  NO

#define SystemV                 NO
#define HasVoidSignalReturn     YES
#define StandardDefines         -DXAW_BC
#define VersionNumber           2.0
#define HasFortran              YES
#define FortranCmd              /usr/convex/fc
#define HasPutenv               NO
#define HasBsearch              YES
#define HasVFork                YES
#define HasTempnam              NO
#define HasBsdTypes             YES
#define HasRandom               YES
#define HasDirent               NO
#define HasWait3                NO

#if OSMajorVerson == 8

#   define OptimizedCDebugFlags -O3
#   define InstScriptFlags      -m 0755 -g bin
#   define InstManFlags         -m 0444 -g bin
#   define BootstrapCFlags      -Dconvex -pcc

#   define DefaultCCOptions     -O3 -pcc
#   define FortranDebugFlags    -O3

#   define ForSysLibs -lF77 -lI77 -lD77 -lmathC2 

#else  /* assuming OSMajorVersion > 8 */

#   define OptimizedCDebugFlags
#   define InstScriptFlags      -m 0755 
#   define InstManFlags         -m 0444
#   define BootstrapCFlags      -Dconvex
#   define DefaultCCOptions     -O3 -or none -fi
#   define FortranFlags         -O3 -fi -or none
#   define LibraryFCOptions     -O3 -fi -or none
#   define ForSysLibs -lF77 -lI77 -lD77 -lmathC2 Convex_fc_lib

#endif

#define ReDefFortran NO
#define UNCOMPRESSPATH /usr/local/bin/uncompress
#define UseCCMakeDepend YES
#define LibraryFDebugFlags -pp=fcpp1 -uo -is .

/* 
 * the following is a list of data transports available for
 * use within Khoros:
 *      UseFile            - Standard file system transport
 *      UseSockets         - bsd Sockets
 *      UseSharedMem       - shared memory
 *      UseSunVirMem       - sun virtual memory
 *      UsePipes           - Pipes
 *      UseStream          - Named pipes
 *      UseSunRPC          - Sun's remote procedure call
 *      UseKTLI            - sysV transport layer interface
 *      UseApolloRPC       - Apollo's remote procedure call
 *
 * Set the data transports that you want to use to YES and
 * all others to NO. normally, you should not have to
 * modify this list.
 * 
 */

#define UseFile         YES
#define UseSockets      NO
#define UseSharedMem    NO
#define UseSunVirMem    NO
#define UsePipes        NO
#define UseStream       NO
#define UseSunRPC       NO
#define UseKTLI         NO
#define UseApolloRPC    NO

#define NormalFortranObjectRule()                                       @@\
all::                                                                   @@\
        $(FC) -il $(FSRCS)                                              @@\
                                                                        @@\
.f.o:                                                                   @@\
        $(RM) $@                                                        @@\
        $(FC) -c $(FLIBFLAGS) $*.f                                      @@\
                                                                        @@\
clean::                                                                 @@\
        $(RM) *.fil


    ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
    ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~

   Q7.  Can I run Khoros on my PC? Is Khoros available for PC's running DOS?

   A7a. The three major requirements for Khoros are: X11R4, a UNIX-type
        operating system, and lots of space (min. 120-150 Meg).  Only if your
        PC has these three prerequisites can you consider doing a port of
        Khoros to your PC.  Successful ports of Khoros have been done for
        the Mac II and various 386/486 machines that meet these requirements.	
	Please see Q4 for more details on ports to the 386/486.

   A7b.	No, nor are there plans to make Khoros available for PC's
	running DOS as of yet.  The design changes necessary for
	completing such a task would be so extensive as to make the
	attempt unworkable at this time.


    ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
    ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~

   Q8.  Is there a port of Khoros for a VMS system?

   A8.  No.  The software depends heavily on system functions that are
        unique to Unix-based operating systems.


    ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
    ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~

================  Compile With Shared Libraries ===============================

   Q9.  What are shared libraries?  Does Khoros work with shared libraries?
        What are the advantages/disadvantages of using shared libraries?
	Should I compile Khoros with shared libraries?

   A9a. Shared libraries are a mechanism implemented by some operating 
	systems (SUN, HP, DG Aviion, etc)  that allow a significant savings
	of disk space by allowing programs to link against any necessary
	libraries at runtime rather than at compile time.  Since the libraries
	are not compiled into the program's executable, each program that
	is compiled with shared libraries takes up much less space. 

   A9b. Yes. You can compile Khoros with/for shared libraries.
        If you are compiling shared, make sure that your machine.cf
        configuration file has the symbol HasSharedLibraries set to YES.

   A9c. The advantage, of course, is savings on disk space.  The disadvantage
        is that because libraries must be linked in at runtime, you will
	experience a lag in startup time of programs.  The disk space savings,
	like amount of the extra time at startup, will vary with machine 
	architecture, operating system implementation, and other factors.

   A9d. That depends on your position with respect to the tradeoffs.  
	If you are short on disk space, using shared libraries may be the 
	answer to your problems.  If you have plenty of disk space to waste, 
	you may want to go ahead and compile statically so that programs 
	run faster.  

	Some excerpts of mail from Khoros users who have reported disk savings 
	due to shared libraries follow (thanks, guys, for the info):

	"I've just brought Khoros up with shared libraries under
	 DG/UX 5.4 (DG AViiON).  However, the size savings seems quite
	 a bit less than I was expecting...Anyway, there is a net disk 
	 savings of 22.2MB, some 27MB (from 86MB to 59MB) in bin and about
	 4.7MB in lib).		-- Steve"  

	"I don't know about the savings, but do know the sizes with SUN
	 shared libs.  (patchlevel 5) Bin: 24Mb Lib: 9.2Mb, with 3.7Mb shared 
	 libs.  I recall needing approx. 80-90 Mb for bin without shared libs 
	 (for patch level 2).   -- Klamer"

	"I got 7 MB of libraries and about 20 MB of executables on a 
	 SPARCstation running {shared libs}. I would have to expect 63 MB of 
	 executables + 21 MB of librares and objects when not using shared 
	 code - it saved about 40 - 50 MB...  -- Kritt"

	"Here are my numbers for khoros patch 5: bin 9.3 MB, lib 9.1 MB
	 The lib contains BOTH shared and archive libs. Thus, making khoros 
	 shared gives 9.3 MB bins + 4.5 MB libs = 13.8 MB...  Not long ago I 
	 had an unstrip'ed code of patch 4 that took (read my lips) 165 MB!!   
	 -- Peder"


    ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
    ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~

   Q10. Why do I get unresolved references when I compile Khoros with
        shared libraries on a SUN4?

   A10. If you are compiling on a SUN4 under 4.1.1 and have installed
        the loader (ld) program patch, or you are compiling on a SUN4
        under 4.1.2 you must compile Khoros statically. Make sure
        you set HasSharedLibraries to NO in the sun.cf file.

        The ld program under 4.1.1 (with the patch) and under 4.1.2
        requires that all references in the libraries be resolved. So,
        this means that every Khoros routine will need to load against
        all the libraries. This is not reasonable for Khoros, and the
        size of the shared executables after loading against all the
        libraries are not significantly smaller than if they were
        loaded statically.


    ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~~ ~ ~ ~ ~ ~
    ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~

   Q11. When compiling shared, I get a large set of errors from
        the loader listed in my make.World file, as in:

        rm -f vadd
        cc -o vadd vadd.o  -L/home/holst/khoros/lib -L/mnt/elocal/lang/SC1.0
        -O -Bdynamic -lghost  -lvexpr  -lnum_anal  -ldspl  -lformat
        -lgeo_surf  -lvipl  -lvutils  -lvmath  -lvrast  -lvgparm  -lverror
        -ltiff  -lm -ll -ldl
        ld: Undefined symbol
           _cg_
           _zgedi_
           _zgeco_
           _zgesl_
           _zsvdc_
           _ch_
           _dgesl_
           _dgefa_
           _e_wsfe
           _pow_ii
           _s_wsFe
           _s_stop
        *** Error code 2
        install in ./vipl/arith_binary/vadd done
        make: Warning: Target `install' not remade because of errors

   A11. This is the behavior of the loader in Sun OS 4.1.2. It
        insists on resolving everything in linpack, and since that
        version of linpack does not appear to be fully consistent
        (i.e. those routines are reference but not defined), you get
        these error messages.
        To solve the problem, you may:

        * use the (pre ld patch) loader of 4.1.1.

	  suggestion, to use something like:
          lrwxrwxrwx  1 root            8 Jun 10 11:04 /usr/bin/ld -> ld.4.1.1
          -rwxr-xr-x  1 root       156161 Mar  5 15:46 /usr/bin/ld.4.1.1*
          -rwxr-xr-x  1 root       156161 Oct 23  1991 /usr/bin/ld.4.1.2*
	  so that you can switch between the two loaders easily.

        * add stub routines to linpack (like extern void zgeco_() {} )

        * in $KHOROS_HOME/repos/config/imake_conf/sun.cf,
          change:
	    #  define DefaultCCOptions -Bdynamic
	    #  define LibraryLdOptions -assert pure-text
	  to:
	    #  define DefaultCCOptions -Bdynamic -Qoption ld -assert -Qoption ld
		      nodefinitions
            #  define LibraryLdOptions -assert nodefinitions


        If you are compiling on a SUN4 under 4.1.1 and have installed
        the loader (ld) program patch, you must either follow the solutions 
	given above, or  compile statically.


    ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~~ ~ ~ ~ ~ ~
    ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~~ ~ ~ ~ ~ ~


   Q12. I am compiling [some xvroutine] against X11R5 with shared libraries.
        The linker produces this error message:

	ld: /lib/libXaw.sa.5.0(sharedlib.o): _formWidgetClass: multiply defined
            /lib/libXaw.sa.5.0(sharedlib.o): _labelWidgetClass: multiply defined
        *** Error code 2
        make: Fatal error: Command failed for target `{xvroutine}'

   A12. You will need to change Form.c in 
        $KHOROS_HOME/src/xvroutines/Lib/xvutils.

	Try changing line 137 from:
        WidgetClass formWidgetClass = (WidgetClass)&formClassRec;
	to:
        static WidgetClass formWidgetClass = (WidgetClass)&formClassRec;

	And, in the file Label.c in $KHOROS_HOME/src/xvroutines/Lib/xvutils,
	Try changing line 140 from:
        WidgetClass labelWidgetClass = (WidgetClass)&labelClassRec;
	to:
        static WidgetClass labelWidgetClass = (WidgetClass)&labelClassRec;

	Recompile the xvutils library, and recompile the xvroutine.

    ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
    ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~~ ~ ~ ~ ~ ~

   Q13. I am having problems using cantata (or other xvroutine)
        after recently compiling on a SUN with shared libraries.  I get the
        error message:
     Warning: Widget class VendorShell version mismatch (recompilation needed):
       widget 11004 vs. intrinsics 11003.
     Warning: Widget class Form version mismatch (recompilation needed):
       widget 11004 vs. intrinsics 11003.

   A13. Your LD_LIBRARY_PATH environment variable that you use to compile
        your object files with is different than your run time environment.

        To get a bit of information about what is going on, do:
        % ldd $KHOROS_HOME/bin/{problem program}

        If the path printed for Xaw and Xt is different than what is listed
        when you do:
        % printenv
        then this is the problem.  To fix it, unset LD_LIBRARY_PATH or set it
        to the correct path.

    ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
    ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~~ ~ ~ ~ ~ ~

   Q14. Warpimage {or other xvroutine} did not compile after on a SUN4 
	architecture with static libraries;  in fact, it made the cc compiler 
	segmentation fault and core dump!  What happened?

   A14. The problem is that the Makefile that is created for warpimage has
        a line that is too long for ld to handle.  The solution is to edit
        the Makefile and delete these three lines:

		$(FILEFORMATLIB) \
		$(DSPLLIB) \
		$(TIFFLIB)

		and change the line
		$(VERRORLIB) \
		to
		$(VERRORLIB)

        This causes the cc line to be of a reasonable length, and warpimage
        {or other xvroutine} will now compile properly.

    ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
    ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~~ ~ ~ ~ ~ ~

   Q15. Khoros compiled ok under shared libraries.  However, when I try to
        use the programs, I get messages that say:

        lib{something}.so.1 not found

   A15. The message implies that your LD_LIBRARY_PATH environment variable 
        that was used to compile the Khoros object files is different than 
        your run time environment.

        To get a bit of information about what is going on, do:
        % ldd $KHOROS_HOME/bin/{problem program}

        If the path printed for lib{something} is different than what is 
        listed when you do:
        % printenv
        then this is the problem.  To fix it, unset LD_LIBRARY_PATH or set 
        it to the correct path.

    ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~~ ~ ~ ~ ~ ~
    ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~~ ~ ~ ~ ~ ~

=====================   Compiling with X11R5  ================================


   Q16. Can I compile Khoros with X11R5?

   A16. Yes.  See Q12 for the most frequent problems when compiling 
	Khoros with X11R5.


    ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
    ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~

   Q17. I am compiling Khoros with MIT's X11R5.  When linking xvroutines
        (cantata, editimage, etc), the compiler tells me that
        _viewportWidgetClass is multiply defined.  What's the problem?

   A17. This problem is due to the fact that we have our own bugged fixed
        versions of the Viewport widget.  We were hoping that R5
        would have these fixes so that we could delete them, but unfortunately
        this isn't the case.  Kim Tang provides these fixes to get around the
        problem:

        In $KHOROS_HOME/src/xvroutines/cantata/Viewport.c, change line 141 to:
        static WidgetClass viewportWidgetClass = (WidgetClass)&viewportClassRec;


   Q17b. ld: /lib/libXaw.sa.5.0(sharedlib.o): _formWidgetClass: multiply defined
            /lib/libXaw.sa.5.0(sharedlib.o): _labelWidgetClass: multiply defined
        *** Error code 2
        make: Fatal error: Command failed for target `{xvroutine}'

   A17b. see Q13.


    ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
    ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~


===========  Makefiles, Imakefiles (Compiling New Programs) ===================

   Q18. I don't want to compile Khoros source, but I want to compile
        my own programs so I need the libraries. How can I obtain the
        Khoros libraries?

   A18. We distribute libraries for the SUN4, Decmips, and SGI via
        anonymous FTP:
  
           USA:                 ftp pprg.eece.unm.edu  (129.24.24.10)
        (University of  Login:  anonymous  (or ftp)
            New Mexico) Password: user_name@machine
  
        To obtain the libraries, cd to "pub/khoros/bin". You will find
        three sub-directories called libsun4, libdecmips and libsgi.
        In these sub-directories are the compressed tar files containing
        the libraries. Unpack the libraries the same way you would
        unpack the binaries. Consult the Khoros installation guide.

    ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~~ ~ ~ ~ ~ ~
    ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~~ ~ ~ ~ ~ ~

    Q19. I am trying to compile an xvroutine, and when I run make install
         I get the error:
         installing in ./{xvroutine}...
         Make:  Don't know how to make {KHOROS_HOME}/lib/libdisplay.a.
         Stop.
         *** Error code 1
 
    A19. Most likely, you do not have the Khoros libraries that are necessary
         to compile spectrum (and any other toolbox you may acquire).
         These libraries (*.a) would be located in $KHOROS_HOME/lib if you
         had them.  If you do not have them, you may either:
         (1) ftp them from pprg  (see Q11)
	     - or -
         (2) compile the Khoros system (you must have source code for this)


    ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~~ ~ ~ ~ ~ ~
    ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~~ ~ ~ ~ ~ ~

    Q20. I want to link a {vroutine/xvroutine} for dbx.

    A20. In your Imakefile, add:
         CDEBUGFLAGS = -g

	 % makemake
 
         To remake your Makefile.

    ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~~ ~ ~ ~ ~ ~
    ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~~ ~ ~ ~ ~ ~

    Q21. I want my {vroutine/xvroutine} to use some specific 
         include files and special libraries.

    A21. Suppose you have additional include files you want (relative to the
         program) in "../../include" and an extra library you want to use in
         "../../lib/libfubar.a."

         So in your Imakefile, you'd add:

         EXTRA_INCLUDES =  -I../../include
         EXTRA_LIBRARIES = ../../lib/libfubar.a

	 % makemake 

	 To remake your Makefile.  You can also use the absolute path, but 
	 this is not a good idea if you have your program on more than one 
         architectures using NFS, as all the architectures will use the same 
	 Imakefile, but the absolute path on one machine may not be the same 
         as the absolute path on the second.

    ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~~ ~ ~ ~ ~ ~
    ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~~ ~ ~ ~ ~ ~

   Q22.  Is there a way to get ghostwriter to automatically generate 
	 the Makefile so that it will look for other include directories 
         and libraries?

   A22.  (answer thanks to Bradford Castallia, Planetary Image Research Lab,
          University of Arizona)

         You can specify site-specific libraries that should always be 
         referenced.

 	 However, for specific cases, modify the {toolbox}.def file (under
 	 $TOOLBOX/repos/config/imake_conf). Edit the lines containing the
 	 definitions of TOOLBOXINCLUDE and TOOLBOX_LIBRARIES, and you may also
 	 want to edit the line defining TOOLBOX_DEP_LIBRARIES to be consistent
 	 with the definition of TOOLBOX_LIBRARIES. For example, I have a
 	 toolbox for applications that access our digital filmwriter which
 	 requires access to a few special include files and libraries, so I have
 	 modified filmwriter.def thus:
 	 
 	 TOOLBOXINCLUDE = -I$(TB_NAME)/include \
 	                  -I/usr/local/QCR/include \
 	                  -I/usr/local/image/include \
  	                  -I/usr/local/PIRL
 	 
 	 TOOLBOX_LIBRARIES = -lfilmwriter \
 	                     -lQCR \
 	                     -lImage \
 	                     -lPIRL
 	
         TOOLBOX_DEP_LIBRARIES = $(LIBDIR)/libfilmwriter.a \
 	                          /usr/local/lib/libQCR.a \
 	                          /usr/local/lib/libImage.a \
 	                          /usr/local/lib/libPIRL.a
 	 
    ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~~ ~ ~ ~ ~ ~
    ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~~ ~ ~ ~ ~ ~

===================  Compiling with gcc ======================================


   Q23.  I'm having a problem with gcc:

 	 % gcc test.c -I/usr/local/include -I$KHOROS_HOME/include

	 In file included from {KHOROS_HOME}/include/vinclude.h:128, 
	 from test.c:3: 
	 {KHOROS_HOME}/include/vdefines.h:219: conflicting types for `malloc' 
         /usr/local/{...}/include/malloc.h:41: previous declaration of `malloc'
         {KHOROS_HOME}/include/vdefines.h:223: conflicting types for `calloc'
         /usr/local/{...}/include/malloc.h:39: previous declaration of `calloc'

   A23.  In the file $KHOROS_HOME/include/vdefines.h,
	 change the line:

	 #ifndef AUX
	 to:
 	 #if !defined(AUX) && !defined(__GNUC__)

	 Then, in $KHOROS_HOME/src, execute 
	 % make Makefiles
	 % make install


    ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~~ ~ ~ ~ ~ ~
    ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~~ ~ ~ ~ ~ ~

   Q24. I noticed in the make.World file is that a few files are compiled 
        using 'cc', while some others are compilied using 'gcc'. Is this normal? 
        Also, there were messages like: 
        gcc: file path prefix `dynamic' never used

   A24. The -Bdynamic flag does not exist for gcc. Use -static for a static
        binary compile, as the default is to load dynamically. The -Bdynamic 
        flag was ignored and not used.

	It is normal that some files will be compiled with cc.  We use cc to 
        compile the bootstrap programs such as imake. However, gcc should have
        been used for all the rest of the routines.

    ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~~ ~ ~ ~ ~ ~
    ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~~ ~ ~ ~ ~ ~

===================  Compiling With/Without FORTRAN ==========================

   Q25. Do I HAVE to have FORTRAN to compile Khoros?  Which Khoros programs
        will I miss out on if I don't compile with FORTRAN?

   A25. No, you don't have to have FORTRAN to compile Khoros, although there
        are some Khoros programs that use it.  If you don't compile with
        FORTRAN, you will NOT be able to run the following programs, nor will
	you be able to make calls to any of their associated library routines:  

	Program         Library Call
        -------         ------------
	* warpimage
	* vbilinco 	(lvbilinco)
	* vpolyco	(lvpolyco)
	* vsvpsf	(lvsvpsf)
	* vblse		(lvblse)
	* vfft		(lvfft)
	* dmusic	(ldmusic)
	* dminorm	(ldminorm)
	* dacorr	(ldacorr)
	* dxcorr	(ldxcorr)
	* dconvo	(ldconvo)
	* dfft1d	(ldfft1d)
	* difft1d	(ldifft1d)
	* minvert	(lminvert)
	* msvd		(lmsvd)
	* meigen	(lmeigen)
	* mlud		(lmlud)
	* mlse		(lmlse)
	* minfo		(lminfo)

    ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~~ ~ ~ ~ ~ ~
    ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~~ ~ ~ ~ ~ ~

   Q26. How do I compile the Khoros system without FORTRAN?

   A26. Look for the line in your configuration (*.cf) file that says,
        #define HasFortran YES
        Change it to:
        #define HasFortran NO

        For those compiling on a SUN architecture, note that in the sun.cf 
	file for Khoros 1.0 Patch 5, there is an INCORRECT comment:
        /*
         * does your machine have fortran? If not comment the next
         * two lines
         */
	The comment lies.  Do not comment out the lines, simply make
	sure that HasFortran is set to 'NO' (not 'no' or 'No').  
 
    ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~~ ~ ~ ~ ~ ~
    ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~~ ~ ~ ~ ~ ~

   Q27. I don't have a FORTRAN compiler, but I need the Khoros programs that
        use FORTRAN.  What can I do?

   A27. The public domain "f2c" FORTRAN-to-C converter can be used to produce
        C code from the FORTRAN sections of Khoros.  The "f2c" program can
        be obtained via anonymous ftp from various sites including 
	pprg.eece.unm.edu (129.24.24.10) in the directory, /pub/dist/f2c, and
	research.att.com (192.20.225.2) in the directory, /netlib.  
	Khoros programs that depend on FORTRAN code that was converted to 
	C by the f2c program dont't have their results guaranteed by the Khoros 
	group, however, at least not at this time.

    ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~~ ~ ~ ~ ~ ~
    ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~~ ~ ~ ~ ~ ~

   Q28. I am writing a {vroutine/xvroutine} in which I need to make a call
        from my C code to a FORTRAN subroutine/function.  How do I do this?

   A28. (1) Declare the FORTRAN subroutine/function, making sure you use an 
            underscore after the name, as in:
            (void) subroutine_();
            (type) function_();

	(2) Call the subroutine/function, remembering that when you call FORTRAN 
	    from C, you must always pass values by reference (address), as in:
            int int_value, *int_array;
	    (void) subroutine_(&int_value, int_array);

	(3) Note that 2D arrays in FORTRAN are stored in the opposite way 
	    from those in C.  In C, a 2D array is stored as row by row, 
	    whereas in FORTRAN a 2D array is stored column by column.  

	(4) Also note that the TRUE and FALSE status values returned by 
	    a FORTRAN program may not be the 1 and 0 that are used by 
	    convention in C.

    ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~~ ~ ~ ~ ~ ~
    ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~~ ~ ~ ~ ~ ~

   Q29.  I am setting up my *.cf configuration file in preparation for compiling
         Khoros.  How do I find out what libraries the linker expects in order
         to link C code against FORTRAN, in order to provide the proper
         libraries for the ForSysLibs option?

   A29.  You can find out what libraries the linker expects by compiling any
         available Fortran program with the [-v] option, and looking for the
         libraries specified after a [-l] that are NOT used when compiling
         C code.  Roque Donizete De Oliveria provides the example below, which
         he used in getting Khoros to compile under Ultrix 4.2:

        % f77 -v machar.F
        /lib/cpp -DLANGUAGE_FORTRAN -DMIPSEL -Dunix -Dmips -Dhost_mips 
           machar.F > machar.i
        /usr/lib/cmplrs/fort/decfort -o /tmp/forAAAa01710.o machar.i
        /usr/bin/cc -v /tmp/forAAAa01710.o -nocount -lUfor -lfor -lutil 
	   -li -lot s -lm
        /usr/lib/cmplrs/cc/ld -G 8 -g0 -nocount /usr/lib/cmplrs/cc/crt0.o 
	   -count /tmp/forAAAa01710.o -nocount -lUfor -lfor -lutil -li 
           -lots -lm -nocount -lc
        0.2u 1.7s 0:09 21% 84+285k 333+63io 17pf+0w

         In this case, therefore, you would specify in the ultrix.cf file:

         ForSysLibs: -lUfor -lfor -lutil -li -lots

    ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~~ ~ ~ ~ ~ ~
    ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~~ ~ ~ ~ ~ ~
 
===================  Miscellaneous ============================================

    Q30. I seem to be having some trouble getting Khoros working on our Sun 3. 
         I have tried executing {cantata, editimage, etc}  {journal playbacks}, 
	 but I keep getting the error "ld.so: libXaw.so.4: not found".

    A30. (answer thanks to Mike Gross, Physics Board, Univ of California)

	 Your problem is that you have to run ldconfig to tell your system where
	 your shared libraries are. The syntax is:

	 ldconfig <directory> [<directory>] [<directory>] ...

	 where each directory is a possible location for a *.so.* file. You
	 may have to use find to figure out where all the libraries are. Try
	 this out, and if it works, put the ldconfig command in /etc/rc.local,
	 so that you won't lose it next time your system crashes.

	 An alternative is to compile khoros using static libraries, but this
	 will make your executables much larger.


    ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~~ ~ ~ ~ ~ ~
    ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~~ ~ ~ ~ ~ ~

    Q31.  Since the docs say that RPC isn't implemented yet, I defined 
	  UseSunRPC as NO.  Compiling phantomd results in the following:
	  ld: Undefined
	  _sunrpc_tempnam
	  _sunrpc_gethostname

    A31.  Suggestions:

	  1) make sure that the SunRPC variable in 
             repos/config/imake_conf/sun.cf is set to 'NO' rather than 'no'.

          2) cd into src and run the "installit" script again.
                        - or -
	  2) cd into src/Lib/vgparm and run:

            % make Makefile
            % make install

            You should see it recompile with a set of defines specified on 
            the compilation command.  Make sure that -DKSUNRPC option is *not*
            defined.  This is what's trying to pull in the non-existent
            Sun RPC transport.

         3) If you are not using shared libraries, then change directories 
            to $KHOROS_HOME/src and run:
            % make install

	    If you are using shared libraries, simply rerunning the phantomd
	    should work.

    ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~~ ~ ~ ~ ~ ~
    ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~~ ~ ~ ~ ~ ~

     Q32. On Sun3, OS 4.1.1, a segmentation fault results when cantata is run.

	 The problem is that the bug is caused in the vgparm and vutils 
	 library, not in the cantata program code.  

	 In the file $KHOROS_HOME/src/Lib/vgparm/listfile.c there is a bug.
	 Make the following changes to this file
	
	 at line 100 change:

            char    character, *fullpath, entry[LENGTH], **list;
	 to:
            char    character[2], *fullpath, entry[LENGTH], **list;


         and line 144 change:

           if ((void) fscanf(file, " %[#]", &character) == 1)
         to:
           if ((void) fscanf(file, " %[#]", character) == 1)


         and line 157 change:

           else if ((void)fscanf(file, "%[/]%[*]", &character, &character) == 2)
         to:
           else if ((void) fscanf(file, "%[/]%[*]", character, character) == 2)


         Then in the file $KHOROS_HOME/src/Lib/vutils/readascii.c some
	 changes need to be made.
	
	 at line 99 change:

           char    dummy[512], character;
         to:
           char    dummy[512], character[2];


         and line 128 change:
           if ((void) fscanf(file, "%[#]", &character) == 1)
         to:
           if ((void) fscanf(file, "%[#]", character) == 1)


         and line 139 change:
           else if ((void)fscanf(file, "%[/]%[*]", &character, &character) == 2)
         to:
           else if ((void)fscanf(file, "%[/]%[*]", character, character) == 2)


         there also seems to be a problem caused by the optimizer
         using -O on sun3.  It is necessary to recompile the system using -01
         which is defined as follows in your sun.cf file:

          #define HaveSunPatchedLd NO
          #define HasGcc NO
          #define DefaultCDebugFlags -O1          /* for programs */
          #define LibraryCDebugFlags -O1          /* for libraries */

         Note that a comment in sun.cf has a typing error.  The correct
         flag is -O1 (minus oh one) and not -01 (minus zero one).  

         Then change directory to $KHOROS_HOME/src, run "make allclean"
         and then the "installit".

    ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~~ ~ ~ ~ ~ ~
    ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~~ ~ ~ ~ ~ ~

   Q33.  During the compile of Khoros, I get this error message:
         /: write failed, file system is full
         compiler(iropt) error:  write_irfile: No space left on device

   A33.  This error is becuase you have run out of disk space in /tmp. 
         By default the C compilier uses /tmp as the place to store 
         intermediate files. To fix this, set the environment variable 
	 TMPDIR to a partition with more disk space, as in:
	 % setenv TMPDIR /large_tmp_dir

    ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~~ ~ ~ ~ ~ ~
    ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~~ ~ ~ ~ ~ ~

   Q34. I am trying to compile a {toolbox, new program, etc}, but "make"
	keeps giving me error messages that say:

	make: Fatal error: 
	Don't know how to make target `{KHOROS_HOME}/lib/lib{something}.a

   A34. It is likely that you simply don't have the Khoros libraries installed 
	on your system.  Look and see if there is a {KHOROS_HOME}/lib 
	directory, which contains a large variety of files ending in ".a".
	If this directory is missing, whoever installed Khoros probably got 
	just system & binaries.  If you want to compile anything, though, 
	you must have the Khoros libraries installed properly in 
	$KHOROS_HOME/lib.  You may obtain the Khoros libraries in one of 
	two ways:

	   (1) for SUN4, SGI, DECMIPS, and 486 architectures, the libraries can
               be ftp'd from pprg.eece.unm.edu, in /pub/khoros/bin.  Put 
               the *.a's in $KHOROS_HOME/lib, and you will be able to compile.

	   (2) you may acquire Khoros source code from pprg.eece.unm.edu, in
	       /pub/khoros/src, and compile the Khoros system according to the
	       installation guide.  The Khoros libraries will be compiled as
	       part of the entire Khoros installation process.


    ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~~ ~ ~ ~ ~ ~
    ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~~ ~ ~ ~ ~ ~

   Q35. Where in the Khoros Manual is the documentation relating to 
	compilation/installation of programs in Khoros?

   A35. The installation guide for the Khoros system as a whole is  
        available via anonymous ftp from pprg.eece.unm.edu, in the 
	file /pub/khoros/release/install.ftp.  This is also Chapter 10
	of the Khoros Programmer's Manual.

	For becoming familiar with the source configuration of Khoros,
        the imake system, the tools available for compiling Khoros programs,
	adding new routines to existing libraries, creating new libraries,
	creating new programs, and maintaining Khoros on multiple architectures,
	you want Chapter 9 of the Khoros Programmer's Manual.

	Either of these chapters may be printed using the "prnmanual" program.


    ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~~ ~ ~ ~ ~ ~
    ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~~ ~ ~ ~ ~ ~

   Q36. How does one selectively fix a program and recompile it without doing
        the whole installation process again?

   A36. The process will differ if the fix is to a library on which the 
	program depends, or to the program itself.

	Case 1: Fix is to a library on which the program depends.

	a1) In the case that the fix involves adding a new file to the 
            library, copy the new file to the library.  Then execute "imkmf",
	    followed by "make Makefile".

        a2) In the case that the fix involves over-writing an old file with a 
            new, bug-fixed file, it is generally wise to make a backup copy
            of the old file before you over-write it.  

	 b) Now, execute, "make depend", followed by "make install".  
	    This recompiles the library.

	 c) Finally, you must recompile the program(s) which depend on the
            library.  

	    In some cases, there will be only one program that is affected.  
	    For example, if the fix was in the IPL library, the DSPL library,
	    or the File Formats library, it is likely that the fix will only 
	    affect one program.  Find the directory in which the program is
	    located, and recompile it using, "make install".

	    In the case of the xvdisplay, xvforms, xvgraphics, and xvutils
	    libraries,  all xvroutines will be affected.  
	    Go to $KHOROS_HOME/src/xvroutines and execute, "make install".

	    In other cases, the fix to the library may affect every program in
	    the Khoros system.  This will be the case with fixes to the 
	    verror, vexpr, vgparm, vmath, vrast, and vutils libraries.  
	    After making a fix to one of these libraries, it is best to go to 
	    $KHOROS_HOME/src, and do "installit" again.


	Case 2: the fix is to the program itself

	In this case, simply find the program in the KHOROS_HOME source tree.

	a1) In the case that the fix involves adding a new file to the 
            program, copy the new file to the program directory.  
	    Then execute "imkmf", followed by "make Makefile".

        a2) In the case that the fix involves over-writing an old file with a 
            new, bug-fixed file, it is generally wise to make a backup copy
            of the old file before you over-write it.  

	 a) Now, execute, "make depend", followed by "make install".  
	    This recompiles and installs the program.

    ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~~ ~ ~ ~ ~ ~
    ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~~ ~ ~ ~ ~ ~

   Q37. When I try to compile dzresp, dfilter, mat2viff, etc., I get 
        unresolved symbols for _dspl_parse, _format_parse, and _vexpr_parse.
        Where do I find these routines?

   A37. The problem you are experiencing is the result of using GNU's version
        of the program 'sed'.  What you need to do is change your path so
        that /bin/sed or /usr/bin/sed are used and then do the following:

        cd $KHOROS_HOME/src/Lib/vexpr
        make clean
        cd $KHOROS_HOME/src/dspl/Lib
        make clean
        cd $KHOROS_HOME/src/file_formats/Lib
        make clean
        cd $KHOROS_HOME/src
        make install