f77 fortran compiler

The suggestion of wiki is a nice touch. I'll have to bookmark that for future reference.

My understanding is that Fortran standard version is important. So having something like lang/f2c with its F77 only would not be my first choice.

If I had to choose one - I would go with lang/lfortran. See lfortran home page for list of features (Fortran 2018 parsing, etc).
 
is f77 available on freeBSD. this is a GCC application. We found it on a recent version of Linux mint. machine says 64 bit kernel option not found. does that mean you would have to recompile the kernel?
 
is f77 available on freeBSD. this is a GCC application. We found it on a recent version of Linux mint. machine says 64 bit kernel option not found. does that mean you would have to recompile the kernel?

Please quote the actual error message and what you did.
 
As it appears from your link that message dates from 2008; some 1.5 decade ago. You also posted elsewhere*:
is f77 available on freeBSD. this is a GCC application. We found it on a recent version of Linux mint. machine says 64 bit kernel option not found. does that mean you would have to recompile the kernel?

It would help if you stated your question/problem or desired source code to compile more clearly. **

If you have a (recent) Fortran (cross-)compiler from the FreeBSD ports collection that does not compile or gives you some problems, please specify what you have tried and what (error) output you got.

If you want to use a Linux supported Fortran compiler that satisfies your requirements, you could make use of FreeBSD support for Linux (Linux compatibility layer); see for example Part II: Common Tasks of the FreeBSD Handbook.

If you want to use a Linux Fortran compiler, you could also run Linux virtualized on bhyve (FreeBSD bhyve intro), if so desired.

These remarks are all made from a helicopter-like point of view; more specifics from your part will in all likelihood result in more specific answers from (other) forum users.
___
* that would probably be considered as cross-posting.
** perhaps refer to How to ask questions the smart way; Be precise and informative about your problem
 
The GNU gcc suite Fortran compiler used to be called g77, but it is no longer supported. As of gcc-4.0 (a long time ago) the name of the GNU Fortran project is gfortran.

You can use the GNU compilers on FreeBSD, but they are optional.

Fortran is installed e.g. as gfortran13 with the gcc13 suite:
Code:
$ grep -i fortran /usr/ports/lang/gcc13/Makefile | grep "LANGUAGES:"
LANGUAGES:=    c,c++,objc,fortran,jit
You can install the gcc13 suite with sudo pkg install gcc13.

Howerver, FreeBSD uses the LLVM compiler toolset natively. And as digifuzzy indicated, lang/lfortran provides a really good option.

lang/f2c is still an option if all you want is f77, but significantly less capable than the modern compilers.
 
And if one wants FOERTRAN IV?
Then one needs to check if the fossilisation is allowing for the fingers to still move.
Heck, that is OLD. Maybe you need that for compatibility reasons (I know, I have some code that is that ancient) but that was not written by me.
 
The other thread has a lot more answers. It seems easy to install the Gnu Fortran compilar. We should close this thread.
Merged the threads. Probably should have moved the posts, the order is a bit wonky now.
 
I heard that the IBM implementation had some interesting implementation details (aka bugs) which made it pretty interesting. Me old dad had stories about it. But for anything but sentimental reasons, I would suggest using a newer version with better warnings and features.
 
The GNU gcc suite Fortran compiler used to be called g77, but it is no longer supported. As of gcc-4.0 (a long time ago) the name of the GNU Fortran project is gfortran.

You can use the GNU compilers on FreeBSD, but they are optional.

Fortran is installed e.g. as gfortran13 with the gcc13 suite:
Code:
$ grep -i fortran /usr/ports/lang/gcc13/Makefile | grep "LANGUAGES:"
LANGUAGES:=    c,c++,objc,fortran,jit
You can install the gcc13 suite with sudo pkg install gcc13.

Howerver, FreeBSD uses the LLVM compiler toolset natively. And as digifuzzy indicated, lang/lfortran provides a really good option.

lang/f2c is still an option if all you want is f77, but significantly less capable than the modern compilers.
thankyou for your response. your comments are very interesting. regarding gfortran. I wonder how can I modify freebsd to include gfortran. And your comment about a gcc compiler being optional. I am not in front of my computer that has BSD 12 on it. But my recollection is that if you type gcc at the command line the computer doesn't say not found but says something like command incomplete. that it needs a fn to respond to your command. Does that indicate there is a default gcc compiler on board? if so how do you find out what it is? regarding /lang/gcc13. Verbiage on the freebsd website promises that it is available. But my friend looked in usr/ports/lang/ and gcc13 wasn't there. what was there wss:gcc,gcc10,gcc11,gcc48,gcc8,gcc9,gcc11 -devel and gcc12 -devel. But no gcc13. This begs the question: how do you add it? I want to use freebsd not linux but my friend is able to compile an ANSI 77 fortran source file on his mint box. that has gcc version 7.5.0 installed using compiler f77 and extension .for. Is there a way to add gcc 7.5.0 to bsd? error messages vary depending on what file extension is used. and regarding lang/f2c. ftoc converts fortran code to c . it is not a compiler.
 
As it appears from your link that message dates from 2008; some 1.5 decade ago. You also posted elsewhere*:


It would help if you stated your question/problem or desired source code to compile more clearly. **

If you have a (recent) Fortran (cross-)compiler from the FreeBSD ports collection that does not compile or gives you some problems, please specify what you have tried and what (error) output you got.

If you want to use a Linux supported Fortran compiler that satisfies your requirements, you could make use of FreeBSD support for Linux (Linux compatibility layer); see for example Part II: Common Tasks of the FreeBSD Handbook.

If you want to use a Linux Fortran compiler, you could also run Linux virtualized on bhyve (FreeBSD bhyve intro), if so desired.

These remarks are all made from a helicopter-like point of view; more specifics from your part will in all likelihood result in more specific answers from (other) forum users.
___
* that would probably be considered as cross-posting.
** perhaps refer to How to ask questions the smart way; Be precise and informative about your problem
OK. So we have a fortran source code listing. It most certainly was written per ANSI STD 77. I have not been able to get it to compile clean (without errors) on my box with freebsd version 12. It appears I can check to see what version of gcc is installed default using the command gcc -v. I will try that tonight. My friend was able to compile the code clean and produce an execuable file using the command f77 fn.for on his box with with Linux Mint os. The command name and file extension appear important as different combinations give different error codes. the linux box appears to have gcc version 7.5.0 installed and uses gfortran for ansi std 77. It appears gfortran is how gcc provides the ansi std 77 compiler.
Another responder said gfortran is available in freebsd through gcc13. but checking ports/lang gcc13 is not there. Lfortran is available but it doesn't compile clean. That may be because there is a specific compile command/extension that must be used to invoke an ansi std compiler using LFORTRAN.
 
But my recollection is that if you type gcc at the command line the computer doesn't say not found
The response you get depends on the shell you are using. Most will say:
Code:
[strand.560] $ gcc
ksh: gcc: not found
how can I modify freebsd to include gfortran.
I don't run FreeBSD 12, but it looks like gcc11 is the most recent gcc suite available on FreeBSD 12.x. So install it with sudo pkg install gcc11. If sudo doesn't work, just do it while logged in as root. If gcc11 is not available, try gcc10...
It appears I can check to see what version of gcc is installed default using the command gcc -v.
That will work on Linux, but not on FreeBSD. The gcc compilers on FreeBSD all have an integer suffix on their name to identify the version (it allows multiple version of gcc to co-exist). Use ls -lad /usr/local/bin/gcc?? or ls -lad /usr/local/bin/gfortran??
extension .for
gfortran is a modern compiler, and recognises many file name extensions, including .f, .for, .ftn, .f90, .f95, .f03 and .f0. It is backwards compatible with Fortran 77.
Is there a way to add gcc 7.5.0 to bsd?
There may be, but gcc7.5 is several years old and not currently supported on FreeBSD. You would probably have to acquire and compile it from source. It may have problems. You don't want it. You want a current (not "devel") package, built, maintained, patched, and provided freely by a team of experts.
ftoc converts fortran code to c . it is not a compiler.
Quite so. You convert the Fortran 77 to C and then use the C compiler of your choice. Here is a simple example of how to compile a single Fortran 77 source file (I'm using the native LLVM C compiler here, but it does not matter which C compiler I use):
Code:
[strand.628] $ cat xx.f
       write(6,1000)
1000   format("Hello world")
       stop
       end
[strand.629] $ f2c xx.f >xx.c
xx.f:
   MAIN:
[strand.630] $ cc -I /usr/local/include -o xx xx.c /usr/local/lib/libf2c.a -lm
[strand.631] $ ./xx
Hello world
For more complex sets of source code files you would be likely to modify the configuration of make(1) to correctly manage the compiling and linking processes.

Don't ignore the f2c option. If you have a one-off issue to get a Fortran 77 application compiled and running, it's a serious contender. Performance of the resultant executable may not be optimal. If you care about that, then gfortran and lfortran are quite likely to be superior.
 
Back
Top