STONE%GRIN1.BITNET@CUNYVM.CUNY.EDU ("Stone,John David") (02/02/89)
I have been working on installing version 1.32.0 of GNU C++ on a network of Sun-3 workstations under SunOS 4.0.1. I didn't encounter much trouble during installation, but the resulting compiler doesn't compile anything. Here's a small example. Suppose the file foo.c contains the following four lines: main() { int foo = 0; } I invoke the compiler with the command gauss% /usr/local/g++ -o foo foo.c and the compiler replies foo.c:2: parse error before `{' and quits. Preprocessing is successful; you can say gauss% /usr/local/g++ -E foo.c and get # 1 "foo.c" main() { int foo = 0; } The results of attempting a compilation vary a little from one source code file to another. Because we didn't receive either streams.h or stdio.h, I tried to adapt the SunOS stdio.h so as to try out a basic "Hello, world" program: #define BUFSIZ 1024 #define _SBFSIZ 8 extern struct _iobuf { int _cnt; unsigned char *_ptr; unsigned char *_base; int _bufsiz; short _flag; char _file; } _iob[]; #define _IOFBF 0 #define _IOREAD 01 #define _IOWRT 02 #define _IONBF 04 #define _IOMYBUF 010 #define _IOEOF 020 #define _IOERR 040 #define _IOSTRG 0100 #define _IOLBF 0200 #define _IORW 0400 #define NULL 0 #define FILE struct _iobuf #define EOF (-1) #define stdin (&_iob[0]) #define stdout (&_iob[1]) #define stderr (&_iob[2]) #define putc(x, p) (--(p)->_cnt >= 0 ?\ (int)(*(p)->_ptr++ = (unsigned char)(x)) :\ (((p)->_flag & _IOLBF) && -(p)->_cnt < (p)->_bufsiz ?\ ((*(p)->_ptr = (unsigned char)(x)) != '\n' ?\ (int)(*(p)->_ptr++) :\ _flsbuf(*(unsigned char *)(p)->_ptr, p)) :\ _flsbuf((unsigned char)(x), p))) #define putchar(x) putc((x),stdout) int puts (char* s) { int ch; while (ch = *s++) putchar(ch); return putchar('\n'); } main() { puts("Hello, world!\n"); } If this is in hello.c, then the compiler behaves as follows: gauss% /usr/local/g++ -o hello hello.c hello.c:5 Segmentation violation /usr/local/g++: Program c++ got fatal signal 11. In this case a core file is dumped, which ls -l reports as being of stupendous size: -rw-r--r-- 1 stonej 251913018 Feb 1 13:00 core Possibly some details about the installation will help. It took me three tries; the first one two failed at the point where c++ is linked, because I was using our standard SunOS C compiler instead of GNU CC, and the standard compiler was unable to locate the meaning of the symbol ___eprintf. (It took me two attempts to work this out; after the first attempt I misdiagnosed the problem as a consequence of my failure to create a symbolic link from /home/hilbert/gnu/gcc to /home/hilbert/gnu/gcc-1.32, which is the directory in which GNU CC got unpacked.) For the installation of GNU C++, tm.h was an edited version of gcc-1.32/tm-sun3.h in which all of the references to crt0.h were replaced with references to crt0+.h. The md file was gcc-1.32/m68k.md. The only change I made in the Makefile was to change the definition of CC to /usr/local/gcc. Here's a transcript of how the how the installation went. As we begin, gcc and bison have already been installed in /usr/local, which is on the search path. hilbert# mkdir /home/hilbert/gnu/g++ hilbert# cd !$ cd /home/hilbert/gnu/g++ hilbert# ln -s ../src-g++/* . hilbert# ln -s ../gcc-1.32/*.[chy] . ln: ./dbxout.c: File exists ln: ./expr.c: File exists ln: ./expr.h: File exists ln: ./flags.h: File exists ln: ./gcc.c: File exists ln: ./gnulib.c: File exists ln: ./integrate.c: File exists ln: ./print-tree.c: File exists ln: ./stmt.c: File exists ln: ./stor-layout.c: File exists ln: ./symout.c: File exists ln: ./symseg.h: File exists ln: ./toplev.c: File exists ln: ./tree.c: File exists ln: ./tree.h: File exists ln: ./varasm.c: File exists ln: ./version.c: File exists hilbert# ln -s ../gcc-1.32/*.def . ln: ./tree.def: File exists hilbert# ln -s ../gcc-1.32/*.md . hilbert# ln -s ../gcc-1.32/move-if-change . hilbert# sed -e /:crt0.o/s//:crt0+.o/ ../gcc-1.32/tm.h >../gcc-1.32/tm+.h hilbert# ln -s ../gcc-1.32/tm+.h tm.h ln: tm.h: File exists hilbert# rm tm.h hilbert# ln -s ../gcc-1.32/tm+.h tm.h hilbert# ln -s ../gcc-1.32/m68k.md md hilbert# ln -s ../gcc-1.32/output-m68k.c aux-output.c ln: aux-output.c: File exists hilbert# cd g++ g++: No such file or directory hilbert# make cc -g -DSOS -O -c -DSTANDARD_EXEC_PREFIX=\"/usr/local/lib/gcc-\" gcc.c cc: Warning: -O conflicts with -g. -O turned off. cc -g -DSOS -O -sun3 -c obstack.c cc: Warning: -O conflicts with -g. -O turned off. cc -g -DSOS -O -sun3 -c version.c cc: Warning: -O conflicts with -g. -O turned off. cc -g -o g++ gcc.o version.o -lg obstack.o -lc expect 49 shift/reduce conflicts and 4 reduce/reduce conflicts bison -v -d cplus-parse.y cplus-parse.y contains 4 useless nonterminals and 7 useless ruless. cplus-parse.y contains 49 shift/reduce conflicts and 4 reduce/reduce conflicts. cc -c -g -DSOS -O -DESKIT -DPARSE_OUTPUT=\"/home/hilbert/gnu/g++/cplus-parse.ou tput\" cplus-parse.tab.c cc: Warning: -O conflicts with -g. -O turned off. cc -g -DSOS -O -sun3 -c cplus-decl.c cc: Warning: -O conflicts with -g. -O turned off. cc -g -DSOS -O -sun3 -c cplus-typeck.c cc: Warning: -O conflicts with -g. -O turned off. cc -g -DSOS -O -sun3 -c cplus-lex.c cc: Warning: -O conflicts with -g. -O turned off. cc -g -DSOS -O -sun3 -c cplus-overload.c cc: Warning: -O conflicts with -g. -O turned off. cc -g -DSOS -O -sun3 -c cplus-class.c cc: Warning: -O conflicts with -g. -O turned off. "cplus-class.c", line 2731: warning: statement not reached "cplus-class.c", line 2945: warning: statement not reached cc -g -DSOS -O -sun3 -c cplus-init.c cc: Warning: -O conflicts with -g. -O turned off. cc -g -DSOS -O -sun3 -c cplus-method.c cc: Warning: -O conflicts with -g. -O turned off. cc -g -DSOS -O -sun3 -c cplus-convert.c cc: Warning: -O conflicts with -g. -O turned off. cc -g -DSOS -O -sun3 -c cplus-search.c cc: Warning: -O conflicts with -g. -O turned off. cc -c -g -DSOS -O -DSORRY_EXIT_CODE=35 toplev.c cc: Warning: -O conflicts with -g. -O turned off. cc -g -DSOS -O -sun3 -c tree.c cc: Warning: -O conflicts with -g. -O turned off. cc -g -DSOS -O -sun3 -c print-tree.c cc: Warning: -O conflicts with -g. -O turned off. cc -g -DSOS -O -sun3 -c stor-layout.c cc: Warning: -O conflicts with -g. -O turned off. cc -g -DSOS -O -sun3 -c fold-const.c cc: Warning: -O conflicts with -g. -O turned off. cc -g -DSOS -O -sun3 -c rtl.c cc: Warning: -O conflicts with -g. -O turned off. cc -g -DSOS -O -sun3 -c genflags.c cc: Warning: -O conflicts with -g. -O turned off. cc -g -DSOS -O -o genflags genflags.o rtl.o obstack.o cc: Warning: -O conflicts with -g. -O turned off. ./genflags md > tmp-insn-flags.h ./move-if-change tmp-insn-flags.h insn-flags.h insn-flags.h is unchanged cc -g -DSOS -O -sun3 -c gencodes.c cc: Warning: -O conflicts with -g. -O turned off. cc -g -DSOS -O -o gencodes gencodes.o rtl.o obstack.o cc: Warning: -O conflicts with -g. -O turned off. ./gencodes md > tmp-insn-codes.h ./move-if-change tmp-insn-codes.h insn-codes.h insn-codes.h is unchanged cc -g -DSOS -O -sun3 -c genconfig.c cc: Warning: -O conflicts with -g. -O turned off. cc -g -DSOS -O -o genconfig genconfig.o rtl.o obstack.o cc: Warning: -O conflicts with -g. -O turned off. ./genconfig md > tmp-insn-config.h ./move-if-change tmp-insn-config.h insn-config.h insn-config.h is unchanged cc -g -DSOS -O -sun3 -c expr.c cc: Warning: -O conflicts with -g. -O turned off. cc -g -DSOS -O -sun3 -c stmt.c cc: Warning: -O conflicts with -g. -O turned off. cc -g -DSOS -O -sun3 -c expmed.c cc: Warning: -O conflicts with -g. -O turned off. cc -g -DSOS -O -sun3 -c explow.c cc: Warning: -O conflicts with -g. -O turned off. cc -g -DSOS -O -sun3 -c optabs.c cc: Warning: -O conflicts with -g. -O turned off. cc -g -DSOS -O -sun3 -c varasm.c cc: Warning: -O conflicts with -g. -O turned off. cc -g -DSOS -O -sun3 -c symout.c cc: Warning: -O conflicts with -g. -O turned off. cc -g -DSOS -O -sun3 -c dbxout.c cc: Warning: -O conflicts with -g. -O turned off. cc -g -DSOS -O -sun3 -c sdbout.c cc: Warning: -O conflicts with -g. -O turned off. cc -g -DSOS -O -sun3 -c emit-rtl.c cc: Warning: -O conflicts with -g. -O turned off. cc -g -DSOS -O -sun3 -c genemit.c cc: Warning: -O conflicts with -g. -O turned off. cc -g -DSOS -O -o genemit genemit.o rtl.o obstack.o cc: Warning: -O conflicts with -g. -O turned off. ./genemit md > tmp-insn-emit.c ./move-if-change tmp-insn-emit.c insn-emit.c insn-emit.c is unchanged cc -g -DSOS -O -c insn-emit.c cc: Warning: -O conflicts with -g. -O turned off. "insn-emit.c", line 1601: warning: statement not reached cc -g -DSOS -O -sun3 -c integrate.c cc: Warning: -O conflicts with -g. -O turned off. cc -g -DSOS -O -sun3 -c jump.c cc: Warning: -O conflicts with -g. -O turned off. cc -g -DSOS -O -sun3 -c cse.c cc: Warning: -O conflicts with -g. -O turned off. cc -g -DSOS -O -sun3 -c loop.c cc: Warning: -O conflicts with -g. -O turned off. cc -g -DSOS -O -sun3 -c flow.c cc: Warning: -O conflicts with -g. -O turned off. cc -g -DSOS -O -sun3 -c stupid.c cc: Warning: -O conflicts with -g. -O turned off. cc -g -DSOS -O -sun3 -c combine.c cc: Warning: -O conflicts with -g. -O turned off. cc -g -DSOS -O -sun3 -c regclass.c cc: Warning: -O conflicts with -g. -O turned off. cc -g -DSOS -O -sun3 -c local-alloc.c cc: Warning: -O conflicts with -g. -O turned off. cc -g -DSOS -O -sun3 -c global-alloc.c cc: Warning: -O conflicts with -g. -O turned off. cc -g -DSOS -O -sun3 -c reload.c cc: Warning: -O conflicts with -g. -O turned off. cc -g -DSOS -O -sun3 -c reload1.c cc: Warning: -O conflicts with -g. -O turned off. cc -g -DSOS -O -sun3 -c genpeep.c cc: Warning: -O conflicts with -g. -O turned off. cc -g -DSOS -O -o genpeep genpeep.o rtl.o obstack.o cc: Warning: -O conflicts with -g. -O turned off. ./genpeep md > tmp-insn-peep.c ./move-if-change tmp-insn-peep.c insn-peep.c insn-peep.c is unchanged cc -g -DSOS -O -c insn-peep.c cc: Warning: -O conflicts with -g. -O turned off. cc -g -DSOS -O -sun3 -c final.c cc: Warning: -O conflicts with -g. -O turned off. cc -g -DSOS -O -sun3 -c recog.c cc: Warning: -O conflicts with -g. -O turned off. cc -g -DSOS -O -sun3 -c genrecog.c cc: Warning: -O conflicts with -g. -O turned off. cc -g -DSOS -O -o genrecog genrecog.o rtl.o obstack.o cc: Warning: -O conflicts with -g. -O turned off. ./genrecog md > tmp-insn-recog.c ./move-if-change tmp-insn-recog.c insn-recog.c insn-recog.c is unchanged cc -g -DSOS -O -c insn-recog.c cc: Warning: -O conflicts with -g. -O turned off. cc -g -DSOS -O -sun3 -c genextract.c cc: Warning: -O conflicts with -g. -O turned off. cc -g -DSOS -O -o genextract genextract.o rtl.o obstack.o cc: Warning: -O conflicts with -g. -O turned off. ./genextract md > tmp-insn-extract.c ./move-if-change tmp-insn-extract.c insn-extract.c insn-extract.c is unchanged cc -g -DSOS -O -c insn-extract.c cc: Warning: -O conflicts with -g. -O turned off. cc -g -DSOS -O -sun3 -c genoutput.c cc: Warning: -O conflicts with -g. -O turned off. cc -g -DSOS -O -o genoutput genoutput.o rtl.o obstack.o cc: Warning: -O conflicts with -g. -O turned off. ./genoutput md > tmp-insn-output.c ./move-if-change tmp-insn-output.c insn-output.c insn-output.c is unchanged cc -g -DSOS -O -c insn-output.c cc: Warning: -O conflicts with -g. -O turned off. cc -g -o c++ cplus-parse.tab.o # ... a very long line here ld: Undefined symbol ___eprintf *** Error code 1 make: Fatal error: Command failed for target `c++' hilbert# ln -s ../gcc-1.32 ../gcc hilbert# make ./genflags md > tmp-insn-flags.h ./move-if-change tmp-insn-flags.h insn-flags.h insn-flags.h is unchanged ./gencodes md > tmp-insn-codes.h ./move-if-change tmp-insn-codes.h insn-codes.h insn-codes.h is unchanged ./genconfig md > tmp-insn-config.h ./move-if-change tmp-insn-config.h insn-config.h insn-config.h is unchanged ./genemit md > tmp-insn-emit.c ./move-if-change tmp-insn-emit.c insn-emit.c insn-emit.c is unchanged ./genpeep md > tmp-insn-peep.c ./move-if-change tmp-insn-peep.c insn-peep.c insn-peep.c is unchanged ./genrecog md > tmp-insn-recog.c ./move-if-change tmp-insn-recog.c insn-recog.c insn-recog.c is unchanged ./genextract md > tmp-insn-extract.c ./move-if-change tmp-insn-extract.c insn-extract.c insn-extract.c is unchanged cc -g -DSOS -O -o genoutput genoutput.o rtl.o obstack.o cc: Warning: -O conflicts with -g. -O turned off. ./genoutput md > tmp-insn-output.c ./move-if-change tmp-insn-output.c insn-output.c insn-output.c is unchanged cc -g -o c++ cplus-parse.tab.o # ... a very long line here ld: Undefined symbol ___eprintf *** Error code 1 make: Fatal error: Command failed for target `c++' hilbert# cp Makefile Makefile.original hilbert# ed Makefile 14927 /CC/ #This file is part of GNU CC. // #GNU CC is distributed in the hope that it will be useful, // #unless he says so in writing. Refer to the GNU CC General Public // #GNU CC, but only under the conditions described in the // #GNU CC General Public License. A copy of this license is // #supposed to have been given to you along with GNU CC so you // CC = cc s/cc/\/usr\/local\/gcc CC = /usr/local/gcc w 14939 q hilbert# make ./genflags md > tmp-insn-flags.h ./move-if-change tmp-insn-flags.h insn-flags.h insn-flags.h is unchanged ./gencodes md > tmp-insn-codes.h ./move-if-change tmp-insn-codes.h insn-codes.h insn-codes.h is unchanged ./genconfig md > tmp-insn-config.h ./move-if-change tmp-insn-config.h insn-config.h insn-config.h is unchanged ./genemit md > tmp-insn-emit.c ./move-if-change tmp-insn-emit.c insn-emit.c insn-emit.c is unchanged ./genpeep md > tmp-insn-peep.c ./move-if-change tmp-insn-peep.c insn-peep.c insn-peep.c is unchanged ./genrecog md > tmp-insn-recog.c ./move-if-change tmp-insn-recog.c insn-recog.c insn-recog.c is unchanged ./genextract md > tmp-insn-extract.c ./move-if-change tmp-insn-extract.c insn-extract.c insn-extract.c is unchanged ./genoutput md > tmp-insn-output.c ./move-if-change tmp-insn-output.c insn-output.c insn-output.c is unchanged /usr/local/gcc -g -o c++ cplus-parse.tab.o # ... a very long line here ld: /usr/local/lib/gcc-gnulib: warning: table of contents for archive is out of date; rerun ranlib(1) /usr/local/gcc -Um68k -g -c crt0.c crt0.c: In function start1: crt0.c:426: warning: `start1' was declared implicitly `extern' and later `static ' mv crt0.o crt0+.o /usr/local/gcc -Um68k -g -c crt1.c mv crt1.o crt1+.o /usr/local/gcc -Dmc68020 -DSUN3=3 -DTARGET=SUN3 -c -g -DSOS -O ld.c -DDEFAULT_ SEARCH_PREFIX=\"/usr/local/lib\" /usr/local/gcc -o ld++ ld.o -lg -lc ld: /usr/local/lib/gcc-gnulib: warning: table of contents for archive is out of date; rerun ranlib(1) hilbert# make install ./genflags md > tmp-insn-flags.h ./move-if-change tmp-insn-flags.h insn-flags.h insn-flags.h is unchanged ./gencodes md > tmp-insn-codes.h ./move-if-change tmp-insn-codes.h insn-codes.h insn-codes.h is unchanged ./genconfig md > tmp-insn-config.h ./move-if-change tmp-insn-config.h insn-config.h insn-config.h is unchanged ./genemit md > tmp-insn-emit.c ./move-if-change tmp-insn-emit.c insn-emit.c insn-emit.c is unchanged ./genpeep md > tmp-insn-peep.c ./move-if-change tmp-insn-peep.c insn-peep.c insn-peep.c is unchanged ./genrecog md > tmp-insn-recog.c ./move-if-change tmp-insn-recog.c insn-recog.c insn-recog.c is unchanged ./genextract md > tmp-insn-extract.c ./move-if-change tmp-insn-extract.c insn-extract.c insn-extract.c is unchanged ./genoutput md > tmp-insn-output.c ./move-if-change tmp-insn-output.c insn-output.c insn-output.c is unchanged if [ -f c++ ] ; then install c++ /usr/local/lib/gcc-c++ ;fi install g++ /usr/local/bin mkdir /usr/local/lib/g++-include chmod ugo+rx /usr/local/lib/g++-include if [ -f ld++ ] ; then install ld++ /usr/local/lib/gcc-ld++ ;fi if [ -f crt0+.o ] ; then install crt0+.o /usr/local/lib/crt0+.o ;fi if [ -f crt1+.o ] ; then install crt1+.o /usr/local/lib/crt1+.o ;fi hilbert# ls /usr/local/bin g++ hilbert# mv /usr/local/bin/g++ /usr/local/g++ hilbert# ls /usr/local/lib bison.hairy emacs gcc-c++ gcc-include max bison.simple font gcc-cc1 gcc-ld++ vtbuttons crt0+.o forth gcc-cpp icon vtbuttons.edt crt1+.o g++-include gcc-gnulib lw hilbert# rcp /usr/local/g++ euler:/usr/local hilbert# rcp /usr/local/g++ gauss:/usr/local hilbert# rcp -r /usr/local/lib/g++-include euler:/usr/local/lib hilbert# rcp -r /usr/local/lib/g++-include gauss:/usr/local/lib hilbert# rcp -r /usr/local/lib/gcc-c++ euler:/usr/local/lib hilbert# rcp -r /usr/local/lib/gcc-c++ gauss:/usr/local/lib hilbert# rcp -r /usr/local/lib/crt* euler:/usr/local/lib hilbert# rcp -r /usr/local/lib/crt* gauss:/usr/local/lib hilbert# rcp -r /usr/local/lib/gcc-ld++ euler:/usr/local/lib hilbert# rcp -r /usr/local/lib/gcc-ld++ gauss:/usr/local/lib As this record shows, I did run into a couple of difficulties, but they shouldn't have been fatal: The README file directed me to cd into the g++ subdirectory on two different occasions, only the first of which was necessary or possible. Our version of the software came without a version of tm-sun3.h that referred to crt0+.o; I edited in the references to it using sed. Any suggestions? John Stone stone@grin1.bitnet