Tool-BarfreeBSD ArticlesSearch Our SiteHOMEfreeBSD LinksContribute to FreeBSD HelpFreeBSD FilesFreeBSD Script Corner

Installing Intel Fortran 90 Compiler in FreeBSD
 Author: Alberto

Version: 1.0

 In this document I will try to explain how to install the Intel Fortran 90 Compiler v 6.0 in FreeBSD with Linux emulation. I hope that this document could be useful for people that are doing large numerical simulations, since the Intel Compiler works really fine, and has support for SSE, SSE2, etc...
Before beginning
 We will need some tools during the "installation" of the compiler, and we can install them from the ports. rpm2cpio and the linux emulation (ports linux_base-7 andlinux_devtools-7). If you dont know how to install them, please look in the ports section of the FreeBSD Handbook.
 We will also need to make a symblic link between two shared libraries, so that our compiled programs works fine:

root@pc # ln -s /usr/compat/linux/lib/ /usr/compat/linux/usr/lib/

 This is not very clean. If someone knows a cleaner solution, please write it to me.
Downloading the compiler
 We can download a non commercial and unsupported version of the compiler, or you can buy one to intel, depending on your needs. You must fill a form so that they can send you a license file.
Installing the compiler
 Now go to a temporal directory and untar the .tar.bz2 file that you had downloaded.

root@pc # mkdir /tmp/fortran
root@pc # cd /tmp/fortran
root@pc # bunzip2 -c <path to the file>/intel-fortran-6.0.tar.bz2 | tar -xvf -

 After that you should have this files in /tmp/fortran :

root@pc # ls /tmp/fortran
flicense           intel-eldb6-6.0-191.ia64.rpm lgpltext
install           intel-ifc6-6.0-140.i386.rpm
intel-efc6-6.0-140.ia64.rpm intel-ildb6-6.0-191.i386.rpm
root@pc #

 We are only interested in the files that finish withi386.rpm. Now we are going to uncompress the 2 .rpm that we need. I have installed the compiler in/usr/compat/linux/opt/intel

root@pc # cd /usr/compat/linux/
root@pc # rpm2cpio /tmp/fortran/intel-ifc6-6.0-140.i386.rpm | cpio -i
root@pc # rpm2cpio /tmp/fortran/intel-ildb6-6.0-191.i386.rpm | cpio -i

"Tunning" the compiler
 Now we must make this compiler work under FreeBSD. First the name of the compiler is ifc and in a "normal" linux instalation, simply running/usr/compat/linux/opt/intel/compiler60/ia32/bin/ifc the compiler should work.
/usr/compat/linux/opt/intel/compiler60/ia32/bin/ifc is really a shell script. We must change this script by this other:




if [ -z PATH ]
export PATH;

export IA32ROOT; unset IA32ROOT;

if [ $# != 0 ]
 exec /usr/compat/linux/opt/intel/compiler60/ia32/bin/ifcbin "$@";
 exec /usr/compat/linux/opt/intel/compiler60/ia32/bin/ifcbin;

 Now we make a symbolic link:

root@pc # ln -s /usr/compat/linux/opt/intel/compiler60/ia32/bin/ifc /usr/local/bin/ifc

 Now we have to copy the license file that Intel send us by e-mail in the directory /usr/compat/linux/opt/intel/licenses/

root@pc # cp <license file> /usr/compat/llinux/opt/intel/licenses

Compiling our first program
 Now we can compile any fortran program:

root@pc # ifc -w90 -c -o prueba.o <programa.f(90)>

 This must generate a file prueba.o without any problem (unless the code has errors, of course).
Linking programs
 We must use the Linux linker to link the fortran programs (Thanks to Rahul Siddharthan, without him i will never discover this by myself), and we must give the linux linker the correct options. The next script (I called it ifcld) makes the work (based in one of Rahul Siddharthan, but that doesnt work for me):

# Script that links fortran 90 using linux ld.

/compat/linux/usr/bin/ld \
-L/compat/linux/opt/intel/compiler60/ia32/lib/ -lCEPCF90 -lF90 \
-rpath /compat/linux/opt/intel/compiler60/ia32/lib/ \
-lIEPCF90 -lPEPCF90 -lPOSF90 -lcprts -lcxa -limf -lintrins -lirc \
-e main "$@"

# now we look for the output file.
while [ "$1" != "$OPT" ]
brandelf -t Linux $2

 if you put this script in /usr/local/bin you can link the program with:

root@pc # ifcld prueba.o -o prueba.out

 And you should be able to execute it, without any problem:

root@pc # ./prueba.out


© 1997 - 20013 Defcon1, , Copyrights for all materials on this web site are held by the individual authors, artists, photographers or creators. Materials may not be reproduced or otherwise distributed without permission of and the content's original author.

Tool-Bar-2Defcon1  Webmail