LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
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 02-02-2008, 01:26 PM   #1
allan_bg
LQ Newbie
 
Registered: Jan 2008
Posts: 10

Rep: Reputation: 0
how to compile rpm package in shell


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

Last edited by allan_bg; 02-02-2008 at 01:28 PM.
 
Old 02-02-2008, 01:28 PM   #2
Nylex
LQ Addict
 
Registered: Jul 2003
Location: London, UK
Distribution: Slackware
Posts: 7,464

Rep: Reputation: Disabled
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.
 
Old 02-02-2008, 01:29 PM   #3
{BBI}Nexus{BBI}
Senior Member
 
Registered: Jan 2005
Location: Nottingham, UK
Distribution: Mageia 6, KDE Neon
Posts: 4,313

Rep: Reputation: 212Reputation: 212Reputation: 212
I don't think you need to use $. Where did you find the procedure?

Last edited by {BBI}Nexus{BBI}; 02-02-2008 at 01:30 PM. Reason: Typo
 
Old 02-02-2008, 02:36 PM   #4
allan_bg
LQ Newbie
 
Registered: Jan 2008
Posts: 10

Original Poster
Rep: Reputation: 0
I tried to type g77 source.for(without $), but the answer was the same
g77: source.for: no such file or directory

Perhaps my source code is not in source.for. Where I made a mistake? What can I do now?
 
Old 02-02-2008, 02:38 PM   #5
btmiller
Senior Member
 
Registered: May 2004
Location: In the DC 'burbs
Distribution: Arch, Scientific Linux, Debian, Ubuntu
Posts: 4,290

Rep: Reputation: 378Reputation: 378Reputation: 378Reputation: 378
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.
 
Old 02-02-2008, 03:15 PM   #6
Nylex
LQ Addict
 
Registered: Jul 2003
Location: London, UK
Distribution: Slackware
Posts: 7,464

Rep: Reputation: Disabled
Surely you should know which file your code is in .
 
Old 02-02-2008, 04:39 PM   #7
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983
Quote:
$ 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?

Last edited by colucix; 02-02-2008 at 04:40 PM.
 
Old 02-02-2008, 06:08 PM   #8
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682
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"
 
Old 02-03-2008, 05:36 AM   #9
allan_bg
LQ Newbie
 
Registered: Jan 2008
Posts: 10

Original Poster
Rep: Reputation: 0
Question

Check if the fortran packages are installed:
rpm -qi gcc-fortran
for example.

I checked, it's installed, and Source RMP is gcc-4.0.2_20050901-3.src.rpm


When I typed g77 source.for the answer was

/usr/lib/gcc-lib/i586-suse-linux/3.3.5/../../../libfrtbegin.a(frtbegin.o): In function `main':http://linuxquestions.cachefly.net/i...s_lq/icon5.gif
: undefined reference to `MAIN__'
 
Old 02-03-2008, 06:03 AM   #10
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983
Quote:
Originally Posted by allan_bg View Post
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.
 
Old 02-03-2008, 12:39 PM   #11
allan_bg
LQ Newbie
 
Registered: Jan 2008
Posts: 10

Original Poster
Rep: Reputation: 0
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.)

Last edited by allan_bg; 02-03-2008 at 12:40 PM.
 
Old 02-03-2008, 12:58 PM   #12
AceofSpades19
Senior Member
 
Registered: Feb 2007
Location: Chilliwack,BC.Canada
Distribution: Slackware64 -current
Posts: 2,079

Rep: Reputation: 58
You don't need to compile fortran if you already have it installed. if you have fortran77 installed
 
Old 02-03-2008, 01:17 PM   #13
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983
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.
 
Old 02-03-2008, 04:22 PM   #14
allan_bg
LQ Newbie
 
Registered: Jan 2008
Posts: 10

Original Poster
Rep: Reputation: 0
I typed rpm -q gcc-fortran compat-g77 and I got this

gcc-fortran-4.0.2_20050901-3
compat-g77-3.3.5-2

When I typed gcc-fortran my_program.f I got

bash: gcc-fortran: command not found

Yes, I need a hand to correctly set-up the packages repositories in yast
 
Old 02-03-2008, 04:28 PM   #15
AceofSpades19
Senior Member
 
Registered: Feb 2007
Location: Chilliwack,BC.Canada
Distribution: Slackware64 -current
Posts: 2,079

Rep: Reputation: 58
the correct command is gfortran not gcc-fortran
 
  


Reply



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
rpm -i --prefix=/home/user package.src.rpm doesn't work? registering Linux - Software 2 07-18-2007 11:28 AM
What is difference between an i386 rpm and an i686 rpm package? rajat Linux - Software 2 03-25-2007 10:55 PM
Removing an RPM package from within another RPM package jimwelc Linux - Software 7 05-12-2006 02:13 PM
How to Find the Compile Time Options of a RPM Package spurgeonb Red Hat 0 11-13-2004 11:00 PM
can reinstall the rpm package without delete the rpm package eye Red Hat 1 10-20-2003 07:53 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 04:14 AM.

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
Open Source Consulting | Domain Registration