From: CRDGW2::CRDGW2::MRGATE::"SMTP::PREP.AI.MIT.EDU::HELP-G++-REQUEST" 6-FEB-1992 15:42:04.35 To: ARISIA::EVERHART CC: Subj: Installing gcc,g++,libg++ on DEC MIPS Ultrix From: help-g++-request@prep.ai.mit.edu@SMTP@CRDGW2 To: Everhart@Arisia@MRGATE Received: by crdgw1.ge.com (5.57/GE 1.122) id AA12752; Thu, 6 Feb 92 15:09:21 EST Received: by life.ai.mit.edu (4.1/AI-4.10) id AA21633; Wed, 5 Feb 92 15:35:25 EST Return-Path: Received: from news.cis.ohio-state.edu by life.ai.mit.edu (4.1/AI-4.10) id AA21609; Wed, 5 Feb 92 15:34:55 EST Received: by news.cis.ohio-state.edu (5.61-kk/5.911008) id AA26883; Wed, 5 Feb 92 15:30:51 -0500 Received: from USENET by news.cis.ohio-state.edu with netnews for help-g++@prep.ai.mit.edu (help-g++@prep.ai.mit.edu); contact usenet@news.cis.ohio-state.edu if you have questions. To: help-g++@prep.ai.mit.edu Date: 5 Feb 92 20:19:23 GMT Message-Id: <1992Feb5.201923.23751@nic.unh.edu> Organization: University of New Hampshire From: pas@anchor.unh.edu (Paul A Sand) Sender: help-g++-request@prep.ai.mit.edu Subject: Installing gcc,g++,libg++ on DEC MIPS Ultrix Every so often, there are questions in these newsgroups about installing gcc, g++, or libg++ on DEC Ultrix MIPS systems. I usually mail if I think I can help, but the last person (Bernd Hentig) asked for an article. SO, in hopes this will help some others... Disclaimer: the following steps "work for me", but due to unforeseen circumstances they may not work for you. When I say they "work for me", you should understand this to mean no more than "nobody here has complained that gcc and g++ don't work." (As noted in the documentation debugging via -g mostly doesn't work on the MIPS architecture in this version. If you need that, ftp to foobar.cs.colorado.edu and get pub/Gnu-For-Pmax/srl-gcc2-alpha.tar.Z; therein are executables that may do the trick for you.) All of the hard stuff below was done by clever folks at other places, and I've tried to credit them properly. If you see minor or major mistakes, please let me know. Hopefully, the steps outlined below are clear. Text preceded by a '--' are comments. I use some csh-style "foreach" loops, I assume you can translate if necessary. Here we go: (1) ftp files from pub/gnu on prep.ai.mit.edu: gcc-1.40.tar.Z, g++-1.40.3.tar.Z, and libg++-1.39.0.tar.Z; put them into an empty directory on a filesystem with a lotta room (about 57 Meg if you don't delete things during installation). You should have flex (I think?), bison, and patch installed. (2) Unpack: forach guy (*.Z) zcat $guy | tar xpf - rm $guy end (3) gcc-1.40 installation: cd gcc-1.40 config.gcc decstation make -- got warnings on c-parse.tab.c: ccom: Warning: ccdir/c-parse.y, line 2557: Shift of 24 is > object size of 16 ccom: Warning: ccdir/c-parse.y, line 2559: Shift of 24 is > object size of 16 -- got similar warnings on fold-const.c: ccom: Warning: fold-const.c, line 83: Shift of 24 is > object size of 16 ccom: Warning: fold-const.c, line 84: Shift of 24 is > object size of 16 make stage1 make CC=stage1/gcc CFLAGS="-g -O -Bstage1/" make stage2 make CC=stage2/gcc CFLAGS="-g -O -Bstage2/" -- Replace the ecoff-cmp script with the following ref: gnu.gcc.bug article <9110251553.AA11063@mamba.psc.edu> from lambert@mamba.psc.edu (Michael H. Lambert) ================= #!/bin/sh # # ecoff-cmp file1.o file2.o # ld -s -L -o /tmp/foo1.$$ $1 2>1 > /dev/null ld -s -L -o /tmp/foo2.$$ $2 2>1 > /dev/null tail +10c /tmp/foo1.$$ > /tmp/foo3.$$ tail +10c /tmp/foo2.$$ > /tmp/foo4.$$ cmp /tmp/foo3.$$ /tmp/foo4.$$ rm -f /tmp/foo[1234].$$ =================== foreach file (*.o) ecoff-cmp $file stage2/$file end -- shouldn't be any output from the above. -- now su make install make includes -- now un-su -- and we're done. (4) g++-1.40.3 installation: rehash cd .. -- (to where we un-tar'ed everything) ln -s gcc-1.40 gcc mkdir gcc-test -- [Step (1) of Installation] mkdir g++ cd g++ -- [Step (2)] ln -s ../g++-1.40.3/* . -- apply patches to files as specified in gnu.g++.bug article <9111012146.AA08228@decadent.bellcore.com> from mcintosh@decadent.bellcore.com (Allen Mcintosh) These patches are in the file 'g++.patch'. patch < g++.patch Here is g++.patch: ================== RCS file: RCS/gcc.c,v retrieving revision 1.1 diff -c -r1.1 gcc.c *** /tmp/,RCSt1a08192 Fri Nov 1 16:34:40 1991 --- gcc.c Fri Nov 1 16:13:28 1991 *************** *** 80,85 **** --- 80,86 ---- This allows config.h to specify part of the spec for running as. %l process LINK_SPEC as a spec. %L process LIB_SPEC as a spec. + %G process LIBG_SPEC as a spec. A capital G is actually used here. %S process STARTFILE_SPEC as a spec. A capital S is actually used here. %c process SIGNED_CHAR_SPEC as a spec. %C process CPP_SPEC as a spec. A capital C is actually used here. *************** *** 188,193 **** --- 189,199 ---- #define LIB_SPEC "%{!p:%{!pg:-lc}}%{p:-lc_p}%{pg:-lc_p}" #endif + /* config.h can define LIBG_SPEC to override the default debug libraries. */ + #ifndef LIBG_SPEC + #define LIBG_SPEC "%{g:-lg}" + #endif + /* config.h can define STARTFILE_SPEC to override the default crt0 files. */ #ifndef STARTFILE_SPEC #define STARTFILE_SPEC \ *************** *** 317,329 **** char *link_spec = "%{!c:%{!M*:%{!E:%{!S:ld -r -o %g.R %l\ %{A} %{d} %{e*} %{N} %{n} %{r} %{s} %{S} %{T*} %{t} %{u*} %{X} %{x} %{z}\ %{y*} %{!nostdlib:%S} \ ! %{L*} %o %{!nostdlib:-lg++ gnulib%s %{g:-lg} %L}\n }}}}"; #else /* Here is the spec for running the linker, after compiling all files. */ char *link_spec = "%{!c:%{!M*:%{!E:%{!S:ld %{o*} %l\ %{A} %{d} %{e*} %{N} %{n} %{r} %{s} %{S} %{T*} %{t} %{u*} %{X} %{x} %{z}\ %{y*} %{static:} %{!nostdlib:%S %{pg:gccrt0.o%s}%{!pg:ccrt0.o%s}} \ ! %{L*} %o %{!nostdlib:-L%r -lg++ gnulib%s %{g:-lg} %L}\n }}}}"; #endif /* Accumulate a command (program name and args), and run it. */ --- 323,335 ---- char *link_spec = "%{!c:%{!M*:%{!E:%{!S:ld -r -o %g.R %l\ %{A} %{d} %{e*} %{N} %{n} %{r} %{s} %{S} %{T*} %{t} %{u*} %{X} %{x} %{z}\ %{y*} %{!nostdlib:%S} \ ! %{L*} %o %{!nostdlib:-lg++ %G gnulib%s %L}\n }}}}"; #else /* Here is the spec for running the linker, after compiling all files. */ char *link_spec = "%{!c:%{!M*:%{!E:%{!S:ld %{o*} %l\ %{A} %{d} %{e*} %{N} %{n} %{r} %{s} %{S} %{T*} %{t} %{u*} %{X} %{x} %{z}\ %{y*} %{static:} %{!nostdlib:%S %{pg:gccrt0.o%s}%{!pg:ccrt0.o%s}} \ ! %{L*} %o %{!nostdlib:-L%r -lg++ %G gnulib%s %L}\n }}}}"; #endif /* Accumulate a command (program name and args), and run it. */ *************** *** 1329,1334 **** --- 1335,1344 ---- case 'L': do_spec_1 (LIB_SPEC, 0); + break; + + case 'G': + do_spec_1 (LIBG_SPEC, 0); break; case 'p': RCS file: RCS/collect.c,v retrieving revision 1.1 diff -c -r1.1 collect.c *** /tmp/,RCSt1a08215 Fri Nov 1 16:35:23 1991 --- collect.c Fri Nov 1 16:12:39 1991 *************** *** 38,43 **** --- 38,44 ---- in the table. Destructors are called in the reverse order of the way they lie in the table. */ + #define COLLECT #include "config.h" int target_flags; /* satisfy dependency in config.h */ *************** *** 76,82 **** /* * provide stubs for various things in tm-mips.h */ - enum mips_sections cur_section; int inside_function = 0; int num_source_filenames = 0; void print_options() { return; }; --- 77,82 ---- *************** *** 89,94 **** --- 89,100 ---- exit(1); } void pic_label_is_global () {return;}; + void + mips_asm_file_start (stream) + FILE *stream; + { + asm_out_data_file = asm_out_text_file = stream;/* may not be necessary */ + } #endif #ifndef ASM_OUTPUT_INT_CONST RCS file: RCS/Makefile,v retrieving revision 1.1 diff -c -r1.1 Makefile *** /tmp/,RCSt1a08220 Fri Nov 1 16:35:47 1991 --- Makefile Fri Nov 1 16:11:57 1991 *************** *** 216,224 **** # gnulib is not a target because a proper installation of GNU CC # will place it where g++ can find it. Same with cpp ! all: init_files gnulib g++ cc1plus g++filt $(LD) # collect crt0+.o # On COFF systems, use the target below. ! # all: g++ cc1plus init_files collect gnulib # crt0+.o crt1+.o doc: $(srcdir)/cpp.info $(srcdir)/g++.info --- 219,227 ---- # gnulib is not a target because a proper installation of GNU CC # will place it where g++ can find it. Same with cpp ! #all: init_files gnulib g++ cc1plus g++filt $(LD) # collect crt0+.o # On COFF systems, use the target below. ! all: g++ cc1plus init_files collect gnulib g++filt # crt0+.o crt1+.o doc: $(srcdir)/cpp.info $(srcdir)/g++.info *************** *** 295,301 **** $(CC) -o ld++ -g $(PROFILE) ld.o cplus-dem.o collect: collect.c config.h $(LIBDEPS) ! COLLECT_LIBS="-lld"; \ if cmp -s tm.h config/tm-encore.h; then \ COLLECT_OPTIONS='-DUMAX'; \ else \ --- 298,304 ---- $(CC) -o ld++ -g $(PROFILE) ld.o cplus-dem.o collect: collect.c config.h $(LIBDEPS) ! COLLECT_LIBS=""; \ if cmp -s tm.h config/tm-encore.h; then \ COLLECT_OPTIONS='-DUMAX'; \ else \ *************** *** 302,308 **** COLLECT_OPTIONS=''; \ fi; \ $(CC) -o collect $(PROFILE) $$COLLECT_OPTIONS $(CFLAGS) $(COFFLAGS) \ ! $(INCLUDES) collect.c -lg -lc $$COLLECT_LIBS collect3: collect3.c $(CC) -o $@ collect3.c -DPREFIX="\"$(prefix)\"" \ --- 305,311 ---- COLLECT_OPTIONS=''; \ fi; \ $(CC) -o collect $(PROFILE) $$COLLECT_OPTIONS $(CFLAGS) $(COFFLAGS) \ ! $(INCLUDES) collect.c -lc $$COLLECT_LIBS collect3: collect3.c $(CC) -o $@ collect3.c -DPREFIX="\"$(prefix)\"" \ *************** *** 347,353 **** gccrt0.o: init_main.h init_main.c init.c init_libs.c $(CC) $(CFLAGS) $(INCLUDES) -g -o $@ $(FORMAT) -DGPROF -c ccrt0.c ! DUMMIES = _init_start _init_end _ctor_list _dtor_list _dl gnulib: dummy.c -rm -f tmpgnulib gnulib --- 350,357 ---- gccrt0.o: init_main.h init_main.c init.c init_libs.c $(CC) $(CFLAGS) $(INCLUDES) -g -o $@ $(FORMAT) -DGPROF -c ccrt0.c ! #DUMMIES = _init_start _init_end _ctor_list _dtor_list _dl ! DUMMIES = _init_start _init_end _dl gnulib: dummy.c -rm -f tmpgnulib gnulib ================== -- I found it necessary to edit the Makefile further, to wit: uncomment COFFLAGS = -DUSE_COLLECT -DEXTENDED_COFF set LD=collect set CC=gcc set prefix=/usr/local -- [Step (4)] make maketest -- [step (5)] config.g++ decstation make -- got four warnings: "cplus-decl.c:2425: warning: argument passing between incompatible pointer types" "toplev.c:2066: warning: assignment between incompatible pointer types" "collect.c:76: warning: NO_UNDERSCORES redefined" "cplus-dem.c:212: warning: assignment of pointer from integer lacks a cast" -- also numerous queries about overriding protections (answered 'y') -- now su make install -- now de-su (5) libg++-1.39.0 installation: rehash cd ../libg++-1.39.0 vi Makefile -- set PWD= ... whatever directory you're in ... -- set prefix=/usr/local -- set PIPE_AS= -- in the files: src/File.cc src/filebuf.cc src/Filebuf.cc change #include to: #define _POSIX_SOURCE #include #undef _POSIX_SOURCE -- in gperf/src/main.cc: change "time_t" to "long" on line 39 -- in gperf/src/std-err.cc change line 57 from for (va_start (argp, format); *format; format++) to (honest) va_start(argp, format); for ( ; *format ; format++) make src -- many many many warnings, nothing fatal make tests -- also many warnings, nothing fatal -- diffs give "expected" (random) differences make etc -- many many warnings -- su make install -- more warnings -- de-su make run_etc -- tests seem OK (6) That's it. Good luck. -- -- Paul A. Sand | Disclaimer: -- University of New Hampshire | It's Digital's fault. -- pas@kepler.unh.edu |