PDA

View Full Version : Anyone using Snow Leopard & FORTRAN?




Saladsamurai
Sep 3, 2010, 12:22 AM
If so, how did you install it? I have been looking at this site (http://gcc.gnu.org/wiki/GFortran) as well as this one (http://hpc.sourceforge.net/) and apparently you have to be a rocket scientist to install the compiler. I'm a little desperate here. I really know nothing about compilers. Most compilers I have dealt with simply require me to run a .exe and I'm done. I can then open it and started writing code.

As much as I hate to ask for someone to hold my hand through the install process, I'm asking. Has anyone here done this that can offer me some guidance? I really need to get this code up and running.

I know that this is probably not the right forum, but I am really unsure of where to put this.



thecarrot
Sep 3, 2010, 12:26 AM
I pretty much just followed the directions. Worked perfectly, come to think of it!

Saladsamurai
Sep 3, 2010, 12:40 AM
I pretty much just followed the directions. Worked perfectly, come to think of it!

What directions? Here is the section I am looking at Computation Tools :: Fortran

GCC 4.6 (auto-vectorizing gcc with openmp) :

Compiled using source code from the GNU CVS servers. This contains current versions of gfortran (GNU F95, this is a version of the much awaited, free, open source, F95 compiler), gcc (GNU C) and g++ (GNU C++) compilers that can perform auto-vectorization (i.e. modify code to take advantage of AltiVec/SSE, automatically). Use flag -O3 -ftree-vectorize to enable that option. For more information, see this webpage. Download my binaries, and cd to the download folder. Then gunzip gcc-bin.tar.gz (if your browser didn't do so already) and sudo tar -xvf gcc-bin.tar -C /. It installs everything in /usr/local. You invoke F95 by typing gfortran. You will also need to have Apple's Developer Tools installed. They are included on a separate CD in the retail version of OS X and also available as a free download from Apple's Developer Site. Please install the most current version of Developer Tools. Finally, note that there is an alternate g95 project, that is not part of GCC. They seem to have recently released their own official version of g95 for OS X which you may wish to try. Again, note that that g95 is not the same as this version here. Some reports suggest that this alternate g95 is ahead in the implementation of F95 features, but there are mixed reports regarding its optimization capabilities.

The parts I have highlighted do not make sense to me. How are these directions?

I downloaded gfortran-snwleo-intel-bin.tar.gz and unzipped it. The result is a folder called "usr" It is filled with other folders that I have no idea what to do with. What is the next step?

I also don't see this "sudo tar -xvf gcc-bin.tar -C /" anywhere. Perhaps that is just for the C compilers?

And I don't know what "You invoke F95 by typing gfortran" means? Where do I type this now?

Some Guy 555
Sep 3, 2010, 12:50 AM
What directions? Here is the section I am looking at

The parts I have highlighted do not make sense to me. How are these directions?

I downloaded gfortran-snwleo-intel-bin.tar.gz and unzipped it. The result is a folder called "usr" It is filled with other folders that I have no idea what to do with. What is the next step?

I also don't see this "sudo tar -xvf gcc-bin.tar -C /" anywhere. Perhaps that is just for the C compilers?

And I don't know what "You invoke F95 by typing gfortran" means? Where do I type this now?


While I believe this should go into the PROGRAMMING forum, as a Software Engineer and fairly familiar with unix I will gladly walk you through it.

1. Go to spotlight (top right) and type terminal. Hit enter and command prompt should pop up.

2. Type the following command:

cd $HOME/Downloads

That should change your directory (which folder you are looking in) to downloads where the "binary" (the file you downloaded and need to compile) should be.

3. The command "sudo tar -xvf gcc-bin.tar -C /" simply means to execute that exact command (yes copy and paste it) while you are in the downloads folder. It should unzip the file and use the GNU C compiler (the C compiler) to compile that. And that should be it. Also, note that when using sudo it will require a password... but that is obvious... at least I hope everyone knows that...

4. "You invoke F95 by typing gfortran"

This simply means that if you want to run the "fortran" program you simply type gfortran in terminal. Yes, you have to use this program in the terminal. Meaning you will probably use vi, vim or the emacs built in terminal text editor to code in. I'm assuming this is for a programming class since fortran really isn't many peoples cup of tea for recreation... and hence you will probably be familiar with vi/vim/emacs if not I can help you with that but its a long tutorial...


Hope that helps.

Saladsamurai
Sep 3, 2010, 01:07 AM
Thanks some guy!

I wish this were working for me, but it is not. Let me tell you what I have done so far:

1) Downloaded " gfortran-snwleo-intel-bin.tar.gz " and unzipped it inside of the "Downloads Folder." (Do I need to download "gcc-snwleo-intel-bin.tar.gz" as well?)

2) Gone to Terminal and typed "cd $HOME/Downloads" and hit Enter

3) Gone to Terminal and typed "sudo tar -xvf gcc-bin.tar -C /
" and hit Enter. At this point I got the following error:

Error opening archive: Failed to open 'gcc-bin.tar': No such file or directory


And as an FYI, no, not a programming class. My research group uses FORTRAN. I am familiar with a little C++ and VB, but I am not sure what these mean: "vi/vim/emacs "

My only programming experience has been in Windows.

Thanks again for your help :)

Some Guy 555
Sep 3, 2010, 01:12 AM
Thanks some guy!

I wish this were working for me, but it is not. Let me tell you what I have done so far:

1) Downloaded " gfortran-snwleo-intel-bin.tar.gz " and unzipped it inside of the "Downloads Folder." (Do I need to download "gcc-snwleo-intel-bin.tar.gz" as well?)

2) Gone to Terminal and typed "cd $HOME/Downloads" and hit Enter

3) Gone to Terminal and typed "sudo tar -xvf gcc-bin.tar -C /
" and hit Enter. At this point I got the following error:



And as an FYI, no, not a programming class. My research group uses FORTRAN. I am familiar with a little C++ and VB, but I am not sure what these mean: "vi/vim/emacs "

My only programming experience has been in Windows.

Thanks again for your help :)


ok so after you typed in cd $HOME/Downloads type in this "ls" what that will do is "list" whats in the "downloads" folder. From the error description it is basically saying that the file you are trying to run the subsequent command on is not there. Give me a printout of what "LS" shows.

Also, "vi", "vim" and "emacs" are really nice text editors that can do all sorts of wizardry. They are confusing to use if you have never touched them before but nothing rivals them in terms of efficiency when you get the basic commands down in them. Great thing about OS X is that all 3 are already installed on your mac. To activate them just type the name of it (vi/vim/emacs). DO NOT actually run them though (by typing the name)... because you cannot actually exit out of them if you don't know the exit command.

But yeah, give me the print out of LS and I will see if I can change the command around to work that they gave you.

Saladsamurai
Sep 3, 2010, 01:17 AM
ok so after you typed in cd $HOME/Downloads type in this "ls" what that will do is "list" whats in the "downloads" folder. From the error description it is basically saying that the file you are trying to run the subsequent command on is not there. Give me a printout of what "LS" shows.

Also, "vi", "vim" and "emacs" are really nice text editors that can do all sorts of wizardry. They are confusing to use if you have never touched them before but nothing rivals them in terms of efficiency when you get the basic commands down in them. Great thing about OS X is that all 3 are already installed on your mac. To activate them just type the name of it (vi/vim/emacs). DO NOT actually run them though (by typing the name)... because you cannot actually exit out of them if you don't know the exit command.

But yeah, give me the print out of LS and I will see if I can change the command around to work that they gave you.

Ok! Give me 5 minutes. I am going to delete everything in my Downloads folder and then start from scratch one more time. In OSX, when I want to "unzip" this file, I simply double click it right? And it extracts everything to the same folder that the compressed file is in correct? That is what seems to be happening.

Some Guy 555
Sep 3, 2010, 01:19 AM
Just re-read one of your previous posts where it says:

"Then gunzip gcc-bin.tar.gz (if your browser didn't do so already) and sudo tar -xvf gcc-bin.tar -C /. It installs everything in /usr/local. You invoke F95 by typing gfortran. You will also need to have Apple's Developer Tools installed."

Ok so the first command (the one that the browser, safari or whatever, should have done) needs to be done... although give me a printout of "ls" first and that will answer whether or not it has been done automatically. The second command is where you are getting the error so I am assuming the gunzip command:

gunzip gcc-bin.tar.gz has not been done. Again though, give me the ls printout.

The next things there are all referring to where all the fortran related files will be put (/usr/local folder). Also, make sure you have the Dev tools installed... they are not by default (you get them by installing xcode, they are an optional option). Without them I do not believe you will have the gcc C compiler which is required to do everything the instructions are asking you to do.

Some Guy 555
Sep 3, 2010, 01:20 AM
Ok! Give me 5 minutes. I am going to delete everything in my Downloads folder and then start from scratch one more time. In OSX, when I want to "unzip" this file, I simply double click it right? And it extracts everything to the same folder that the compressed file is in correct? That is what seems to be happening.

Yeah if you double click it, then it should unzip it... but don't do that. Just download it to the downloads folder and proceed with the instructions (leave it zipped so the terminal command will unzip it AND compile it).

Saladsamurai
Sep 3, 2010, 01:24 AM
Yeah if you double click it, then it should unzip it... but don't do that. Just download it to the downloads folder and proceed with the instructions (leave it zipped so the terminal command will unzip it AND compile it).

Ok. And just to be double check, I DON'T need the other zipped folder from the "wesite: "gcc-snwleo-intel-bin.tar.gz" ?

I just need the "gfortran-snwleo-intel-bin.tar.gz" file?

Some Guy 555
Sep 3, 2010, 01:30 AM
Ok. And just to be double check, I DON'T need the other zipped folder from the "wesite: "gcc-snwleo-intel-bin.tar.gz" ?

I just need the "gfortran-snwleo-intel-bin.tar.gz" file?

I believe you only need the "gfortran" one. But download both, it won't do any harm. If it turns out that other file never gets touched/whatever then just delete it later.

To reiterate what to do after downloading:

1. Open terminal.
2. Go to downloads:

cd $HOME/Downloads

3. Type ls and let me know what the print out is (that way I will know if the command they give you will error or not).

4. After that proceed with the commands tried earlier that error'd out (the sudo gcc command to compile everything).

Saladsamurai
Sep 3, 2010, 01:40 AM
I believe you only need the "gfortran" one. But download both, it won't do any harm. If it turns out that other file never gets touched/whatever then just delete it later.

To reiterate what to do after downloading:

1. Open terminal.
2. Go to downloads:

cd $HOME/Downloads

3. Type ls and let me know what the print out is (that way I will know if the command they give you will error or not).

4. After that proceed with the commands tried earlier that error'd out (the sudo gcc command to compile everything).


Ok. I think the problem should be clear. We are using the command "sudo tar -xvf gcc-bin.tar -C /" which is trying to do something with the file "gcc-bin.tar" which I have NOT downloaded because I want to install gfortran.

If I download both as you suggested, I have a feeling that the command will work. BUT it will succeed on installing the compiler that I DON'T want. I am thinking that we should change the command from "sudo tar -xvf gcc-bin.tar -C /" to "sudo tar -xvf gfortran-bin.tar -C /" OR perhaps "sudo tar -xvf gfortran-snwleo-intel-bin.tar


As for typing ls in the terminal it returns Last login: Fri Sep 3 02:27:44 on ttys000
Casey-Bennetts-MacBook-Pro:~ caseybennett$ cd $HOME/Downloads
Casey-Bennetts-MacBook-Pro:Downloads caseybennett$ ls
gfortran-snwleo-intel-bin.tar.gz
Casey-Bennetts-MacBook-Pro:Downloads caseybennett$


I think that we NEED to unzip it (that's what it says on site) and then change that command. What do you think?

Some Guy 555
Sep 3, 2010, 01:48 AM
Ok. I think the problem should be clear. We are using the command "sudo tar -xvf gcc-bin.tar -C /" which is trying to do something with the file "gcc-bin.tar" which I have NOT downloaded because I want to install gfortran.

If I download both as you suggested, I have a feeling that the command will work. BUT it will succeed on installing the compiler that I DON'T want. I am thinking that we should change the command from "sudo tar -xvf gcc-bin.tar -C /" to "sudo tar -xvf gfortran-bin.tar -C /" OR perhaps "sudo tar -xvf gfortran-snwleo-intel-bin.tar


As for typing ls in the terminal it returns

I think that we NEED to unzip it (that's what it says on site) and then change that command. What do you think?

I am nearly positive you don't need to unzip it first since the whole idea of using the "tar" command is to unzip compressed files. Try this:

sudo tar -xvf gfortran-snwleo-intel-bin.tar -C /

If that doesn't work then try:

sudo tar -xvf gfortran-snwleo-intel-bin.tar.gz -C /

I doubt you need the last command, the first should do it. If that fails tell me the error and you may need to just use the GUI (double click the thing) to uncompress it. Then there will be files inside the folder that will be created that you need.

I hope this works for you, but if it doesn't just post back here and in the morning I will check back. It's getting late for me right now (1 in the morning and I got to get up early).

Saladsamurai
Sep 3, 2010, 02:05 AM
<snip>

sudo tar -xvf gfortran-snwleo-intel-bin.tar.gz -C /



I used this one and I think it worked! This is the what it returned:

Last login: Fri Sep 3 02:52:55 on ttys000
Casey-Bennetts-MacBook-Pro:~ caseybennett$ cd $HOME/Downloads
Casey-Bennetts-MacBook-Pro:Downloads caseybennett$ ls
gfortran-snwleo-intel-bin.tar.gz
Casey-Bennetts-MacBook-Pro:Downloads caseybennett$ sudo tar -xvf gfortran-snwleo-intel-bin.tar.gz -C /
x usr/local/
x usr/local/bin/
x usr/local/include/
x usr/local/lib/
x usr/local/libexec/
x usr/local/share/
.
.
.
.
x usr/local/lib/gcc/x86_64-apple-darwin10/4.6.0/finclude/omp_lib.h
x usr/local/lib/gcc/x86_64-apple-darwin10/4.6.0/finclude/omp_lib.mod
x usr/local/lib/gcc/x86_64-apple-darwin10/4.6.0/finclude/omp_lib_kinds.mod
x usr/local/include/gmp.h
x usr/local/include/._mpc.h
x usr/local/include/mpc.h
x usr/local/include/mpf2mpfr.h
x usr/local/include/mpfr.h
x usr/local/bin/gfortran
Casey-Bennetts-MacBook-Pro:Downloads caseybennett$


The only thing is this ... I may have done this twice :o Actually I know that I did. Do you think that this will cause any issues?

Also: How do I use this again? If I type "gfortran" in the terminal, I get the following

Casey-Bennetts-MacBook-Pro:Downloads caseybennett$ gfortran
i686-apple-darwin10-gfortran-4.2.1: no input files
Casey-Bennetts-MacBook-Pro:Downloads caseybennett$


So I believe that it needs something else form me as well. Let's say I want to run the following code:

implicit real*8 (a-h, o-z)


a=1
b=2
c=a+b
write(*,*) c

stop



end






What is the procedure?

Thanks again for all of your help!

mdenwood
Sep 3, 2010, 02:11 AM
I don't know if you need the specific version of gfortran that you're trying to install, but if its just any version you want then there is a compiled version provided as part of R on this page:

http://cran.r-project.org/bin/macosx/tools/

Just download the 'gfortran-4.2.3.dmg' file and double click to install as any other program. This also means you don't need gcc installed to install gfortran, although you will probably want to install it anyway (part of Xcode tools). I imagine you are also going to need to brush up on your terminal usage if you want to be able to compile anything!

Hope this helps,

Matt

Saladsamurai
Sep 3, 2010, 02:23 AM
OK. So I think that I figured out how to actually run stuff from the terminal. But I am getting an error on the simple program in my last post. It worked on my Windows fortran compiler, so I know the code is fine. Here is the terminal print out:

Last login: Fri Sep 3 03:18:57 on ttys000
Casey-Bennetts-MacBook-Pro:~ caseybennett$ cd $HOME/Desktop/FORTRAN
Casey-Bennetts-MacBook-Pro:FORTRAN caseybennett$ ls
test.for
Casey-Bennetts-MacBook-Pro:FORTRAN caseybennett$ gfortran test.for
i686-apple-darwin10-gfortran-4.2.1: error trying to exec 'f951': execvp: No such file or directory
Casey-Bennetts-MacBook-Pro:FORTRAN caseybennett$


Not sure where to go from here.

chrono1081
Sep 3, 2010, 02:30 AM
This is completely off topic but anytime I hear the word fortran I think of this creeeeeepy weirdo that was one of the users I had to support. Any time you touched his computer (which was often since he always screwed it up) it didn't matter what you were doing (usually I was adding him a pst file or reinstalling his printer) he would ask if you were programming in fortran and would write in a little notebook anything you typed on the keyboard and then retype it in word since he was convinced you were programming fortran and he wanted to do it too.

He thought the IT department was made up of all programmers and told HR we were holding out on him since we wouldn't teach him programming...yea...

Now that I wasted a minute of your life :P ....

Saladsamurai
Sep 3, 2010, 02:44 AM
<snip>
Now that I wasted a minute of your life :P ....

Yeah, but I laughed my ass off at this :) Thanks for sharing!

chrono1081
Sep 3, 2010, 02:54 AM
Yeah, but I laughed my ass off at this :) Thanks for sharing!

No problem ;) If you want a metal picture of this guy to a T, he talks just like big gay al from south park, wears only hawaiin shirts, and looks like a really fat gargamel off of smurfs.

Oh, and one time, when he wasn't looking, I looked in his notebook that he carries everywhere (the one with the "fortran code" in it). It is a trip! He has all of these drawings of usb cables, and cat 5 cables, parallel cables, and pretty much any cable you can think of that connects to computer equipment and he has a whole section dedicated to serial numbers of office equipment he finds and all kinds of crap.

REALLY strange dude...

GGJstudios
Sep 3, 2010, 03:01 AM
Anyone using Snow Leopard & FORTRAN?
I just gotta say how strange it is for me to see "Snow Leopard" and "FORTRAN" in the same sentence! I didn't realize anyone still used FORTRAN! I've been out of the programming world for quite a while, but I wrote my first FORTRAN program on an IBM mainframe computer about 40 years ago! :eek: DAMN, I'm old!

balamw
Sep 3, 2010, 07:32 AM
Not sure where to go from here.

http://www.macresearch.org/error_trying_to_exec_as_execvp_no_such_file_or_directory

This error usually means that gcc isn't installed.

gcc is actually required and does much of the heavy lifting.

Do you have Xcode installed?

B

Saladsamurai
Sep 3, 2010, 12:35 PM
http://www.macresearch.org/error_trying_to_exec_as_execvp_no_such_file_or_directory

This error usually means that gcc isn't installed.

gcc is actually required and does much of the heavy lifting.

Do you have Xcode installed?

B

Hey b! Yes I have Xcode (3.2.2) installed. I am just noticing that this is not the latest build. I am wondering if that is the problem.

So here's a newb question: by having the Xcode installed, does that mean that I have gcc installed? Or is that something I need in addition to Xcode?

***

ALSO: I really wish I could just get Visual FORTRAN to run on Windows7 properly; however, it will only run on XP without errors (at least the version I have). Does anybody know of a free compiler that is compatible with Windows7 that they have used and like? I would like to install it on my Windows partition as a back up.

Some Guy 555
Sep 3, 2010, 01:23 PM
I used this one and I think it worked! This is the what it returned:



The only thing is this ... I may have done this twice :o Actually I know that I did. Do you think that this will cause any issues?

Also: How do I use this again? If I type "gfortran" in the terminal, I get the following



So I believe that it needs something else form me as well. Let's say I want to run the following code:

implicit real*8 (a-h, o-z)


a=1
b=2
c=a+b
write(*,*) c

stop



end






What is the procedure?

Thanks again for all of your help!

K I am back now (after some sleep). Yes you have it compiled now, and running the sudo tar command will not harm anything if you did it twice.

As for running the program "gfortran" I believe it probably wants the command done in this type of format:

gfortran yourFortranFile

Where "yourFortranFile" is the file containing the fortran code you want to run. I am quite sure this is how it expects it since that is the way gcc works and it seems similar. If it complains about the file not being of a certain type (such as it wants the extension to be something in particular just change that with a text editor).

EDIT:

If you have xcode installed it does not necessarily mean you have the gcc compiler installed. It is *optional* to install the "developer tools" which includes gcc. If memory serves me correctly I think the optional install was something like 600-700mb in size. Insert your application install dvd (that came with your mac) and go about as if you were going to install xcode, but only select the developer tools) and that should do it.

balamw
Sep 3, 2010, 01:42 PM
If you have xcode installed it does not necessarily mean you have the gcc compiler installed. It is *optional* to install the "developer tools" which includes gcc. If memory serves me correctly I think the optional install was something like 600-700mb in size. Insert your application install dvd (that came with your mac) and go about as if you were going to install xcode, but only select the developer tools) and that should do it.

It may also be that you actually do need the gcc that was distributed with gfortran. A simplewhich gcc
gcc -v

Will tell you if gcc is installed an on the path and also what options were used to compile gcc and which version you have.

e.g.

$ which gcc
/usr/bin/gcc
$ gcc -v
Using built-in specs.
Target: i686-apple-darwin10
Configured with: /var/tmp/gcc/gcc-5664~38/src/configure --disable-checking --enable-werror --prefix=/usr --mandir=/share/man --enable-languages=c,objc,c++,obj-c++ --program-transform-name=/^[cg][^.-]*$/s/$/-4.2/ --with-slibdir=/usr/lib --build=i686-apple-darwin10 --program-prefix=i686-apple-darwin10- --host=x86_64-apple-darwin10 --target=i686-apple-darwin10 --with-gxx-include-dir=/include/c++/4.2.1
Thread model: posix
gcc version 4.2.1 (Apple Inc. build 5664)
$


EDIT: The default version doesn't have --enable-languages=fortran set.

B

Saladsamurai
Sep 3, 2010, 04:27 PM
Hi b! I ran the code at the terminal and the results were:

Last login: Fri Sep 3 17:22:35 on ttys000
Casey-Bennetts-MacBook-Pro:~ caseybennett$ which gcc
/usr/bin/gcc
Casey-Bennetts-MacBook-Pro:~ caseybennett$ gcc -v
Using built-in specs.
Target: i686-apple-darwin10
Configured with: /var/tmp/gcc/gcc-5646~6/src/configure --disable-checking --enable-werror --prefix=/usr --mandir=/share/man --enable-languages=c,objc,c++,obj-c++ --program-transform-name=/^[cg][^.-]*$/s/$/-4.2/ --with-slibdir=/usr/lib --build=i686-apple-darwin10 --with-gxx-include-dir=/include/c++/4.2.1 --program-prefix=i686-apple-darwin10- --host=x86_64-apple-darwin10 --target=i686-apple-darwin10
Thread model: posix
Casey-Bennetts-MacBook-Pro:~ caseybennett$



So it appears that gfortran is not enabled. Is that correct? Do you think I should now install the gcc included on that site?

Thanks!

EDIT: So I went ahead and impatiently installed the gcc compiler on the HPC Website. I again ran the command gcc -v and it returned the exact same info. --enable gfortran was NOT included. So I am thinking that the compilers are the same. And I am still getting the same "error trying to exec 'f951': execvp: No such file or directory" error.


Edit 2: I really don't understand now. I ran the command ls /usr/local/libexec/gcc/x86_64-apple-darwin10/4.6.0/f951 and it echoed back just fine. So clearly f951 IS there.

balamw
Sep 3, 2010, 06:00 PM
EDIT: So I went ahead and impatiently installed the gcc compiler on the HPC Website. I again ran the command gcc -v and it returned the exact same info. --enable gfortran was NOT included. So I am thinking that the compilers are the same. And I am still getting the same "error trying to exec 'f951': execvp: No such file or directory" error.

You probably have two gccs on your system now the one from Xcode and the one for gfortran. Did you install the gfortran one in /usr/local/bin? If not, substitute the right path.

If so, ether moving /usr/local/bin before /usr/bin in your path e.g.
export PATH=/usr/local/bin:$PATH

EDIT: You might also be able to set the environment variable CC to the exact path where the "right" gcc is located.

B

Saladsamurai
Sep 3, 2010, 07:44 PM
You probably have two gccs on your system now the one from Xcode and the one for gfortran. Did you install the gfortran one in /usr/local/bin? If not, substitute the right path.

If so, ether moving /usr/local/bin before /usr/bin in your path e.g.
export PATH=/usr/local/bin:$PATH

EDIT: You might also be able to set the environment variable CC to the exact path where the "right" gcc is located.

B

I'll be honest b, I don't really know what this means :o I did the install like it said to. I don't know how I would or would not have installed gfortran to /usr/local/bin or not. Was I supposed to instruct that to happen somewhere? I really do not know anything about these terminal commands either; I am just "monkey-see monkey-do" at this point. I don't even know what language these commands are in.


Here's a question I already know the answer to: Is there any way to easily UNINSTALL the gfortran and gcc compiler that I installed via Terminal? I would really like to just start fresh. If not ...meh ... I'll live.

balamw
Sep 3, 2010, 09:14 PM
Here's a question I already know the answer to: Is there any way to easily UNINSTALL the gfortran and gcc compiler that I installed via Terminal? I would really like to just start fresh. If not ...meh ... I'll live.

Not trivially. There is no installer, you basically just created a bunch of files somewhere in the /usr/local folder tree from the tar.gz file (like a ZIP or RAR) file.

I just checked. The gcc-snwleo-intel-bin.tar.gz archive is all you need. it contains both the right version of gfortran and gcc and installs them both to /usr/local/bin.

You just need to make sure that when it tries to run gcc it finds the /usr/local version not the Xcode /usr version.

The PATH statement I wrote before should get you past the compiler error, I'm not sure if the include and library paths are set right though, but we can deal with that.

EDIT:

Actually I had no problems with it even without the PATH statement.

create a test file using your code above as ~/Documents/deleteme.f

downloaded gcc-snwleo-intel-bin.tar.gz to ~/Downloads then in Terminal


$ cd /
$ sudo tar zxvf ~/Downloads/gcc-snwleo-intel-bin.tar.gz
$ cd ~/Documents
$ gfortran -o deleteme deleteme.f
$ ./deleteme
3.0000000000000000

Works fine. I wonder if you have some environment variables getting in the way. Can you post the output of the set command?

B

Saladsamurai
Sep 3, 2010, 10:57 PM
Hi b. What is the "set command" now? I really don't know what is going on here. Sorry. I need really explicit instructions like: Go to the terminal and type "xyz" and post the results back here.

Thanks again for all of your time guys.

balamw
Sep 4, 2010, 09:25 AM
What is the "set command" now?

That would be type$ set ;)

Let me put together a complete start to finish set of instructions that worked for me.

EDIT: I was trying to get the file download in the instructions, but I can't seem to get ti to download with curl.

So anyhow to repeat:

Assumptions:
Your source file is in ~/Documents/deleteme.f
gcc-snwleo-intel-bin.tar.gz has been downloaded as ~/Downloads/gcc-snwleo-intel-bin.tar.gz


$ cd /
$ sudo tar zxvf ~/Downloads/gcc-snwleo-intel-bin.tar.gz
$ cd ~/Documents
$ ls /usr/local/bin
$ which gfortran
$ which gcc
$ gfortran -o deleteme deleteme.f
$ ./deleteme
3.0000000000000000


if that doesn't work, something in your environment must be getting in the way, so type:

$ set

and post the results.

B