1

I am on Ubuntu 14.04.2 32 bit platform and I have gcc 4.8.4 installed. I want to build old version of gcc (2.95.3) to compile older version of linux kernel. I tried to follow this gcc-2.95.3 and this gcc-2.95.3-64 (though the latter instructs how to build 32 bit of gcc in 64 bit host, it seems helpful but didn't work) guides but I failed to build it. Is there a way to compile it in my current distro?

EDIT: Here is the error message I get using ./configure --prefix=/usr/local/gcc --sysconfdir=/etc and make bootstrap If I don't use bootstrap flag I get more errors before reaching below errors. Below error messages are from gcc-2.95.1

Making info file `cpp.info' from `./cpp.texi'.
./cpp.texi:2041: Unknown command `sam'.
./cpp.texi:2041: Misplaced {.
./cpp.texi:2041: Misplaced }.
./cpp.texi:2041: Unmatched }.
./cpp.texi:361: Node `Include Operation''s Next field not pointed back to.
./cpp.texi:421: This node (`Once-Only') is the one with the bad `Prev'.
./cpp.texi:815: Next reference to nonexistent node `Nonstandard Predefined'.
./cpp.texi:802: `Standar Predefiined' has an Up field of `Predefined', but `Predefined' has no menu item for `Standar Predefiined'.
./cpp.texi:998: Prev reference to nonexistent node `Standard Predefined'.
./cpp.texi:802: `Nonstanard Preddefined' has an Up field of `Predefined', but `Predefined' has no menu item for `Nonstanard Preddefined'.
./cpp.texi:1366: Next reference to nonexistent node `Macro Parentheses'.
./cpp.texi:1398: Node `Macro Prenthesees''s Next field not pointed back to.
./cpp.texi:1475: This node (`SwallowSemicoloon') is the one with the bad `Prev'.
./cpp.texi:1398: Node `Macro Prenthesees's Prev field not pointed back to.
./cpp.texi:1366: This node (`Misnesting') has the bad Next.
./cpp.texi:1342: `Macro Prenthesees' has an Up field of `Macro Pitfalls', but `Macro Pitfalls' has no menu item for `Macro Prenthesees'.
./cpp.texi:1475: Node `SwallowSemicoloon''s Next field not pointed back to.
./cpp.texi:1538: This node (`Side Effects') is the one with the bad `Prev'.
./cpp.texi:1342: `SwallowSemicoloon' has an Up field of `Macro Pitfalls', but `Macro Pitfalls' has no menu item for `SwallowSemicoloon'.
./cpp.texi:1342: `Argumen Prescann' has an Up field of `Macro Pitfalls', but `Macro Pitfalls' has no menu item for `Argumen Prescann'.
./cpp.texi:1812: Next reference to nonexistent node `Newline in Argss'.
./cpp.texi:1850: Node `Newlines in Args's Prev field not pointed back to.
./cpp.texi:1812: This node (`Cascaded Macros') has the bad Next.
./cpp.texi:1911: Node `Conditinal Usess' missing Up field.
./cpp.texi:1944: Next reference to nonexistent node `Deleted ode'.
./cpp.texi:1944: Prev reference to nonexistent node `Conditioal Usess'.
./cpp.texi:1959: Next reference to nonexistent node `#else Diective.'.
./cpp.texi:2018: Node `#else Directive' missing Up field.
./cpp.texi:2039: Node `#elif Directive' missing Up field.
./cpp.texi:2086: Node `Deleted Code' missing Up field.
./cpp.texi:2107: Node `Conditionals-Macros' missing Up field.
./cpp.texi:2208: Next reference to nonexistent node `#error Directive'.
./cpp.texi:2208: Prev reference to nonexistent node `Conditioals-Maccros'.
./cpp.texi:2338: Node `#error irectivee' missing Up field.
./cpp.texi:71: `Other Drectivess' has an Up field of `Top', but `Top' has no menu item for `Other Drectivess'.
./cpp.texi:2435: Cross reference to nonexistent node `Standard Predefined'.
./cpp.texi:2360: Cross reference to nonexistent node `Nonstandard Predefined'.
./cpp.texi:1956: Menu reference to nonexistent node `#elif Diective.'.
./cpp.texi:1955: Menu reference to nonexistent node `#else Diective.'.
./cpp.texi:1908: Menu reference to nonexistent node `#error Directive'.
./cpp.texi:1906: Menu reference to nonexistent node `Conditioals-Maccros'.
./cpp.texi:1905: Menu reference to nonexistent node `Deleted ode'.
./cpp.texi:1903: Menu reference to nonexistent node `Conditioal Usess'.
./cpp.texi:1360: Menu reference to nonexistent node `Argument Prescan'.
./cpp.texi:1355: Menu reference to nonexistent node `Swallow Semicolon'.
./cpp.texi:1353: Menu reference to nonexistent node `Macro Parentheses'.
./cpp.texi:1148: Cross reference to nonexistent node `Swallow Semicolon'.
./cpp.texi:812: Menu reference to nonexistent node `Nonstandard Predefined'.
./cpp.texi:811: Menu reference to nonexistent node `Standard Predefined'.
./cpp.texi:128: Menu reference to nonexistent node `Other Directives'.
./cpp.texi:815: warning: unreferenced node `Standar Predefiined'.
./cpp.texi:998: warning: unreferenced node `Nonstanard Preddefined'.
./cpp.texi:1398: warning: unreferenced node `Macro Prenthesees'.
./cpp.texi:1911: warning: unreferenced node `Conditinal Usess'.
./cpp.texi:2018: warning: unreferenced node `#else Directive'.
./cpp.texi:2039: warning: unreferenced node `#elif Directive'.
./cpp.texi:2086: warning: unreferenced node `Deleted Code'.
./cpp.texi:2338: warning: unreferenced node `#error irectivee'.
makeinfo: Removing output file `cpp.info' due to errors; use --force to preserve.
make[2]: *** [cpp.info] Error 2
  • 2
    can you give details on what you have done and how it failed? – Nathan McCoy May 21 '15 at 17:08
  • Is installing a virtualization package (virtualbox/kvm/vmware) an option? Would use that to install the last LTS release that ran that specific gcc version. The ISOs will probably still be somewhere around. – JdeHaan May 21 '15 at 17:33
  • @son_of_fire What I tried listed in the links. I get /gcc/cpp.texi:363: Unknown command like errors. – kenn May 21 '15 at 20:41
  • @JdeHaan I ll give a try live.iso or VM options if I don't get working solutions here – kenn May 21 '15 at 20:43
  • 1
    Do you really need GCC 2.95.x? glibc dropped support for that years ago, and uses extensions in standard headers that break with GCC 2. GCC 3.3 compiles, installs and runs without much of a problem on modern systems. If you do really need GCC 2, you'll need to install two versions of glibc side-by-side as well, your current version (overwriting that with an old version would break pretty much everything), and the old version installed in a non-standard location. But if the old version is installed in a non-standard location, you then need to patch GCC 2 to find it. It's probably not worth it. – hvd May 21 '15 at 21:59
3

You'll have a hard time building such an old version of gcc on a modern system... The errors you've copied are from texinfo, which is no longer compatible with the documentation included in gcc 2.95.

You can try installing binaries straight from http://snapshot.debian.org/package/gcc-2.95/2.95.4.ds15-27/; installing cpp-2.95 and gcc-2.95 from there will give you C support without touching your existing installation of gcc. To get C++ support you'd need g++-2.95 and the libraries; I haven't checked to see how well they'd install on a modern system.

  • Thank you for your practical answer. It's easier than running a VM. – kenn May 22 '15 at 11:59
1

I've just finished installing gcc-3.4.6 and gcc-2.95.3 on Ubuntu 14.04 using the steps from the following tutorial. It doesn't make much sense for me to post the steps here because you also need to download some patch files from that page.

For both compilations I had to add -D_FORTIFY_SOURCE=0 to the CFLAGS in all the Makefile from the gcc build directory and its subfolders that contain other Makefiles.

I needed to first install gcc-3.4.6 and then use it to build gcc-2.95.3. To do that you need to set CC=/opt/x86_64/gcc/gcc-3.4.6/bin/gcc in the Makefiles of gcc-2.95.3.

Additionally, I also had to copy the following files from the source directory of glibc-2.10.1 to the gcc-2.95.3/glibc-workaround/ directory created by the commands on the tutorial page:

  • bits/libc-lock.h
  • sys/param.h
  • _G_config.h

To fix the error message from the question above: I commented out all the sections of the Makefiles of gcc-2.95.3 that compiled or installed texinfo or cpp.info.

  • Thank you posting an answer. I am glad, you proved that example in the link works. As I pointed out in my question, I failed to build it by that tutorial. I am on Ubuntu 14.04.2 32 bit platform. Do you think 32 bit architecture makes any difference? – kenn Jun 28 '15 at 17:39
  • I suspect that a 32-bit platform would make a bit of a difference in the path names, but nothing that is a show-stopper. Regarding the error you posted: it was indeed not addressed in the tutorial. I basically had to comment out a bunch of stuff related to cpp.info and texinfo from the Makefiles. – Benny Jun 28 '15 at 18:25
  • I will give another attempt to it then post the result tomorrow. – kenn Jun 28 '15 at 21:11
0

You will need to compile the older version of gcc from source and give it a different destination directory with the prefix option.

./configure --prefix=/usr/local/gcc

I think the gcc configure will allow you to use your existing /etc.

./configure --prefix=/usr/local/gcc --sysconfdir=/etc
  • Thank you for your post Jeight. I already tried that. I get lots of errors, I fixed some of them but it's beyond my coverage. That's why I ask for help here. – kenn May 21 '15 at 20:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.