Path: utzoo!attcan!uunet!world!decwrl!wuarchive!uwm.edu!bionet!arisia!roo!gerson From: gerson@parc.xerox.com (Dan Gerson) Newsgroups: comp.lang.c++ Subject: Compiling NIHCL with Sun's C++ 2.0 Message-ID: Date: 8 Oct 90 22:57:53 GMT Sender: news@parc.xerox.com Distribution: comp Organization: Xerox PARC, Palo Alto, CA Lines: 61 Given the notes that Keith Gorlen kindly posted here a few days ago, I was able to make NIHCL compile using Sun's version of the AT&T C++ 2.0 translator. However, I did run across a few problems which I thought I would post in case it might help others doing the same. (This is on a Sun-4 using SunOS 4.0.3) 1) NIHCL attempts to install the error facility into libC.a. However, under Sun's C++, libC.a is rarely used since normally the shared libraries (libC.so.* etc) are used instead. The symptom is that when you try to compile anything using NIHCL, such as the nihcltest or examples, ld complains that it can't find various error symbols. To fix this, you either have to tell ld to do a static link instead of a dynamic link (the default), or else you have to put the error facility elsewhere. I did the latter, which meant either playing around with test/MAKEFILE, vectest/MAKEFILE, and ex/MAKEFILE to find the library (since LFLAGS are not passed down from Makefile), or else installing the error facility in both libnihcl.a and libnihclmi.a. Since I don't expect to be using the error facility outside of NIHCL, I choose to put it in the nihcl libraries. This makes me happier than modifying libC.a. (I suppose you could try to add the error facility to the shared libraries, but that is a pain for various reasons.) I would suggest changing the various makefile scripts to honor CLIBDIR and LIB_ID when linking the tests and examples. 2) Related to this, NIHCL by default puts the error include files in /usr/include/CC. If you change this, as you should if you put the error facility someplace other than in libC, you have to not only update ERRINCDIR, but also add the include file to the "I" list. Which is fine, except that you have to add the second file with a -I prefix and modify Makefile and test/MAKEFILE to do I="${I}" instead of I=${I}. 3) If you change any of the other error facility locations (which we do in general since in our system's configuration /usr/local... is local to the workstation, and things such as the NIHCL libraries are placed on our file servers on paths such as /import/CC/local/include etc.), even if you leave the libC installation alone, you need to modify the Makefile to do: errorfacility: cd ${ERRFAC}; \ ${MAKE} -f MAKEFILE ${MFLAGS} ${COMMONFLAGS} \ ERRGENDIR=${ERRGENDIR} ERRTABDIR=${ERRTABDIR} ERRINCDIR=${ERRINCDIR} cd ${ERRFAC}; \ ${MAKE} -f MAKEFILE ${MFLAGS} install ${COMMONFLAGS} \ ERRGENDIR=${ERRGENDIR} ERRTABDIR=${ERRTABDIR} ERRINCDIR=${ERRINCDIR} \ CLIBDIR=${CLIBDIR} LIB_ID=${LIB_ID} Otherwise, it was not propagating the ERRGENDIR etc bindings down in the first make. Probably some of these bindings aren't needed, I didn't bother to think much here. Then it should compile and test fine. If you don't mind modifying libC, you don't need to do all of the above, EXCEPT that you will then have to at least modify the makefiles to specify a ld flag of -Bstatic, and do this for all programs using NIHCL. -- Dan Gerson gerson@parc.xerox.com Xerox Palo Alto Research Center 415-494-4745 3333 Coyote Hill Road Palo Alto, CA 94304 USA