Intel fortran compiler 10.0.023 under Ubuntu Gutsy

I had the problem that I need to use the Intel fortran compiler under Ubuntu Gutsy. This was a bit harder to setup than I initially expected, since Ubuntu 7.10 is not supported by Intel. After fiddling around for a while I found a way to make it work and I would like share the solution with anybody else that is interested so you wont need waste as much times as I.

Before the installation
First of all I need the installation files from Intel, so I went to the web page
http://www.intel.com/cd/software/products/asmo-na/eng/282048.htm
and chose the “Free Non-Commercial Download”. After registering I received an email with the a license file ending with .lic. I saved the license to /home/tjansson/ as I will need it later.

Some other packages are need to complete the installation of the compiler:

root@dirac:~#aptitude install alien g++-multilib libstdc++5 build-essential

Installation
Since I could not get the default installation to work I ended up finding these pages which really helped me and my mini howto is based on those.
http://www.intel.com/support/performancetools/sb/CS-025939.htm
http://ubuntuforums.org/showthread.php?p=3621092

For some strange reason Ubuntu uses dash and not bash as the shell /bin/sh. This creates problems since dash does not have the same functions as bash which is needed by the Intel programs (and programs others too). So I remove the link from sh to dash and replace it with a link to bash instead.

root@dirac:~#ls -l /bin/sh
lrwxrwxrwx 1 root root 9 2007-10-31 16:57 /bin/sh -> /bin/dash
root@dirac:~#rm /bin/sh
root@dirac:~#ln -s /bin/bash /bin/sh

After this I unpacked the tar ball I downloaded earlier and created a .deb file from the .rpm files included in the tar ball and install the .deb file.

tjansson@dirac:~$tar xvzf l_fc_p_10.0.023_ia32.tar.gz
tjansson@dirac:~$cd l_fc_p_10.0.023_ia32/data/
 
tjansson@dirac:~/l_fc_p_10.0.023_ia32/data$su
Password:
root@dirac:/home/tjansson/l_fc_p_10.0.023_ia32/data# alien -cv intel-ifort100023-10.0.023-1.i386.rpm
root@dirac:/home/tjansson/l_fc_p_10.0.023_ia32/data# dpkg -i intel-ifort100023_10.0.023-2_i386.deb

Even though the program is now installed all the files refer to <INSTALLDIR> and not /opt/intel/fc/10.0.023/ as it should. So I use sed to replace all occurences of <INSTALLDIR> with /opt/intel/fc/10.0.023/ . This has to be done at least with ifort and ifortvars.sh. I ran the following command as root

sed -i 's/&lt;INSTALLDIR&gt;/\/opt\/intel\/fc\/10.0.023/g' /opt/intel/fc/10.0.023/bin/ifortvars.sh

of course this could be done with any editor but I think this is faster. Sorry for the bade code display – WordPress is messing with my style.

Next I moved the license file (.lic) to the license folder created by the Intel compiler installer:

root@bohr:~# mv /home/tjansson/*.lic /opt/intel/fc/10.0.023/licenses/

The final step was to add a line in the file /home/tjansson/.bashrc to make the shell inherit some intel variables:

source /opt/intel/fc/10.0.023/bin/ifortvars.sh

Testing the installation
The final exercise is to test whether or not the compiler works. So I made a simple program and saved it as helloworld.f90

PROGRAM HelloWorld
   PRINT *, "Hello World"
END PROGRAM HelloWorld

Then I tried to compile the code to see if it worked

tjansson@dirac:~$ifort helloworld.f90
tjansson@dirac:~$./a.out
 Hello World

And finally it did 😀

Only registered users can comment.

  1. Thanks for the tips my compiler works now as well.

    Just to let you know there is a typo in your rpm conversion command you have
    ” alien -cv” twice

  2. Thanks for you guide, the intel fortran compiler 10.1.008 works on my ubuntu gusty too.
    But I have one more question,I find ‘ifortvars.sh’ also has some , do we need to replace them with the actual path /opt/intel/fc/10.*.***/bin ?

  3. Thanks for this excellent help!

    Everything worked fine during your suggested installation procedure, except that ifort would not start before I added the following line:

    alias ifort=’/opt/intel/fc/10.1.008/bin/./ifort’

    to my ‘.bashrc’ any idea why this difference? I have installed ifort -v 10.1.008

  4. Thanks for your how-to.I am running Ubuntu 7.10. I followed all your steps. But I finnally could not fish with success!!! While try to compile ‘hello world’ code. It shows the error:

    $ ifort fortrantest.f95
    /opt/intel/fc/10.1.008/bin/ifort: line 40: /opt/intel/fc/10.0.023/bin/ifortbin: No such file or directory
    /opt/intel/fc/10.1.008/bin/ifort: line 40: exec: /opt/intel/fc/10.0.023/bin/ifortbin: cannot execute: No such file or directory

    NB: like the last post by Rui Caldeira, ifort did not start before I added the following line:

    alias ifort=’/opt/intel/fc/10.1.008/bin/./ifort’

    to my ‘.bashrc

    ANY idea please!!!

  5. Rul Calderia and Debabrata: I think the reason for this is that the line in in your .bashrc file isn’t working:

    
    source /opt/intel/fc/10.0.023/bin/ifortvars.sh
    

    In this files you $PATH environment variable is altered to include the path of ifort. If it is done correctly the file should look something like this:

    
    if [ -z "${PATH}" ]
    then
        PATH="/opt/intel/fc/10.0.023/bin"; export PATH
    else
        PATH="/opt/intel/fc/10.0.023/bin:${PATH}"; export PATH
    fi
    

    But if ifortvars.sh hasn’t been changed by the sed command I presented you should open the ifortvars.sh and replace all occurrences of
    <INSTALLDIR>
    with
    /opt/intel/fc/10.0.023/

    Update: The reason that it failed was the the sed command attacked
    /opt/intel/fc/10.0.023/bin/ifort
    and not
    /opt/intel/fc/10.0.023/bin/ifortvars.sh
    as it should. Sorry for the typo. 🙁

  6. OK. thanks for your reply. Now I followed your last tips. I just opened the /opt/intel/fc/10.1.008/bin/ifortvars.sh and replaced the
    with
    /opt/intel/fc/10.1.008/

    and so now its working perfectly.

    Thanks. Good luck.

  7. thank you for your excellent how-to!
    I’ve one more question.. I cannot find the file *.lic, and it seems that the installation program did not create it…

    any suggestions?

    thanx a lot

  8. thanks for your help !

    I have the same problem as Leonardo, no licence file generated by the install.sh script (because it crashes before with bash and dash…)
    can someone provide the license file code please ? does it contain only the serial number ? thanks !

    bye

  9. Leonardo & Guilaume: As I wrote in the beginning of the article – I received the .lic file attached to the mail from Intel. So you register on their site and and you should receive one. 😀

  10. I’ve followed all the tips but when I try to compile I receive this message:

    renato@snoopy:~/latex/programas/utf-8$ ifort galerkin.for
    fortcom: Info: The input stream is empty
    /opt/intel/fc/10.1.008/lib/for_main.o: In function `main’:
    /users/nbtester/x86linux_nightly/branch-10_1/20070914_000000/libdev/frtl/src/libfor/for_main.c:(.text+0x39): undefined reference to `MAIN__’

    What’s wrong?

    Thanks a lot.

  11. Fremragende. Tak. Det virkede også for icc.
    Jeg installerede 10.1.008 versionerne og her skal man også bruge dit sed hack på selve scriptet:
    —————————————————————
    sed -i ‘s//\/opt\/intel\/cc\/10.1.008/g’ /opt/intel/cc/10.1.008/bin/icc
    —————————————————————
    og ligesådan for ifort

  12. I don’t know German, but I think I agree with Georg above– these instructions work great (with slight mods) for installing the Intel C compiler (icc) too!

    Thanks!

  13. HI tjansson
    thanks for u r help…I’m new in linux…..I’ve followed all the tips…
    i’m using the 10.1.008 version…it works but I still have a problem.

    root@Nada:/home/khaled# ifort somme.for
    bash: ifort: command not found
    root@Nada:/home/khaled# alias ifort=’/opt/intel/fc/10.1.008/bin/./ifort’
    root@Nada:/home/khaled# alias
    alias ls=’ls –color=auto’
    alias ifort=’’/opt/intel/fc/10.1.008/bin/./ifort’’
    root@Nada:/home/khaled# ifort somme.for
    bash: ifort: command not found
    root@Nada:/home/khaled# /opt/intel/fc/10.1.008/bin/./ifort somme.for
    root@Nada:/home/khaled#

  14. HI khaled:

    If the line in your .bashrc really worked
    source /opt/intel/fc/10.0.023/bin/ifortvars.sh
    it shouldn’t be necessary but if you would like to do the alias instead there is a strange dot in your path. The correct path in your case would be something like:
    alias ifort=’/opt/intel/fc/10.1.008/bin/ifort’

    I hope this helps 🙂

  15. Thanks Jansson,
    first ,wish u a happy new year..
    ..Now everything works well….
    I just want to notice that, what i wrote about the alias is due to the “kommentar ” of Debabrata siger:
    24. november 2007 kl. 19:08
    NB: like the last post by Rui Caldeira, ifort did not start before I added the following line:

    alias ifort=’/opt/intel/fc/10.1.008/bin/./ifort’

    ..I still need an unser about this :
    I’ve 2 prgms : 1) somme.for and 2) test.for
    when i compile them with ifort..it always give me [ a.out ]…… what command should i type to have for example [ somme.out ]and [ test.out ]

    thank you again for u r help

  16. thank you very much for your guide…
    i must say i am completely new to the linux world… it took me a while but i made it work…
    thank you very much once again!

  17. Tack så jätte mycket!. I really appreciate this niceand generous piece of work you put on the web. It’s thanks to people like you (sharing knowledge and experience) that we can make headway.

  18. Thanks for nice how-to!

    I get:

    {martini}/home/joe/Pro>ifort -o go hello.f
    /opt/intel/fce/10.1.012/bin/ifort: line 40: /opt/intel/fce/10.1.012/bin/ifortbin: cannot execute binary file
    /opt/intel/fce/10.1.012/bin/ifort: line 40: /opt/intel/fce/10.1.012/bin/ifortbin: Success

    and the executable is not created. Any ideas? Thanks in advance.

  19. I have a little problem with this. It works all right, but when i exit the terminal it forget the commande ifort…
    I have to run source /opt/intel/fc/10.1.018/bin/ifortvars.sh again, them ifort works on this terminal…
    I think is not correct to run source every time…
    I couldn’t find the problem, have you got any idea?
    thanks from Argentina
    Mario

  20. Isolved the problem adding the line:
    source /opt/intel/fc/10.1.018/bin/ifortvars.shat

    at .bashrc

    its works ok!
    thanks a lot
    mario

  21. I followed your instructions. They are a good help.

    HOWEVER when I try to compile a simple “hello world” program with the instruction “ifort hello.F90” i get this error:

    ld: /opt/intel/fce/10.1.018/lib/for_main.o: No such file: No such file or directory

    This is strange because THERE IS a file called for_main.o in that directory!

    Note that my version is 10.1.018

    Can somebody help???

    Thanks

    J

  22. Hi, for hardy after downloading the l_fc_p_10.1.018.tar.gz, gunzip, ./install.sh and putting in my

    N3KT-LJZGNDL3 verification code all I needed to do was add

    if [ -f /opt/intel/fc/10.1.018/bin/ifortvars.sh ]; then
    . /opt/intel/fc/10.1.018/bin/ifortvars.sh
    fi

    to ~/.bashrc

  23. Dude, Thanks a lot man. It was annoying me since forever and then your article came up like a savior.

    I just had to run this command for both files i.e. ifort and ifortvars.sh
    sed -i ‘s//\/opt\/intel\/fc\/10.0.023/g’ /opt/intel/fc/10.0.023/bin/ifortvars.sh

    After that it worked like a charm.

    Thanks once again bro.

  24. Dear Users,

    Actually I want to install Ifort and KML on RedHat 4 Linux, but first of all I do not have this software (any body can help me to find a freely version ?) I installed ifort evaluation but I want to uninstall it , can any one help me to do that ? because I can not find its name, for example I am using of $rpm -e , but I do not know which name should I mention to uninstall, because when i write intell fortran or ifront , it says this file can not find .

  25. I try to install MPICH2 with intel compilers
    running make, I get this error:

    CC setbot.c
    F77 setbotf.f
    /bin/bash: ifort: orden no encontrada
    make[3]: *** [setbotf.o] Error 127
    make[3]: se sale del directorio «/home/sork/Descargas/mpich2-1.3.2p1/src/binding/f77»
    make[2]: *** [all-redirect] Error 1
    make[2]: se sale del directorio «/home/sork/Descargas/mpich2-1.3.2p1/src/binding»
    make[1]: *** [all-redirect] Error 2
    make[1]: se sale del directorio «/home/sork/Descargas/mpich2-1.3.2p1/src»
    make: *** [all-redirect] Error 2
    sork@sork:~/Descargas/mpich2-1.3.2p1$

    I have defined in the. bash

    export FC=”ifort”
    export F77=”ifort”
    export FCFLAGS=$OPTIM
    export FFLAGS=$OPTIM
    export F77FLAGS=$OPTIM
    export F90FLAGS=$OPTIM

    source /opt/intel/composerxe-2011.2.137/bin/ifortvars.sh intel64
    PATH=”/opt/intel/bin:/opt/intel/composerxe-2011.2.137/bin/intel64:$PATH”
    export PATH

    if [ -z “${PATH}” ]
    then
    PATH=”opt/intel/composerxe-2011.2.137/bin”; export PATH
    else
    PATH=”opt/intel/composerxe-2011.2.137/bin:${PATH}”; export PATH
    fi

    can you give me some help?

    Sork

  26. Hi Sork

    I has been a while since I have used Intel Compilers ( I wrote this in 2007 and I am not using them at my work, so I a bit rusty). It definitely looks like that you have a PATH problem:

    /bin/bash: ifort: orden no encontrada

    Which means that bash does understand the command “ifort” – which is because this does point to any executable. To test if ifort really works try to use the “which” command. Here I try to find where xterm points to and it shows me the path to the executable

    tjansson@euler:~$which xterm
    /usr/bin/xterm

    If I tried to do the same to ifort, which I do not have installed I would get this:

    tjansson@euler:~$which ifort
    tjansson@euler:~$

    What I would do was to open a new terminal and try to execute the

    source /opt/intel/composerxe-2011.2.137/bin/ifortvars.sh intel64

    command. If this gives an error or does not make ifort a part of you path – you should open up this script and try out why it fails.

    Finally also check that the ifort binary actually is in the folders:
    /opt/intel/bin
    /opt/intel/composerxe-2011.2.137/bin/intel64

    Kind regards
    Thomas Jansson

  27. Can anyone tell me how to uninstall ifort from linux OS. I am using fedora tn version of linux OS.

  28. it’s been years. 😀
    But you may help me, I have followed the instructions that u gave for installation of ifort (10.0.023 is my version) on ubuntu 12.04. My problem is *.lic file. I registered intel and they sent me only a serial number in format NTJL-********. There was no attachment.
    Any help would be greatly appreciated.

  29. Hi Fahrettin

    I am sure that the procedure on Intel side has changed over the seven years since I wrote this piece and I have not been using the compiler for last many years, so I cannot help you unfortunately.

    All the best
    Thomas

Leave a Reply to Thomas JanssonCancel reply