[comp.unix.ultrix] problem ld'ing the gnu "temacs" program under ultrix 4.1 -- solved

murphy@dccs.upenn.edu (L Murphy) (12/07/90)

In article <MURPHY.90Dec4171348@lam.dccs.upenn.edu>
murphy@dccs.upenn.edu (THAT'S ME!!!) writes:

   Enviroment: DECstation 3100 (MIPS) running
   ULTRIX V4.1 (Rev. 52)
   UWS V4.1 (Rev. 197)
   Making gnu emacs version 18.55

   config.h contains:
   #include "s-bsd4-3.h"
   #include "m-pmax.h"
   #define HAVE_X_WINDOWS
   #define X11

   Problem:
   ld fails when making temacs with this command:

   ld  -X -D 800000 -o temacs pre-crt0.o /lib/crt0.o \
	[...lots of other .o files here...]  alloca.o malloc.o   -lX11    -lc

   ld:
   /lib/libX11.a(XvmsAlloc.o): malloc: multiply defined
   /lib/libX11.a(XvmsAlloc.o): realloc: multiply defined
   /lib/libX11.a(XvmsAlloc.o): free: multiply defined
   *** Error code 1

   Stop.


Mark Litwack (a co-worker) pointed out the following section
from the Release notes for Ultrix 4.1, section 4.1.1.10, page 4-5:

QUOTE:
Memory Allocation Routines - Xlib defines its own internal versions of
malloc(), calloc(), free() and realloc() routines, which are also used
by the XUI Toolkit. [ ... ]  The malloc(), free(), realloc(), and
calloc() routines are define in XvmsAlloc.o in libX11.a.

[..deleted..]

Some popular public domain software packages define their own versions
of some of these memory allocation functions.  You can compile public
domain programs that define their own memory allocation functions
under ULTRIX/UWS Version 4.1 by doing one of the following:

*	Disable the package's version of the functions.  They
	typically have an option or flag you can set to request that
	the application use the system memory allocation functions.

*	Add function definitions for the functions not defined.
	Typically calloc is missing.  The calloc from libc, as
	described above [ I deleted that ], may be added.

*	Disable the functions in Xlib by removing the XvmsAlloc.o
	module from libX11.a.

ENDQUOTE

I chose the last option.  I figure I ought to use GNU Emacs' versions
of these memory allocation functions instead of the ones that are part
of the X11 library.

This is what I did:

I made a copy of /lib/libX11.a, deleted XvmsAlloc.o, then ranlib'ed
the new library:

% cp /lib/libX11.a /usr/local/lib/libX11-noalloc.a
% ar -d libX11-noalloc.a XvmsAlloc.o
% ranlib libX11-noalloc.a

I then edited the GNU distributed file called `src/ymakefile' to
say `-lX11-noalloc' instead of `-lX11' in the `LIBX=' statement.

_____________________________________________________________________________


Another problem I had with making GNU emacs under Ultrix 4.1 was that
in a few places GNU emacs expects an include file called `X11/X10.h'
to exist in one of the default system include directories.

It doesn't exist under Ultrix 4.1.  Instead, Ultrix 4.1 has a file
called /usr/include/mit/X11/X10.h.  I assumed that this was the file
that GNU Emacs intended to include (I don't really know for sure,
however).

I changed `<X11/X10.h>' to `<mit/X11/X10.h>' in the following files:

src/x11term.h
oldXMenu/XMenu.h
oldXMenu/XMenuInt.h




--lam

rusty@belch.Berkeley.EDU (Rusty Wright) (12/09/90)

In article <MURPHY.90Dec6164438@lam.dccs.upenn.edu> murphy@dccs.upenn.edu (L Murphy) writes:

   From: murphy@dccs.upenn.edu (L Murphy)
   Newsgroups: gnu.emacs,comp.unix.ultrix
   Date: 6 Dec 90 21:44:38 GMT
   Reply-To: murphy@dccs.upenn.edu
   Organization: DCCS, University of Pennsylvania

   (Stuff about problems compiling emacs with the DEC X11 libraries
   deleted.)

Unless you're writing code using the DECwindows libraries I'd
recommend just using setld and getting rid of the DEC X11 and
DECwindows libraries and get the X11 sources from MIT and use their
libraries.