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:


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.

  • 1
    What is the output of ls -l sfsptest2.exe? – Seth Apr 2 '15 at 19:34
  • 1
    @WR Try running chmod +x sfsptest2.exe and then try again. – Seth Apr 2 '15 at 19:40
  • 1
    I am not sure if this helps but, the *.exe file was produced by compiling FORTRAN code in Windows with a FORTRAN 95 compiler. – edesz Apr 2 '15 at 19:46
  • 1
    @WR why would a chmod create new files? It will set execute permissions... so do the 1st command Seth posted and it should show "rwx". Then execute the program again. – Rinzwind Apr 2 '15 at 19:52
  • 1
    Do you have the original source code of the Fortran program, or are you stuck with the version compiled for Windows? Either way, you won't be able to run it as it is. – David Foerster Apr 2 '15 at 22:22

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++.


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 :)


Your program was compiled for Windows, it won't run on Linux. Compiling is basically a way of translating the programming language that a program was written in (so, something a human understands) into a language that a computer understands. What you have here is a program that has been translated from Chinese to French (Windows) and you are trying to read it in English (Linux). That won't work.

You will either need to recompile on Linux or attempt to run it via Wine.

  • I have tried Wine. It runs but, (I think that) due to the difference in compiler (gfortran in Ubuntu vs something else in Windows), it is not successful. The error message points to WINE developer notes - I have already done an exhaustive search on that and the displayed messages do not lead me to anything. My only attempt left is running it in native Ubuntu and getting something to happen. Even if it is an error message it might lead me to something else. That's where I'm at. – edesz Apr 3 '15 at 15:53
  • @WR and there's no way of getting the code? That would be your best bet. Either that, or running it in a virtual machine running Windows. – terdon Apr 3 '15 at 15:55
  • 1
    @WR, no, (g)Fortran is not even in the equation. You are not dealing with compilers here, you are dealing with the finished product. It might be worth taking a shot at making it run under Wine, it could be easier than you think - but that's another AskUbuntu question :) – Tobia Tesan Apr 3 '15 at 16:56
  • 1
    Thank you. I now understand the problem. My questions here have been answered. Thanks for your patience. Appreciate it. – edesz Apr 3 '15 at 17:47

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.