Using Intel Compilers for Linux with Ubuntu

Navigation:

Linux and Mac OS X Compilers Installation Help Center: /en-us/articles/intel-compilers-linux-installation-help

First, determine your needs.  Most linux users are on 64bit systems with x86_64 versions of linux installed.  Do you need to create 32bit applications? In most cases all you care about are 64bit applications and binaries.  If you don't need to create 32bit binaries and applications this will eliminate your need to install 32bit libraries on the development system.

Ubuntu 14.04 and above

Ubuntu has deprecated the 32bit libraries.  Packages for 32bit development are nearly impossible to find.  YOU MUST INSTALL the Intel Compilers for 64bit Intel 64 ONLY.  
Run the installer for the Intel compiler package (if you have a Studio package, see below for more info)

At Step 5 of 7, select custom installation:

Step 5 of 7 | Options > Pre-install Summary
--------------------------------------------------------------------------------
Install location:
    /home/foo/intel/composer_xe_2013_sp1.3.174

Component(s) selected:
    Intel(R) C++ Compiler XE 14.0 Update 3                                 531MB
        Intel C++ Compiler XE                                                   

    Intel(R) Debugger 13.0                                                 477MB
        Intel Debugger                                                          

    Intel(R) Math Kernel Library 11.1 Update 3                             1.9GB
        Intel MKL core libraries                                                
        Intel(R) Xeon Phi(TM) coprocessor support                               
        Fortran 95 interfaces for BLAS and LAPACK                               
        GNU* Compiler Collection support                                        

    Intel(R) Integrated Performance Primitives 8.1 Update 1                2.8GB
        Intel IPP single-threaded libraries                                     

    Intel(R) Threading Building Blocks 4.2 Update 4                         77MB
        Intel TBB                                                               

    GNU* GDB 7.5                                                           119MB
        GNU* GDB 7.5 on Intel(R) 64 (Provided under GNU General Public License  
v3)
        GDB Eclipse* Integration on Intel(R) 64 (Provided under Eclipse Public  
License v.1.0)

Install Space Required:     5.6GB


1. Start installation Now [default]
2. Customize installation

h. Help
b. Back to the previous menu
q. Quit
--------------------------------------------------------------------------------
Please type a selection or press "Enter" to accept default choice [1]: 2

Then, at
Step 5 of 7 | Options > Architecture selection

Target Architecture(s) of your applications:
--------------------------------------------------------------------------------
1. [x]    IA-32
2. [x]    Intel(R) 64

3. Finish architecture selection [default]

Note: This system is an Intel(R) 64 architecture system.    
Your application may be built to run on either IA-32 or Intel(R) 64
architectures.

b. Back to the previous menu
q. Quit
--------------------------------------------------------------------------------
Please type a selection or press "Enter" to accept default choice [3]: 1

By selection "1" you DE-SELECT IA-32 packages and support.  Do this, de-select "IA-32" and continue with the installation.

INTEL STUDIO XE users:  you must download all component packages individually and install individually.  The Studio XE installer does not allow you to de-select 32bit packages.

For users of v13.0 (Composer 2013) and OLDER compilers:  First, determine your needs and get the right installation tarball.  Most linux users are on 64bit systems with x86_64 versions of linux installed.  Do you need to create older 32bit applications?  If not, download the Intel 64 ONLY tarball, the *_intel64.tgz package.  Not only does this save download time, this will eliminate your need to install 32bit libraries on the development system.
rev history:

November 2012:  Ubuntu 12.xx  and Intel 13.0.0.079 (Composer XE 2013 initial release)  URGENT, Installation will fail without a manual change

Ubu 12.0x changed the link for /bin/sh from /bin/bash to /bin/dash.  Intel installation scripts for 13.0.0.079 reference /bin/sh BUT assume/require this is bourne or bash (sh or bash) but are NOT compatible with dash.  To get around this problem, do the following before trying to install the Intel compiler:

As root user:

mv /bin/sh /bin/sh.orig
ln -s /bin/bash /bin/sh

Read the following information to continue to configure your system BEFORE you attempt an installation.
Following installation you are free to revert back to linking /bin/sh to /bin/dash if you so desire.

COMPATIBLE Linux Versions: Beta and recently released versions of Ubuntu may NOT be officially supported by Intel Compilers.  Please see your ReleaseNotes document with your compiler to find the supported Linux distributions and versions.  These instructions are merely to help install the compiler, keep in mind that versions of this linux distribution NOT in the ReleaseNotes document for your compiler version are NOT tested nor supported.

COMPATIBLE Intel Compiler Versions: In order to use Intel® Compilers (C++  or  Fortran) under the lastest release of Ubuntu, you will need newer versions of the Intel compiler(s).   Do NOT try to install older Intel Compilers such as 12.0, 11.x, 10.x, 9.x or 8.x under Ubuntu 12.xx or newer: they will not install easily and probably will not work - and they are NOT supported.  If you need an older Intel Compiler version, please read their ReleaseNotes and obtain an older, supported distribution (read this): http://software.intel.com/en-us/articles/older-version-product


Ubuntu 11.04 through Ubuntu 12.10  :
Composer XE  (aka version compiler versions 12.x and 13.x) prerequisites for Ubuntu Desktop, assuming that gcc and g++ are installed already:
apt-get install build-essential
apt-get install gcc-multilib
apt-get install rpm
apt-get install ia32-libs  (only needed if you install the 32bit compiler)
apt-get install openjdk-6-jre-headless

UMASK before you install:  If you will install as root or use sudo for the installation, check the umask setting for your root user:
#   umask
or
sudo bash ; umask

the value should be 0022.  If not, set it to 0022 so that the files you install are readable by non-root users:
umask 0022

INSTALLATION
untar the package tarball in a scratch directory such as /tmp.  tar -zxvf l_fcompxe_2013.x.yyy[_intel64 | _ia32].tgz
cd into the extracted directory
./install.sh and follow the instructions.


during the install, you can ignore any warnings about the missing Java prerequisite - it may not recognize openjdk-6-jre-headless.

And like below, IF you are installing OLDER compilers versions 11.1 or older, you will need to install libstdc++.so.5 libs (see below).


08 February 2011:  Ubuntu 10.10 and Compiler 12.x aka "Composer XE" notes:
The Intel compiler 12.0 aka Intel Fortran Composer XE 2011 no longer requires libstdc++-5.  It now uses libstdc++-6 which is present in newer Ubuntu distributions.  Please ignore the notes below for the step to install libstdc++5 UNLESS you have an earlier 11.1 or older compiler.

Read all the instructions below to install gcc, g++, build-essential, rpm etc.
IF you have to install Intel Fortran 11.1 or older, on Ubu 10.10
sudo apt-get install libstdc++5
ELSE
skip libstdc++5, your 12.x compiler uses libstdc++6
END IF


rev history:
29 April 2010:  This guide also applies to Ubuntu 10.04.
 

rev history: 
2009 November 3:  added notes for Ubuntu 9.10

Note: Newer versions of this linux distribution may NOT be officially supported by Intel Compiler Professional Editions 11.1.  Please see your ReleaseNotes document with your compiler to find the support Linux distributions and versions.  These instructions are merely to help install the compiler, keep in mind that versions of this distribution NOT in the ReleaseNotes document are NOT tested nor supported.  You are on your own here.

Introduction :


Using Intel® Compilers version 12.0 and 11.1 under Ubuntu (10.10, 10.04, 9.10, 9.04, 8.04 and 8.10) Desktop and Debian Desktop

For older Ubuntu and Debian versions, see THIS ARTICLE.  Make sure to use the latest Intel Compilers version.  Older compilers will not be compatible with the latest Ubuntu distributions.  For compatibility and supported versions always read the ReleaseNotes document for your compiler.

These notes apply to Ubuntu Desktop.  Ubuntu Server was not tested but should be similar.

2 November 2009:  Ubuntu 10.10, 10.04, and 9.10

For users of Ubuntu 10 and 9.10, follow the instructions here.  If you have 9.04 or older, skip ahead to the section titled "Ubuntu 9.04 and Older"

BEFORE YOU INSTALL Intel® Fortran for Linux or Intel® C++ for Linux on your fresh Ubuntu Desktop installation, you will first need to install several packages to prepare the system to serve as a development platform.  First, open a Terminal window and become root:
sudo bash
(type your user password)

At this point, you should have a root shell.  Test this with command 'whoami' which should return "root"

Check that gcc is installed. By default. Check this with:

gcc --version

It should return "gcc (Ubuntu 4.4.1-4ubuntu8) 4.4.1 (or some newer version - as long as it returns a version  you have gcc installed)

If, for some reason, you do not have gcc installed, use Synaptic Package Manager (under 'System' -> 'Administration' menus) OR use apt-get to install gcc:


apt-get install gcc


Next, install the 'build-essential' package and package g++. This is not installed by default. Again, use Synaptic Package Manager or apt-get :

apt-get install build-essential
apt-get install gcc-multilib

this should also install g++, but in test this with:
g++ --version

if g++ is not found, install it:

apt-get install g++

A few other packages are required:
apt-get install rpm
apt-get install ia32-libs    (this is only required on 64bit Ubuntu/Debian systems)

To use the Intel IDB graphical debugger, you will also need the Java JRE 5 or 6 installed.  One way to get this is through Synaptic package manager.  Open Synaptic and for sources enable Ubuntu's partner repository.  Once that is done, use Synaptic to fetch the package sun-java6-jre.

We also recommend fetching the Sun JRE directly from Sun: get the latest JRE from:

http://java.com/en/download/manual.jsp

OR you can use the OpenJDK from the distribution:

apt-get install openjdk-6-jre-headless

Next, Ubuntu 9.10 Desktop does not provide libstdc++5, which is required for the Intel Compilers.  You will have to get the package for libstdc++5 from an older Debian or Ubuntu distribution ( 9.04 for example ).  A repository is here:

http://packages.debian.org/stable/base/libstdc++5

On this page, you will see the title "The GNU Standard C++ Library V3".  Scrolling down, find the table for "Download libstdc++5".

9.10:  For 32bit Ubuntu i386 libstdc++5 Installation:
For 32bit  Ubuntu systems you will need to install the 32bit version of libstdc++5, that is, the "i386" package.
Select the download for the libstdc++5 package for "i386".  Pick a mirror site to begin the download.  If you are using Firefox, you will be prompted if you want to "Open with GDebi Package Installer" - select OK to continue.  Otherwise, save the deb package and use your favorite package manager to install.  Install the i386 libstdc++ deb package.  SKIP the Intel 64 Libstdc++5 (AMD64) directions below and find the section on installing the compiler after prerequisites are installed.


9.10: For Intel 64 / AMD64 (64bit Linux installation) Libstdc++5:
follow these instructions IF AND ONLY IF you have a 64bit Ubuntu installation. 

Intel 64 installation:  Select the download for the libstdc++5 package for "amd64".  If you are using Firefox, you will be prompted if you want to "Open with GDebi Package Installer" - select OK to continue.  Otherwise, save the deb package and use your favorite package manager to install.  Install the amd64 libstdc++ deb package.

by default, the 64bit libstdc++.so.5 library will install in /usr/lib which is linked to /usr/lib64. 

Now, you also will need the 32bit libstdc++.so.5 installed in /usr/lib32.  Unfortunately, the "i386" version of the libstdc++5 package wants to install in /usr/lib which is your 64bit library directory and where you just installed the "amd64" libraries - so you DON'T want to download and install the "i386" package into the default location. 
We'll need to download the "i386" package to a temporary directory, use dpkg to extract the contents to the temp directory, then manually copy the library to /usr/lib32 and create the symbolic link:

First, download libstc++5 package for "i386" - save to disk and do NOT launch a package manger to install it.  Save it in your 'Downloads' folder or /tmp (or any other scratch directory).
Using your root terminal window, cd to the directory where you have downloaded the .deb package, it should have a name similar to 'libstdc++5_3.3.6-18_i386.deb'.  The exact version is not important, but make sure it is a "i386" deb package.
Extract to the local directory:

dpkg --extract libstdc++5_3.3.6-18_i386.deb  ./

Notice that a 'usr/' folder was created and the package contents extracted here.  Now we'll copy the library to /usr/lib32

cd usr/lib
cp libstdc++.so.5.0.7 /usr/lib32
cd /usr/lib32
ln -s libstdc++.so.5.0.7 libstdc++.so.5


9.10: Installing the Compiler Now That Prerequisities are Installed (32 and 64bit):

Once you've completed the above, extract your compiler .tgz kit, cd to the compiler installation directory, and run ./install.sh

During the installation, you WILL get a warning message "Detected operating system Debian* (generic) is not supported", followed by
----------------------------------------------------------------- ---------------
Missing optional pre-requisite
-- operating system type is not supported.
-- system glibc or kernel version not supported or not detectable
-- binutils version not supported or not detectable
----------------------------------------------------------------- ---------------
"Would you like to perform an unsupported install of this product [yes/no] (no)?"

enter "yes"

This will complete the installation.  Keep in mind, you will get this warning from the compiler installer until such time as this particular OS and version are supported. Once installed, you can read the ReadMe notes in ...installdir.../Documentation directory which has a list of the supported Linux distributions and versions.


Debugger Notes:

Known Intel® IDB Debugger issues under Ubuntu:
1)     Ubuntu 9.x versions, IA32 and Intel64 platforms:

-         When loading an executable, a startup dialog may appear that should not. If this dialog,  "Unable to locate source file “…/start.S – Do you like to search for it manually?” appears, click ‘No’ and continue normal debugging.

-         Avoid using debug commands such as ‘next’, ‘step’ on the Console Window of the Debugger GUI since this may lead to unexpected behavior of the debugger; use the corresponding options ‘Continue’, Step Into’ etc. from the Run menu instead.

2)     Ubuntu 9.10, IA32 and Intel64 platforms:

-         You need to set the environment variable GDK_NATIVE_WINDOWS=1 to avoid a known bug in Eclipse delivered with Ubuntu 9.10. Add export GDK_NATIVE_WINDOWS=1
to your ~/.bashrc file or execute this command on command line:
export GDK_NATIVE_WINDOWS=1



Ubuntu 9.04 and Older:

In order to use Intel® Compilers ( Fortran or C++ ) under Ubuntu 9.04, 8.04 or 8.10 you will need the latest 11.0 or 10.1 version of the Intel compiler(s). Older 10.0 and 9.1 versions of the compilers may not work properly under Ubuntu 9.04, 8.04 or 8.10.  Keep in mind that new versions of Ubuntu/Debian may not be OFFICIALLY supported by the Intel Compilers.  Please see your ReleaseNotes document with your compiler version for a list of officially supported distributions and versions.

If you have active support for your compiler, you can download the latest Intel compiler version from
https://registrationcenter.intel.com

BEFORE YOU INSTALL Intel® Fortran for Linux or Intel® C++ for Linux on your fresh Ubuntu Desktop installation, you will first need to install several packages to prepare the system to serve as a development platform:

Check that gcc is installed. By default. Check this with:

gcc --version

By default, Ubuntu 8.04 Desktop installs gcc 4.2.3-2ubuntu7.  8.10 should have gcc 4.3.2, 9.04 gcc 4.3.3

If, for some reason, you do not have gcc installed, use Synaptic Package Manager (under 'System' -> 'Administration' menus) OR use apt-get to install gcc:


apt-get install gcc


Next, install g++. This is not installed by default. Again, use Synaptic Package Manager or apt-get to install package "g++"

apt-get install build-essential
apt-get install g++


Next, you need to install the 32bit compatibility library libstdc++.so.5. To do this, use apt-get or Synaptic Package Manager to retrieve and install package "libstdc++5"

apt-get install libstdc++5

This package may require installing another package as a prerequisite,
"gcc-3.3-base"

If so, go ahead and install this older gcc package.

For x86-64 architecture, you will also need a number of other packages, including package 'ia32-libs' to install the 32bit versions of libstdc++.so.5 in /usr/lib32 as well as 32bit header files in libc6-dev-i386.   These notes apply to Ubuntu 9.04 but should also apply to 8.10 and 8.04

apt-get install ia32-libs
apt-get install lib32stdc++6
apt-get install libc6-dev-i386
apt-get install gcc-multilib
apt-get install g++-multilib


Finally, there is an optional package to consider: The 11.0 version of the Intel Compiler for Linux has a graphical
debugger, a new graphical interface for the IDB debugger. If you want to use this debugger, please make sure to install the Java JRE version 1.5 or greater. This can be done at anytime after the installation of the compiler. However, you will get a warning message about 'missing prerequisite' for the JRE - simply ignore that message and proceed with the installation.  OR to avoid that message and enable the graphical IDE, get the latest JRE from:

http://java.com/en/download/manual.jsp

Once installation of prerequisites is complete, you are ready to start the Intel compiler(s) installation. During the installation, you may get a message "Detected operating system Debian* (generic) is not supported", followed by
----------------------------------------------------------------- ---------------
Missing optional pre-requisite
-- operating system type is not supported.
-- system glibc or kernel version not supported or not detectable
-- binutils version not supported or not detectable
----------------------------------------------------------------- ---------------
"Would you like to perform an unsupported install of this product [yes/no] (no)?"

enter "yes"

This will complete the installation.  Keep in mind, you will get this warning from the compiler installer until such time as this particular OS and version are supported. Once installed, you can read the ReadMe notes in ...installdir.../Documentation directory which has a list of the supported Linux distributions and versions.


Using the Compiler:

The next step after installing the compiler is to set up the user environment to use the compiler and libraries.  First, locate your documentation:  it is installed in <installdir>/Documentation/en_US   (currently, US English is the language supported in the documentation).   Under this directory, read the <installdir>/Documentation/en_US/getting_started_f.pdf or getting_started_c.pdf document.  Read how to use iccvars.sh or ifortvars.sh (or the .csh equivalents) to set your environment to use the compiler(s).  You may wish to put the 'source ifortvars.....' command into your home startup scripts.

Next, use a browser to open <installdir>/Documentation/en_US/documentation_f.htm or documentation_c.htm which is an index to the rest of the online documents.  Browse the documents to familiarize yourself with their locations and contents.

Finishing up:  Usage

Once the compilers are installed, it is necessary to source the ifortvars.sh or ifortvars.csh file to properly set the user environment to use the Intel compilers.  This (these) commands can be placed in a user's ~/.bashrc or other system login file (fortran 11.1.046 example shown below, bash user):

64bit compiler selection:
source /opt/intel/Compiler/11.1/046/bin/ifortvars.sh intel64

32bit compiler selection:
source /opt/intel/Compiler/11.1/046/bin/ifortvars.sh  ia32

C/C++ users: substitute "iccvars" for "ifortvars" above.

Other versions: substitute your actual minor version for "046" above. 
Also, if you are a CSH or TCSH user, use ifortvars.csh or iccvars.csh as appropriate.

Need more help?  Join our User Forums:
Fortran: /en-us/forums/intel-fortran-compiler-for-linux-and-mac-os-x/
C/C++: /en-us/forums/intel-c-compiler/
有关编译器优化的更完整信息,请参阅优化通知