LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 10-09-2012, 08:59 PM   #1
carolasu
LQ Newbie
 
Registered: Oct 2012
Posts: 13

Rep: Reputation: Disabled
How to download and install gfortran on linux?


I want to download and install gfortran on my linux, so I typed command:

sudo apt-get install libgfortran3

But it doesn't seem that I downloaded it successfully. What else do I need to do? Thank you!
 
Old 10-09-2012, 09:11 PM   #2
nugat
Member
 
Registered: Sep 2012
Posts: 122

Rep: Reputation: 31
Quote:
Originally Posted by carolasu View Post
I want to download and install gfortran on my linux, so I typed command:

sudo apt-get install libgfortran3

But it doesn't seem that I downloaded it successfully. What else do I need to do? Thank you!
Why do you say that? Is there any error output in the terminal?

You can confirm that the package is installed with:

Code:
dpkg -l libgfortran3
 
Old 10-09-2012, 09:23 PM   #3
carolasu
LQ Newbie
 
Registered: Oct 2012
Posts: 13

Original Poster
Rep: Reputation: Disabled
Because when I was trying to use gfortran to compile my program, it said couldn't find it. And I couldn't find gfortran folder in my laptop.

(1)after I typed 'sudo apt-get install libgfortran3', it says following in terminal:

Reading package lists... Done
Building dependency tree
Reading state information... Done
The following NEW packages will be installed:
libgfortran3
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 357 kB of archives.
After this operation, 1,222 kB of additional disk space will be used.
Get:1 http://us.archive.ubuntu.com/ubuntu/ precise/main libgfortran3 amd64 4.6.3-1ubuntu5 [357 kB]
Fetched 357 kB in 1s (207 kB/s)
Selecting previously unselected package libgfortran3.
(Reading database ... 168458 files and directories currently installed.)
Unpacking libgfortran3 (from .../libgfortran3_4.6.3-1ubuntu5_amd64.deb) ...
Setting up libgfortran3 (4.6.3-1ubuntu5) ...
Processing triggers for libc-bin ...
ldconfig deferred processing now taking place

(2)I just typed 'dpkg -l libgfortran3', it says:

Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name Version Description
+++-==============-==============-============================================
ii libgfortran3 4.6.3-1ubuntu5 Runtime library for GNU Fortran applications


What does that mean? Thank you!

btw, how to use code frame like what you did?
 
Old 10-09-2012, 09:52 PM   #4
nugat
Member
 
Registered: Sep 2012
Posts: 122

Rep: Reputation: 31
Your apt-get output looks all right - you successfully installed the GNU Fortran libraries (not the binary, but more on that later).

Your dpkg output also confirms that your apt-get install of libgfortran3 was successful.

I think what you need is the GNU Fortran compiler package itself, try this:

Code:
sudo apt-get install gfortran
and you can create code syntax in your post either by literally typing the following around your code:

Code:
[ code ] your code here [/ code ]
just remove the spaces around "code" in the square brackets.

or just highlight the text w/your mouse and then press the # icon in the tool bar above the text box, which will enclose it in the same code brackets.

Last edited by nugat; 10-09-2012 at 09:53 PM. Reason: typo
 
2 members found this post helpful.
Old 10-09-2012, 10:04 PM   #5
carolasu
LQ Newbie
 
Registered: Oct 2012
Posts: 13

Original Poster
Rep: Reputation: Disabled
Thank you very much! It works! And thanks for telling me how to create code syntax.

What's the difference between GNU Fortran libraries and GNU Fortran compiler package?

Can I use GNU Fortran compiler package without GNU Fortran libraries?
 
Old 10-10-2012, 06:55 PM   #6
nugat
Member
 
Registered: Sep 2012
Posts: 122

Rep: Reputation: 31
Quote:
Originally Posted by carolasu View Post
What's the difference between GNU Fortran libraries and GNU Fortran compiler package?
Linux libraries are files that contain functions, routines and definitions in them. Binaries are compiled against these library modules, and can thus reference the functions and routines in the libraries. So when you run binary "binA" on a system that has been compiled with "libA", then the binary will expect to find "libA" on the system in the lib area.

But it is the binary program itself that you usually want, you just don't know you need the libraries sometimes. Usually, your package manager (yum, apt-get, etc.) will install and required library packages when installing a given binary. If you had done "apt-get install gfortran" first, it probably would have installed libgfortran3 along with it.

Quote:
Can I use GNU Fortran compiler package without GNU Fortran libraries?
I doubt it, but not sure. I don't really know what those libs do. If the gfortran binary was compiled with static Fortran libs, then you probably would not need them, but chances are, you'll be compiling something w/your fortran compiler and *that* program will be looking for Fortran libs...so go ahead and keep it. For that matter, you'll probably also want any "include" (or "header" or "devel") packages for GNU Fortran, too.
 
1 members found this post helpful.
Old 10-10-2012, 07:37 PM   #7
carolasu
LQ Newbie
 
Registered: Oct 2012
Posts: 13

Original Poster
Rep: Reputation: Disabled
Thank you! that's very clear.

So the "include" packages are included in the fortran libraries? I don't need to download "include" packages, do I?
I am using fortran 90. but sometimes i need to compile fortran 77.

Today I was trying to download and install lapack from terminal, so i typed
Code:
 sudo apt-get install lapack
It didn't work. Is that because lapack is not in Linux libraries? I downloaded lapack from website directly and installed it. But if I want to do that from terminal, what should I do?
 
Old 10-11-2012, 03:17 AM   #8
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen DK
Distribution: PCLinuxOS2023 Fedora38 + 50+ other Linux OS, for test only.
Posts: 17,511

Rep: Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641
# 7
Quote:
sudo apt-get install lapack
apt-file search lapack

sudo apt-get install liblapack-dev

I.e. the correct package name must be used for apt to install it.
About "includes" : Those files are in "lib<name>-dev" packages.

.
 
1 members found this post helpful.
Old 10-11-2012, 11:45 AM   #9
carolasu
LQ Newbie
 
Registered: Oct 2012
Posts: 13

Original Poster
Rep: Reputation: Disabled
I see, Thank you very much!
 
Old 10-11-2012, 02:03 PM   #10
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 10,659
Blog Entries: 4

Rep: Reputation: 3940Reputation: 3940Reputation: 3940Reputation: 3940Reputation: 3940Reputation: 3940Reputation: 3940Reputation: 3940Reputation: 3940Reputation: 3940Reputation: 3940
"For the record," here are a few reactions to what I've seen in this thread:

(1) "Can't find 'command'" is caused by a command not being found on the $PATH that is in effect at the time. Linux boxes often set-aside a /usr/local/... directory for the installation of "peculiar to this machine" software, and /usr/local/bin is sometimes not in that path. But, when you're installing from a package, that shouldn't be an issue.

(2) Every program that's written in a high-level language (like FORTRAN) expects to be able to call upon a fairly large set of "predefined" subroutines. These are stored in the language-specific library, and there might be more than one, e.g. to support high-precision calculations. Any program written in that language must have access to these libraries in order to run. Sometimes they also require various text files. But the language compiler is only needed if you are writing software in that language.

(3) After any library is installed or updated, the (privileged) ldconfig command must be run. Usually this takes place automatically as part of package-installation. If your program "can't find the library," but you know it's there, this is probably why.
 
1 members found this post helpful.
Old 10-11-2012, 04:25 PM   #11
carolasu
LQ Newbie
 
Registered: Oct 2012
Posts: 13

Original Poster
Rep: Reputation: Disabled
I see, Thank you! so,

(1)if I reset the path, I should be able to find it.

(2)that make sense.

(3)ldconfig: list of directions of configurations? It should help me to find the libraries, how come my program can't find the library after this command run?
 
Old 10-11-2012, 06:21 PM   #12
nugat
Member
 
Registered: Sep 2012
Posts: 122

Rep: Reputation: 31
Quote:
Originally Posted by carolasu View Post
Thank you! that's very clear.

So the "include" packages are included in the fortran libraries?
Well, occasionally they are, but more often, they are in "-dev" packages (on Debian-based distros), as somebody pointed out. In this case, libgfortran3 only contains:

Code:
/usr/lib/libgfortran.so.3
/usr/lib/libgfortran.so.3.0.0
/usr/share/doc/libgfortran3
(the .so files are the libraries, and one is probably a link to the other) and gfortran only contains:

Code:
/usr/bin/gfortran
/usr/bin/i486-linux-gnu-gfortran
/usr/share/doc/gfortran
(again, one of those binaries is likely a link to the other). So, between those two packages, you should be able to run the compiler (/usr/bin/gfortran).

Quote:
I don't need to download "include" packages, do I?
I don't see any GNU Fortran specific dev packages (you can look here) so you are probably good. If you do find that you need compiler header/include files, you can grab libc6-dev to see if that satisfies things.
 
1 members found this post helpful.
Old 10-12-2012, 12:18 PM   #13
carolasu
LQ Newbie
 
Registered: Oct 2012
Posts: 13

Original Poster
Rep: Reputation: Disabled
I see, thanks a lot!
 
  


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
[SOLVED] gfortran v4.4.1 run in linux machine gives runtime error ladhikari Programming 2 09-11-2010 12:19 PM
gfortran download elnaz Programming 4 11-06-2009 08:49 AM
which linux should I download/install? f.martin Linux - Distributions 6 10-05-2006 09:22 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 01:19 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