4

I just downloaded Ubuntu 19.04. I want to install a program that needs the g77 compiler to run. I followed the instructions explained in Install G77 on Ubuntu >=14.04, but when typing the command

sudo apt install g77

an error appears:

E: Package 'g77' has no installation candidate

How can I fix this problem?

  • Ubuntu 12.04 is well past End of Life and not supported here any more. YOu need to update to a supported Ubuntu release to get continued support. – Thomas Ward Jun 30 '19 at 1:52
  • many thanks for your answer but I tried this command but doesn't work with me ... but when following the same instructions I used before but adding to them " [trusted=yes] " to the four lines of deb, the problem is solved – Shaimaa Mostafa Jul 2 '19 at 23:13
2

Package g77 is not available in any currently supported version of Ubuntu, but is referred to by another package. This may mean that the package is missing, has been obsoleted, or is only available from another source. The fort77 utility is the interface to the Fortran compilation system. It will accept the full Fortran 77 language defined by the ANSI X3.9-1978 standard. fort77 can be installed in all currently supported versions of Ubuntu by running the following commands:

sudo apt update  
sudo apt install fort77  

To test fort77 save this Hello world Fortran 77 code as hello-world.f:

      program hello_world
      implicit none
c
      character*32 text
c
      text = 'Hello World!'
      write (*,*) text
c
      end  

To compile the code run the following command:

fort77 hello-world.f -o hello-world  

This creates an executable file named hello-world. Run the program by typing ./hello-world and then press Enter.

Results:

Hello World! 

GNU Fortran 95 compiler can also be installed in all currently supported versions of Ubuntu by running the following command:

sudo apt install gfortran  

This is the GNU Fortran 95 compiler, which compiles Fortran 95 on platforms supported by the gcc compiler. It uses the gcc backend to generate optimized code. gfortran is backwards compatible with the same Hello world code example shown above, and the executable file that it generates will run. gfortran is not backwards compatible with all Fortran 77 code, so sometimes it's necessary to install fort77 for full Fortran 77 compatibility.

| improve this answer | |
  • Many thanks for your help .... the problem is solved but another problem appeared when using 'make' command to install HYPODD program .... these lines appears : $ /usr/bin/ld: cannot find crt1.o: No such file or directory $ $ /usr/bin/ld: cannot find crti.o: No such file or directory $ knowing that these files are existed in the following path "/usr/libx32/crti.o /usr/mipsel-linux-gnu/lib/crti.o /usr/lib32/crti.o /usr/lib/x86_64-linux-gnu/crti.o" how can I fix this problem? – Shaimaa Mostafa Jul 3 '19 at 11:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.