Saturday, May 4, 2024
2
rated 0 times [  2] [ 0]  / answers: 1 / hits: 5176  / 3 Years ago, fri, september 3, 2021, 11:02:32

I am trying to run a FORTRAN program in Ubuntu. Code has been compiled and the result is that I have the following 2 files:



sfsptest2.exe
yyVx6634XC.INP


These files are located in: /home/user_test/FileList



At the Ubuntu command line, I enter:



cd FileList/
./sfsptest2.exe yyVx6634XC.INP


I get



bash: ./sfsptest2.exe: Permission denied


If I use:



gfortran sfsptest2.exe yyVx6634XC.INP


I get this error message:



/usr/bin/ld:yyVx6634XC.INP: file format not recognized: treating like linker script
/usr/bin/ld:yyVx6634XC.INP:1: syntax error
collect2: error: ld returned 1 exit status


Is there a way to run this FORTRAN .exe file from the terminal in Ubuntu?



EDIT:
The *.exe file was produced in Windows with a FORTRAN 95 compiler.


More From » command-line

 Answers
7

It is important to understand the following:



Your .exe program is not a FORTRAN program, it's a Windows executable, and nor Bash nor a FORTRAN compiler will understand it.



When I say that it's not a FORTRAN program I really mean it.



It might have been a FORTRAN listing on some engineer's computer, but once compiled, it is indistinguishable(*) from a Windows executable built in BASIC, Pascal or C++.



http://en.wikipedia.org/wiki/Compiler



So the way to go here is to load it in a Windows emulator - Wine, for example:



$ wine yourprogram.exe



Of course you can also run it in a Windows virtual machine using VirtualBox or the virtualization environment of your choice.



If you can get the FORTRAN sources (and it's not overly complex or dependent on specific libraries) you might want to try to compile it under Linux.



(*) This is not entirely correct, but that's the gist of it unless you want to delve into the topics of reverse engineering and decompilation :)


[#20685] Saturday, September 4, 2021, 3 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
gerrin

Total Points: 347
Total Questions: 109
Total Answers: 121

Location: Tanzania
Member since Fri, Oct 29, 2021
3 Years ago
;