1, sudoapt-getinstallncurses-dev2, sudoapt-getinstallbison3, sudoapt-getinstallflex4, sudoapt-getinstallbuild-essential5, modify gcc version, the default is 4.4.5, this version is too high, changed to 3.4.6 under
1. sudo apt-get install ncurses-dev
2. sudo apt-get install bison
3. sudo apt-get install flex
4. sudo apt-get install build-essential
5. Modify the gcc version. The default value is 4.4.5. This version is too high and changed to 3.4.6.
Download the deb installation package. The downloaded package is:
Gcc-3.4-base_3.4.6-6Ubuntu3_i386.deb,
Gcc-3.4_3.4.6-6ubuntu3_i386.deb,
Cpp-3.4_3.4.6-6ubuntu3_i386.deb,
G ++-3.4 _ 3.4.6-6ubuntu3_i386.deb,
Libstdc ++ 6-dev_3.4.6-6ubuntu3_i386.deb
For: http://archive.ubuntu.com/ubuntu/pool/universe/g/gcc-3.4/
6. Create a new directory and copy the deb package into it. My is/mnt/share/gcc-3.4.6.
Next, execute the following command in this directory:
Root@www.linuxidc.com:/mnt/share/gcc-3.4.6 # dpkg-I *. deb
Check the installation result as follows:
Root@www.linuxidc.com:/mnt/share/gcc-3.4.6 # ls/usr/bin/gcc *
/Usr/bin/gcc/usr/bin/gcc-3.4/usr/bin/gcc-4.4/usr/bin/gccbug-3.4
7. Added options for gcc3.4.6 and gcc4.4.5.
Root@www.linuxidc.com:/mnt/share/gcc-3.4.6 # update-alternatives -- install/usr/bin/gcc/usr/bin/gcc-4.4 40
Root@www.linuxidc.com:/mnt/share/gcc-3.4.6 # update-alternatives -- install/usr/bin/gcc/usr/bin/gcc-3.4 30
8. Switch version to gcc-3.4
Root@www.linuxidc.com:/mnt/share/gcc-3.4.6 # update-alternatives -- config gc
There are 2 choices for the alternative gcc (providing/usr/bin/gcc ).
Select the path priority status
------------------------------------------------------------
* 0/usr/bin/gcc-4.4 40 automatic mode
1/usr/bin/gcc-3.4 30 manual mode
2/usr/bin/gcc-4.4 40 manual mode
To maintain the current value [*], press the Enter key or enter the selected number: 1 (manually enter the default value to be selected, enter 1, and set the default value to version 3.4)
9. view the current gcc version
The root@www.linuxidc.com:/mnt/share/gcc-3.4.6 # gcc-v
Reading specs from/usr/lib/gcc/i486-linux-gnu/3.4.6/specs
Configured :.. /src/configure-v -- enable-ages = c, c ++, f77, pascal -- prefix =/usr -- libexecdir =/usr/lib -- with-gxx-include-dir =/usr/include/c ++/3.4 -- enable-shared -- with-system -zlib -- enable-nls -- without-receivded-gettext -- program-suffix =-3.4 -- enable-_ cxa_atexit -- enable-clocale = gnu -- enable-libstdcxx-debug --- tune = pentium4 i486-linux-gnu
Thread model: posix
Gcc version 3.4.6 (Ubuntu 3.4.6-6ubuntu3)