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! |
Quote:
You can confirm that the package is installed with: Code:
dpkg -l libgfortran3 |
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? |
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 Code:
[ code ] your code here [/ code ] 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. |
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? |
Quote:
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:
|
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 |
# 7
Quote:
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. . |
I see, Thank you very much!
|
"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. |
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? |
Quote:
Code:
/usr/lib/libgfortran.so.3 Code:
/usr/bin/gfortran Quote:
|
I see, thanks a lot!
|
All times are GMT -5. The time now is 07:08 PM. |