Recent changes Random page
GAMING
Technology
 
Gaming
Entertainment
Science Fiction
Biggest wikis
Hobbies
Music
See more...

How to install GCC 4.3.0

From Cygwin Wiki

Jump to: navigation, search

The GCC version in Cygwin distribution is 3.4.4-3, which is very outdated. This article describes how to upgrade it to 4.3.0.

Contents

[edit] Prerequisities

Check that you have following packages under Cygwin

  • bash
  • binutils
  • bzip2 (version 1.0.2 or later)
  • gcc-core (or any other C compilier)
  • gcc-ada (any version; needed only if you want to install Ada compilier)
  • gzip (version 1.2.4 or later)
  • m4
  • make (version 3.79.1 or later)
  • either gcc-java (only jar command is needed) or zip and unzip (needed ony if you want to install Java)

You may check their existence and version numbers with the following command:

   cygcheck -c bash binutils bzip2 gcc-core gcc-java  gzip m4 make unzip zip

If something is missing or outdated, download it from the Cygwin site (http://cygwin.com/setup.exe). You can find:

  • binutils, gcc-core, gcc-ada, gcc-java, and make in the Devel section,
  • m4 in the Interpreters section
  • bash and gzip in the Base section,
  • zip and unzip in the Archive section
  • bzip2 in the Utils section

[edit] Before installing anything

The make utility has -j option for parallel installation. Running it as

   make -j 2 ...

would significantly speed up the installation, especially if you have dual core processor. You may even specify -j more than 2 and get even faster installation (because CPU and CPU cores are idle during input-output, etc.).

If you have Spybot S&D, its TeaTimer.exe will slow down the installation. You may want to disable it or kill it in Task Manager for the time of installation.

[edit] How to install any package manually

In order to install any package, do the following:

  1. Download it to any directory (I use the directory /usr/local/contrib which I created for this purpose)
  2. Unpack it. Files whose extension is .bz2 are unpacked with bunzip2 command (i. e. bunzip2 gmp-4.2.2.tar.bz2). Files whose extension is .gz are unpacked with gunzip command (i. e. gunzip gmp-4.2.2.tar.gz).
  3. Open it with tar -xvf command (i. e. tar -xvf gmp-4.2.2.tar)
  4. Go to the directory where it was unpacked (i. e. cd gmp-4.2.2)
  5. Read the file called INSTALLATION.
  6. Run ./configure (this will check the configuration of your system)
  7. Run make (this will build everything)
  8. Run make check (optional but recommended; this will check that everything is correct)
  9. Run make install (this will install all the relevant files to the relevant directories)
  10. Run make clean (optional; this will erase intermediate files)


[edit] Installing GCC

  • Go to http://gmplib.org/, download and manually install GMP. GMP is library for arbitrary precision arithmetics. It is required for MFPR. Official GMP is old and does not work.
  • Go to http://mpfr.org/, download and manually install MPFR. It is a library for arbitrary precision floating-number arithmetics which produces exactly same results for any CPU or operating systems. It is required for GCC.
  • Go to http://gcc.gnu.org/mirrors.html, select a mirror (some don't work, so you possibly try 2-3 mirrors until you find a working one), and download gcc-4.3.0.tar.bz2. The file length should be 57932K. Then install it.
    • For GCC, it is recommended to create separate directory for destination (.o, .exe, .a etc.) files. Just do the following:
 mkdir Dst
 cd Dst
 ../configure
 make
 make install
    • The "make" step of this installation typically takes 4 hours. To speed it, you may want to replace make with make -j 2 or make -j 3, especially for computers with double core CPU.
    • You cannot perform the make check step; run make install immediately after make. This is because make check requires autogen which requires libguile which requires libtool. If you would try to install libtool, guile, and autogen, then you will see that guile (v 1.8.4) has some problems (fails 2 tests of 64) and autogen (v 5.9.4) does not work (fails 18 tests of 20).
Rate this article:
Share this article: