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
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
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.
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/<INSTALLDIR>/\/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:
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 😀