From: Ralph Becker-Szendy (ralph@falcon.SLAC.Stanford.EDU)
Date: 04/20/93


From: ralph@falcon.SLAC.Stanford.EDU (Ralph Becker-Szendy)
Subject: [Q] Problems compiling Xlife   (Beginner)
Date: Tue, 20 Apr 1993 07:31:55 GMT

Hi all, Linux has been up and running for over a week now, X is up,
and I hit the first snag: Xlife won't compile.

Details: Standard SLS Linux, with disk series A, B, C and X unpacked.
Standard Xlife-2.0 from the contrib directory on export.lcs.mit.edu;
unpacks with no problem. Xmkmf fails, because it can't find /lib/cpp.
Try to create /lib/cpp by making it a softlink to gcc, but then gcc
fails. Presumably linux.cf or site.def would have to be adjusted.
Question: Are these configuration files correct as shipped with SLS,
or should I attempt update them? I don't know the first thing about
Imake, and only little about make. Could it be the the Imake file
shipped with Xlife is wrong? It looks fine (no #'s) to me, no visible
system-dependencies. Is there more to do than say xmkmf (without
parameters) in the correct directory?

Since neither the makefile nor the Imakefile were any help, I just
changed what had to be changed in the source code (one path has to be
fixed in defs.h), compiled all the .c files by hand, simply by
   gcc -c main.c a.c b.c ...
and so on, and linked them with
   cpp -o Xlife -lX11 -lXext -lm main.o a.o b.o ...
The only problem is that Linux's unistd.h contains a definition of
link (extern int link __P and so on), which conflicts with something
called link in the Xlife source. I fixed that by renaming the object
in Xlife to xllink, which worked.

No problem, the executable is generated, it even starts and creates
the window, but dies with a segmentation fault on the first keystroke
in the Xlife window. In order to make sure that the method is not
horribly flawed, I repeated the exact same manual compile-and-link
procedure under AIX and SunOS, and in both cases it creates a
perfectly functional executable which even works right (which proves
that makefiles are not really necessary). By the way, I have 16MB of
swap space, and xsysinfo shows that there is spare swapspace left, so
I'm not just running out of memory.

Then I thought the problem could be the jump-table libraries, so I
recompiled everything with the -static flag. Now the problem is that
it doesn't link, presumably because one has to use different
libraries, presumably those are libX11.sa and so on. However, gcc
can't find those if one specifies them as -lX11.sa; so I ended up
linking with
   gcc -o Xlife -lm main.o a.o b.o c.o ... /usr/lib/libX11.sa ...
Although this at least doesn't give error messages, the
resulting executable dies immediately with a segmentation fault. I
could find no recipe in the gcc manpage or in the Linux and SLS FAQ's
for how to correctly compile with static libraries.

No, I don't know how to use gdb (yet), so I didn't try to find out
where the segmentation fault occurs. Nor do I know how to read core
files (and would prefer not having to learn that).

Question: Why does xmkmf fail? Do I have to adjust something first?
How is the c-preprocessor set up for imake? How does one link with
static libraries? Has someonw tried to compile xlife before? Where
should I have looked to find all this information without bothering
the net? And thanks for any help.

-- 
Ralph Becker-Szendy                                 RALPH@SLAC.STANFORD.EDU
Stanford Linear Accelerator Center                      RALPH@SLACVM.BITNET
M.S. 95, P.O. Box 4349, Stanford, CA 94309                    (415)926-2701
My opinion. This is not SLAC, Stanford U, or the US DoE speaking. Just me.