From: sauer@chama.eece.unm.edu (Tom Sauer)
Newsgroups: comp.soft-sys.khoros
Subject: UPDATED FAQ_compile
Date: 28 Sep 92 17:13:46 GMT
Article-I.D.: pprg.40656

Hi all,

We have made yet more changes to the Compile FAQ. Sorry for so many versions,but
we will get it right one of these days.


Thanks,

Tom




        FREQUENTLY ASKED QUESTIONS ABOUT COMPILING KHOROS

				date last updated: Sept 25, 1992
					           Sept 28, 1992
						      fixed A3, A6, A9

                ( Please Read!  Please Redistribute! )

        Contents:  Questions 1 - 28

                   * 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.  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}?.

Q2.  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}?.
 
Q3.  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}?.
     
	-----  compiling with shared libraries -----

Q4.  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?

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

Q6.  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

Q7.  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}'

Q8.  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.


Q9.  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?


Q10. 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 -----

Q11. Can I compile Khoros with X11R5?

Q12. 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) -----

Q13. 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?

Q14. 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

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

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

Q17. 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 -----

Q18. 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

Q19. 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 -----

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

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

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

Q23. 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?

Q24. 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 -----

Q25. I seem to be having some trouble getting Khoros working on our Sun 3.
     I have tried executing the journal playbacks, and every one of
     them gives me the error "ld.so: libXaw.so.4: not found".

Q26. 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

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

Q28. During the compile of Khoros, I get this error message:
     cc -c -0 -Bstatic -I/usr/da0/bruce/khoros/include -I/usr/openwin/incluD


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

----------  installing Khoros on various architectures ----------

   Q1.  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}?.

   A1.  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)


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

    Q2.  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}?.
 
    A2.  (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.


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

    Q3.  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}?.
     
    A3.  (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 can port to it.
         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/repos/config/imake_conf/hp.cf
	   and /khoros/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"; \		@@\

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

----------------  compile with shared libraries -------------------

   Q4.  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?

   A4a. 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. 

   A4b. 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.

   A4c. 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.

   A4d. 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"


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

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

   A5. 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.


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

   Q6.  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

   A6.  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
            #  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.


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


   Q7.  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}'

   A7.  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.

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

   Q8.  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.

   A8.  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.

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

   Q9. 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?

   A9. 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.

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

   Q10. 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

   A10. 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 --------------------

   Q11. Can I compile Khoros with X11R5?

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

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

   Q12. 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?

   A12. 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;


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

   Q12b. 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}'

   A12b. see Q7.

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


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

   Q13. 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?

   A13. 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.

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


    Q14. 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
 
    A14. 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)


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

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

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

	 % makemake
 
         To remake your Makefile.

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

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

    A16. 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.

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

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

   A17.  (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 -------------------


   Q18.  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'

   A18.  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


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

   Q19. 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

   A19. 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 -------------------

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

   A20. 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)

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

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

   A21. 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').  
 
    ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~~ ~ ~ ~ ~ ~

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

   A22. 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.

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

   Q23. 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?

   A23. (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.

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

   Q24.  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?

   A24.  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 -------------------

    Q25. I seem to be having some trouble getting Khoros working on our Sun 3. 
         I have tried executing the journal playbacks, and every one of
	 them gives me the error "ld.so: libXaw.so.4: not found".

    A25. (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.


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

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

    A26.  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.

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

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

     A27. The problem is that the bug is caused in the vgparm library,
          not in the cantata program code.  This bug is caused by
          optimization errors using -O on sun3.  It is necessary to
          recompile both programs and libraries with -O1.  To do this
          define the following 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".

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

   Q28.  During the compile of Khoros, I get this error message:
         cc -c -0 -Bstatic -I/usr/da0/bruce/khoros/include 
            -I/usr/openwin/include -DVFORK -DTEMPNAM -DPUTENV -DRANDOM 
            -DWAIT3    {file}.c
         /: write failed, file system is full
         compiler(iropt) error:  write_irfile: No space left on device

   A28.  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

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