Linux - NewbieThis 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
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I tried to compile fortran g77 in shell but I couldnt. I folowed the procedure and typed
$ g77 source.for
and the answer was bash: $: command not found
I don't understand why shell didn't recognize this symbol, $
Perhaps I made a mistake in installation procedure... Firstly, I made a file named source in home directoy and copied compat-g77 and gcc-fortran rpm packages into. Secondly, i installed these rpm packages with yast, and finally checked them...
As I undersood the last step shoul be to compile g77 in shell...?!
But I have problem with that, and I need a step by step procedure
What exactly are you trying to do? Are you trying to literally compile g77 from source, or are you trying to compile a Fortran 77 program using g77? If the latter, then you just need to enter "g77 source.for" if your source code is in source.for. When you see a "$", that's just indicating the prompt, so you don't need to type it.
Do you have a Fortran program in a file called source.for? If so, make sure that you are in the same directory as the source.for file when you try to compile the program. You can use cd to change directories, pwd to tell you what directory you arein, and ls to list the contents of the directory.
$ g77 source.for
and the answer was bash: $: command not found
Quote:
I tried to type g77 source.for(without $), but the answer was the same
g77: source.for: no such file or directory
The answer is definitively not the same. As already pointed out, in the first case the "$" sign is not part of a linux command but a symbol which means "command prompt". On your OpenSuSE box you should have something like
Code:
allan@linux-c4ug:~>
as command prompt. In the second case, the error message tells that g77 could not find the file source.for in the current working directory. Anyway, what is source.for supposed to be? A Fortran code you wrote by yourself or some Fortran example you downloaded from somewhere?
Stop typing in the "$" before the command. That doesn't make sense. Sometimes it is posted just to show the prompt.
Make sure that you are in the directory with the fortran program, or include the path with the file.
I still can't get what you are trying to do. You mentioned downloading fortran rpms. Are you trying to install fortran, and what where the (full) names of the rpm packages. If the package ends in .src.rpm, then this is a source rpm, which you would use the rpmbuild command to install, or create a binary rpm file.
If you want to install fortran from a binary rpm package, you would use the "rpm -Uhv <package-file>" command, or better yet use YaST to install it from cd/dvd or the net.
What is with the "source.for" file? That has nothing to do with rpm.
---
Check if the fortran packages are installed:
rpm -qi gcc-fortran
for example.
My SuSE version doesn't have a a g77-compat package. Does "which g77" return anything. How about "which gfortran" or "which gfortran-4.2"
I checked, it's installed, and Source RMP is gcc-4.0.2_20050901-3.src.rpm
As I already mentioned in your previous thread, this package is not from the official OpenSuSE repository. It would be a good idea use C compilers built from the official packager/developer.
Anyway, as jschiwal already pointed out, it is not clear what you're trying to accomplish. In order to get some good advice to solve your issue, you should try to elaborate your question a little more.
I will try to be clear.
I have to install fortran 77...!
As I understood I should download two rpm packages compat-g77 and gcc-fortran and installed them with yast. Final step would be compile fortran in shell. Perhaps this isn't correct procedure...?
I don't know how to run fortran 77...!
(Source.for is file I created by myself in home directory. I copied rpm packages into source.for.)
Ok, thanks. The Yast software manager let you to select packages you want to install, then:
1. it takes care of all the dependencies (that is it automatically selects extra required packages),
2. downloads all the selected packages,
3. installs them
4. update the system configuration and caches.
So if you have a working internet connection and you properly configured the software repositories, you don't have to worry about manually downloading packages or compiling from source. Just select the software you want to install and after a bunch of minutes you have a working fortran 77 compiler at hand.
At this point it looks like you have already installed the downloaded packages. To be sure, simply issue the command
Code:
rpm -q gcc-fortran compat-g77
this look at the internal database of installed packages and tells you if those RPMs are installed. Indeed, you don't need both the above packages: the gcc-fortran is enough, while the g77 is an older version of the GNU fortran compiler which OpenSuSE kept for compatibility issues.
Quote:
I don't know how to run fortran 77...!
(Source.for is file I created by myself in home directory. I copied rpm packages into source.for.)
The last step is not correct. Once you have the package gfortran and/or the package compat-g77 installed you don't need anything else. Just start to write your own fortran code and compile. For example, if you write a simple program and call it my_program.f you can simply do (assuming gcc-fortran)
Code:
gfortran my_program.f
this will create an executable called a.out by default. To execute it you will launch as any other command. Hope this is clear.
If you want I can give you a hand to correctly set-up the packages repositories in Yast, since it seems the starting point of the whole issue.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.