SUMMARY: compiling ghostview AND the missing alloca problem

From: Larry Chin (larry@cchtor.cch.com)
Date: Wed Oct 27 1993 - 06:42:05 CDT


Greetings:

Well at long last I have managed to compile ghostview under SunOs 4.1.3 and
I have also solved the problem of the missing alloca in the libc that is
stock with SunOs.

Okay so first:

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

Problems compiling ghostview under SunOs

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

The problem with compiling ghostview was that there were certain
required functions that were not contained in SunOs X libraries, but
were contained in the X11R5 libraries.

Hence, to compile ghostview required a mix of /usr/openwin/lib
libraries and the X11R5 libraries. The libraries from the X11R5
release that are needed are the Xt and Xmu libraries.

To get around the problem of different programs needing different
libraries ( ie: X11R5 programs and openwin programs ) I simply linked
all the libraries into /usr/local/lib as suggested by question #8 of
the sun-managers.faq.

The only caveat being that both X11 and openwindows have certain
libraries with the same major.minor number.

In these cases I decided to give openwin libraries preference UNLESS
programs required something that was not present in them but that was
present in the X11 libraries, in which case I linked the latter to
/usr/local/lib.

After all that is said and done, I then changed my LD_LIBRARY_PATH to
read:
        /usr/local/lib:/usr/openwin/lib:/usr/lib.

This, so that when the program starts, ld.so will find the X11
libraries as well as openwindows libraries ( the ones that do not
conflict in major.minor numbers ) AS WELL AS any other libraries that
it might need from openwindows or SunOs. Failing to do this causes
ld.so to complain about not finding the correct version of a library
and then the program bombs.

Thanks for inut into the ghostview problem go to:

Andy Mitchell <afm@ufnmr1.health.ufl.edu>
"Michael (M.A.) Meystel" <MEYSTMA%DUVM.BITNET@pucc.Princeton.EDU>
"John Strupp" <strupp@geronimo.drad.umn.edu>
zdv123@zam092.zam.kfa-juelich.de (V.Sander)
zdv123@zam092.zam.kfa-juelich.de (V.Sander)
Ian.Daniel@xerox.fr (Ian Daniel)
David Fetrow <fetrow@biostat.washington.edu>
bill@hopless (Bill McSephney )
irene@ntep.tmg.nec.co.jp (Irene Bermiso)
frankm@shadow.cna.tek.com (Frank 'Scruffy' Miller)
perryh@pluto.rain.com (Perry Hutchison)
steve@gec-epl.co.uk (Steve_Kilbane)
eckhard@ts.go.dlr.de (Eckhard Rueggeberg)
philb@cats.ucsc.edu
twhitely@tr1072.to.ford.com (Ted Whitely)
philb@cats.ucsc.edu
mdk@lochness.uhc.com (Mike Kail)
gpr@proteon.com (Gary Richardson)
Mike D. Kail <mdk@lochness.uhc.com>
Mike D. Kail <mdk@lochness.uhc.com>
poland@cam8.gsfc.nasa.gov (Jim Poland)
isaacsl@pluto.crd.ge.com (Lisa Isaacs)
brian@arthur.melpar.esys.com (Brian Decker)
Mike D. Kail <mdk@lochness.uhc.com>
pag@scg.boulder.co.us (Peter Gross)
msteed@tfs.COM (Martin N. Steed)
Paul Mickel <mickel@oes.orst.edu>
pallas@oclc.org (George Pallas)
louie@seismo.unr.edu (John Louie)
Duane.Mun@EBay.Sun.COM (Duane T. Mun)
Martin Achilli <ACHILLM@IMIHSRA.BITNET>
Juergen Rothenanger <unrz57@rzsuna.rrze.uni-erlangen.de>
cariapa@brahms.amd.com (Sandeep Cariapa)
carl@oversteer.library.uwa.edu.au (Carl Brewer)
BOESSENKOOL@stpc.wi.leidenuniv.nl (BOESSENKOOL)
john@oncology.uthscsa.edu (John Justin Hough)
stpeters@spare-parts.crd.ge.com (Dick St.Peters)
raoul@MIT.EDU (Nico Garcia)
Snowman <elekokws@ee.nus.sg>

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

To the problem of the missing alloca in libc.

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

There is a workaround for this which is to put the line:

        #include <alloca.h>

into your program source. Apparently

        "the compiler plays tricks with alloc() to deal with RISC
        architecture and redefines alloca to be __builtin_alloca"
        
        - Guntram Wolski.

However after trying this ( and finding it did not work ) I discovered
that the source for ghostview was not responsible for calling alloca,
but it was libXt.a from the X11R5 that was calling it.

Hence the solution was simply in the libXt makefile, to put in a
-DINCLUDE_ALLOCA_H which is picked up by the Xtos.h and the alloca.h is
compiled into the libXt library.

So basically to get around the problem of ld complaining about a
missing alloca symbol simply put the above include line into the proper
source file.

Thanks for input to the alloca problem go to:

kevin@uniq.com.au (Kevin Sheehan {Consulting Poster Child})
Mitchum DSouza <m.dsouza@mrc-applied-psychology.cambridge.ac.uk>
Dan Stromberg - OAC-DCS <strombrg@hydra.acs.uci.edu>
gwolsk@seismic.sei.com (Guntram Wolski)
glenn@uniq.com.au (Glenn Satchell - Uniq Professional Services)
David Comay <dsc@seismo.CSS.GOV>
billr@saab.cna.tek.com (Bill Randle)
jonathan ross <cjross@BBN.COM>
poffen@San-Jose.ate.slb.com (Russ Poffenberger)
Mei.Fan@Corp.Sun.COM (Mei Fan)



This archive was generated by hypermail 2.1.2 : Fri Sep 28 2001 - 23:08:26 CDT