OKlibrary  0.2.1.6
Gcc.hpp File Reference

Documentation on how to build Gcc. More...

Go to the source code of this file.


Detailed Description

Documentation on how to build Gcc.

Installing Gcc

On the purpose of Gcc

Gcc is a compiler collection:

  • For the OKlibrary it provides the main C++ and the main C compiler (called "g++" and "gcc").
  • Some external sources also use the Fortran compiler (called "gfortran").

An existing system-wide installation of gcc is a prerequisite for using the OKlibrary (mainly for building external sources).

  • However, for compiling the sources of the OKlibrary we need full control over the version used.
  • And so by default here the local installation (provided by the OKlibrary) is used.
  • For normal usage of the OKlibrary, the user does not need to care about this local installation, but the masterscript "oklib" handles everything.

What the installation yields

  • Executables
    1. the C++ compiler g++
    2. the C compiler gcc
  • Link libraries (mostly not explicitely used)
  • Source libraries (mostly not explicitely used)
  • Documentation.

Since different compiler versions might have different trade-offs, the OKlibrary supports the installation and usage of different versions of gcc.

Usage

Calling g++ or gcc is straightforward, however the executables need also to know how to link to the gcc-libraries:

  • On Linux systems, dynamic linking is standard, and so by default the link-paths are not hard-coded into the executables.
  • Since the OKlibrary tries to avoid making system-wide changes, just using the provided g++ or gcc will compile the code, but the code in general will not run.
  • So the executables g++ and gcc are not provided in the public OKlibrary/bin directory.
  • The usage within the OKlibrary is completely handled by the masterscript oklib, and so the user normally does not need to be concerned with the usage of gcc.

Current state of installation

  • System gcc
    • gcc-program call = gcc
    • ready: MAYBE
      • location = /usr/bin/gcc
      • version = Linux)
  • System g++
    • g++-program call = g++
    • ready: MAYBE
      • location = /usr/bin/g++
      • version = Unknown
  • Local gcc (provided by the OKlibrary) in recommend version 4.7.3

How to install

Some general remarks:

  • Only local installation currently (through the OKlibrary).
  • For building gcc always the system gcc is used.

Make targets

gcc Build the recommended gcc-version.
cleangcc Remove the build-directory regarding the recommended gcc-version.
cleanallgcc Remove all build-, installation- and documentation-directories for all gcc-versions.

Configuration

  • To install a different version of Gcc, set variable gcc_recommended_version_number_okl accordingly.
  • By default, languages c,c++,fortran,java,objc are compiled; for a different choice set variable gcc_enable_languages_okl.
  • By default, the thread-model is posix; for a different choice set variable gcc_threads_okl.
  • Other default configuration options are --enable-shared --enable-multilib; for a different choice set variable gcc_other_options_okl.

Definition in file Gcc.hpp.