Compiling a Fortran 77 Code on Ubuntu

  • Context: Fortran 
  • Thread starter Thread starter mathia
  • Start date Start date
  • Tags Tags
    Code Fortran Ubuntu
Click For Summary

Discussion Overview

The discussion revolves around issues encountered while compiling and running Fortran 77 code on Ubuntu after successful execution on Cygwin in Windows 7. Participants explore potential causes for compilation and runtime errors, focusing on differences between environments, input file formats, and library dependencies.

Discussion Character

  • Technical explanation
  • Debate/contested
  • Experimental/applied

Main Points Raised

  • Mathia reports successful compilation of Fortran 77 code on Cygwin but encounters errors when compiling on Ubuntu using f77, while gfortran and f95 compile without issue.
  • Mathia experiences a runtime error related to integer reading, despite confidence that the input data is correct.
  • One participant suggests that the issue may stem from differences in the compiler versions or configurations between Cygwin and Ubuntu.
  • Another participant raises the possibility that the input file's encoding (e.g., UTF-8) could be causing the runtime error, prompting a question about how the file was transferred from Windows to Ubuntu.
  • A different suggestion is made to ensure the correct runtime libraries are installed on Ubuntu and to recompile the code using the package management system.

Areas of Agreement / Disagreement

Participants express various hypotheses regarding the cause of the issues, with no consensus reached on a definitive solution. Multiple competing views regarding potential causes and fixes remain present.

Contextual Notes

Limitations include uncertainty about the specific versions of compilers and libraries used, as well as the potential impact of file encoding on program execution. The discussion does not resolve whether the problem lies with the code, the environment, or the input data.

mathia
Messages
15
Reaction score
0
Hi,
I have a fortran 77 code, I compiled it on cygwin in windows 7 by using f77 and gfortran, and it has been working correctly.
I should use this code on Ubuntu, so I installed f77, gfortran and gcc compiler. I tried to comile that code by using f77 but it gave me the following error:
> f77 software.f -o software
> pickup_blockiirm:
> /usr/bin/f77: aborting compilation

The code was compiled successfully when I tried gfortran and f95, but whenever I want to run the program, it gives me the following error:
> At line 172 of file software.f
> Fortran runtime error: Bad value during integer read

I should mention that I'm sure that my input data is integer, and this code and input file works on cygwin smoothly!

Can anyone help me?
Regards,
Mathia
 
Technology news on Phys.org
mathia said:
Hi,
I have a fortran 77 code, I compiled it on cygwin in windows 7 by using f77 and gfortran, and it has been working correctly.
I should use this code on Ubuntu, so I installed f77, gfortran and gcc compiler. I tried to comile that code by using f77 but it gave me the following error:
> f77 software.f -o software
> pickup_blockiirm:
> /usr/bin/f77: aborting compilation

The code was compiled successfully when I tried gfortran and f95, but whenever I want to run the program, it gives me the following error:
> At line 172 of file software.f
> Fortran runtime error: Bad value during integer read

I should mention that I'm sure that my input data is integer, and this code and input file works on cygwin smoothly!

Can anyone help me?
Regards,
Mathia

Hey mathia and welcome to the forums.

This is just a suggestion, but since your problem is not so much with the language or even the compiler in general (but a specific version), you might get better luck posting to the dev boards for that particular port.

The only alternative to this that I think is feasible is if you had the compiler code in the raw source and then stepped through it yourself.

This sounds like a real pain to be in given that you have run it on a different platform with no problem... argh!
 
Hhhh...could it have something to do with the format or, rather encoding of the input file? So, I am not talking about the numbers in it, but, rather about UTF-8 versus something else? How did you bring your input file from Windows over to Ubuntu?

Other than that...for debugging purposes, I would shorten the program to just read one number and see if you can do that much...and start incrementing the scope of the program.
 
You probably have not got the right runtime libraries between the two systems.

Install the fortran system using the Ubuntu package management system and recompile your code on the Ubuntu installation. It should run correctly after that.
 

Similar threads

  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 8 ·
Replies
8
Views
4K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 2 ·
Replies
2
Views
8K
  • · Replies 4 ·
Replies
4
Views
3K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 17 ·
Replies
17
Views
7K
  • · Replies 2 ·
Replies
2
Views
6K
  • · Replies 3 ·
Replies
3
Views
4K