LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 09-03-2009, 07:16 AM   #1
sonu kumar
LQ Newbie
 
Registered: Aug 2009
Location: India
Distribution: open suse
Posts: 28

Rep: Reputation: 17
how to use one of the two installed compilers to compile a program in open suse11.1


hi dear all,

i have installed two compilers(ifort and gfortran ) in open suse11.1

but i want to compile a program in open suse using ifort compiler.

how can i do this?

thanks in advance

sonu
 
Old 09-03-2009, 08:32 AM   #2
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976
Just use ifort...
Code:
ifort -o test test.f90
Note that if you want to update your environment in order to use ifort (that is to update PATH, LD_LIBRARY_PATH, MANPATH and so on...) you have to copy the file /opt/intel/Compiler/<version>/<release>/bin/ifortvars.sh to /etc/profile.d/. In this way it will be sourced every time you start a new shell and all the relevant environment variables will be set-up.
 
Old 09-03-2009, 10:02 AM   #3
sonu kumar
LQ Newbie
 
Registered: Aug 2009
Location: India
Distribution: open suse
Posts: 28

Original Poster
Rep: Reputation: 17
Quote:
Originally Posted by colucix View Post
Just use ifort...
Code:
ifort -o test test.f90
Note that if you want to update your environment in order to use ifort (that is to update PATH, LD_LIBRARY_PATH, MANPATH and so on...) you have to copy the file /opt/intel/Compiler/<version>/<release>/bin/ifortvars.sh to /etc/profile.d/. In this way it will be sourced every time you start a new shell and all the relevant environment variables will be set-up.
hi

Actually i want u use both compilers depending upon the application progam(some programs require ifort,some require other compilers depending upon the coding of program and flags used in it).

so is it possible that setting environment for ifort can affect installed gfortran compiler?

please explain it,i am just new to it.

i shall be greatfull to you.

thanku.
 
Old 09-03-2009, 10:27 AM   #4
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976
Quote:
Originally Posted by sonu kumar View Post
so is it possible that setting environment for ifort can affect installed gfortran compiler?
Absolutely not. The environment provides just search paths for specific executables, shared objects, man pages and so on... but what a compiler needs is hard-coded in the compiler itself. In other words, when you run the gfortran compiler it will look for specific objects in its own locations, when you run ifort it will look for other specific object in its own locations. Things will never mixed-up.

The only issue to take in mind is that if you need to compile some specific libraries from source (take as example Unidata's Netcdf libraries) you have to compile them using the same compiler you're planning to use. Or better, compile them twice and use one version or the other at your need.

An example will clarify. On my system I use both ifort and gfortran and in both cases I need Netcdf libraries. Hence I installed a copy in
Code:
/opt/netcdf-3.6.3/
using ifort. In addition I installed another copy in
Code:
/usr/local/netcdf-3.6.3-gfortran/
this time using gfortran.

Every time I have to compile a program which requires netcdf using ifort, I do:
Code:
ifort -I/opt/netcdf-3.6.3/include my_program.f90 -L/opt/netcdf-3.6.3/lib -lnetcdf
and every time I have to compile a program which requires netcdf using gfortran, I do:
Code:
gfortran -I/usr/local/netcdf-3.6.3-gfortran/include my_program.f90 -L/usr/local/netcdf-3.6.3-gfortran/lib -lnetcdf
Hope it's a little more clear. Be sure, it will be even more clear as soon as you will start to use both the compilers!
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Two Java compilers installed . kk2202 Red Hat 2 05-18-2009 09:36 AM
compile with two gcc compilers powah Linux - Software 2 08-20-2007 12:45 PM
Two Compilers Installed - What Command to Use? rrrssssss Linux - Software 2 01-13-2006 04:38 AM
how do i open the program of the rpm i just installed? kabir Linux - Software 1 01-16-2004 11:23 PM
What compilers/ libraries ect do I need installed so that I can compile most software jimdaworm Linux - Newbie 2 09-12-2003 04:45 PM


All times are GMT -5. The time now is 01:10 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration