From: schultz@halley.est.3m.com (John C. Schultz)
Newsgroups: comp.soft-sys.khoros
Subject: Compiling Khoros Sun4 sunos4.1.1 gcc, sharable libraries
Date: 17 Apr 92 03:49:09 GMT
Article-I.D.: halley.SCHULTZ.92Apr16224743
Distribution: comp
Organization: 3M Company, 3M Center, Minnesota, USA


Well I think I finally got Khoros Patch 5 to compile on my sun 4 using
sharable libraries (not extensively tested yet, I was so excited/relieved).  I
did have to make the following patches to the indicated files (i.e.  A46 in
FAQ is not correct).

/src/xvroutines/cantata/Form.c line 141
static WidgetClass viewportWidgetClass = (WidgetClass)&viewportClassRec;

/src/xvroutines/Lib/xvutils/Form.c, line 136
static WidgetClass formWidgetClass = (WidgetClass)&formClassRec;

/src/xvroutines/Lib/xvutils/Label.c line 142
static WidgetClass labelWidgetClass = (WidgetClass)&labelClassRec;
----------------------------------------------------------------------

In sun.cf I also set

#define HaveSunPatchedLd NO            /* if YES, cannot do shared libraries */
#define HasSaberC	  NO		/* for machines that have it */
#define UseTiff YES
#define HasGcc YES
#define UseFile		YES
#define UseSockets	YES
#define UseSharedMem	YES
#define UseSunVirMem	NO
#define UsePipes	YES
#define UseStream	YES
#define UseSunRPC	NO
#define UseKTLI		NO
#define UseApolloRPC	NO
#define HasFortran NO


even though I am at SunOS 4.1.1 and have the native ld (also gcc-ld) link
editor.
----------------------------------------------------------------------
I retrieved and compiled gcc 2.1 before my apparently successful attempt. I
already had the latest versions of gcc-as and gcc-ld.  GCC 2.1 seemed to make
the difference (or possibly it was gcc-ld). (ftp from prep.ai.mit.edu /pub/gnu)

Khoros, referring to the make.World file, does not seem to use gcc for
compiling all files but seems to use it for the xvroutines and for
linking.  Why????

Reviewing my previous attempts as possibly valuable for others, my using the
sun C compiler did not link some routines like minvert or any of the
xvroutines, complaining about

Undefined
_dlsym
_dlopen
_dlclose

In my attempts to solve this, I had experimented with explicit calls to ld
such as:

ld -o animate animate.o  create.o  form_info.o  form_init.o  lanimate.o  run_animate.o  run_file.o  run_options.o  -L/bran/Khoros/lib -L/usr/lang/SC1.0.1  -Bstatic -ldisplay  -lxvplot  -lgraphics  -lxvforms  -lxvutils  -lghost  -lvexpr  -lnum_anal  -ldspl  -lformat  -lgeo_surf  -lvipl  -lvutils  -lvmath  -lvrast  -lvgparm  -lverror  -ltiff  -lm -ll  -lXaw -lXmu -lXt -lXext -lX11   

However while the command would successfully complete, the executable would
immediately core dump.

I thought some people might be interested in the size of the executables using
shared libraries however - roughly 1/4 the size the precompiled binary
distribution.

  -rwxr-xr-x  1 schultz    106496 Apr 16 19:18 animate
  -rwxr-xr-x  1 schultz    262144 Apr 16 19:23 cantata
  -rwxr-xr-x  1 schultz    155648 Apr 16 19:25 composer
  -rwxr-xr-x  1 schultz    163840 Apr 16 19:27 conductor
  -rwxr-xr-x  1 schultz    204800 Apr 16 19:30 editimage
  -rwxr-xr-x  1 schultz     73728 Apr 16 17:59 vadd


Something I also found in the unsuccessful attempts to get Khoros to compile
is that the fortran to c converter f2c (ftp from research.att.com) seems to
produce compilable C code for the fortran sections of Khoros.  At least I did
not see any compilation errors during those attempts.  Of course during those
attempts my executables ALL core dumped :-) I will try f2c again later.


Good luck.  This took me 2 calendar weeks of effort.  I think I got Andrew
compiled faster!
--
   John C. Schultz   +1 (612) 733-4047   schultz@halley.serc.3m.com
   How to include the taste of Glendronach in a multi-media system?