How to install gfrortran?

Please don’t sent me to flatpak. I waste 3 hours to realize how it works but can’t do nothing. Can anybody help me and write step by step guide? Thanks.

Sorry, but there is no way to do it on Endless OS other than flatpak!

This will get you a sandbox with the gfortran compiler:

flatpak install flathub org.freedesktop.Sdk
flatpak install flathub org.freedesktop.Sdk.Extension.gfortran-62
flatpak run org.freedesktop.Sdk//1.6
source /usr/lib/sdk/gfortran-62/use.sh

I found that by reading https://github.com/flathub/org.octave.Octave/issues/3 and doing a bit of trial and error.

Thank you very much! I maneged to run two commands with sudo, but third
“flatpak run org.freedesktop.Sdk” doesn’t work.
Terminal write me:
“error: app/org.freedesktop.Sdk/x86_64/master not installed”
What can I do to fix it? Thanks.

Sorry, my mistake. You have to add //1.6 — I went back and added this to my post.

Sorry, dear Ptomato, but it’s not work. Terminal gave me in output “sh-4.3#” and was hanging and doing nothing more than 5 minutes. Then I closed it. What’s wrong with endless or gfortran?

It is working :smile: That’s not hanging, it’s just a different terminal prompt inside the flatpak sandbox, waiting for more input. If you type the last line, then you should be able to run gfortran.

I have done all you advise me, Dear Ptomato, but when i type gfortran in terminal, it say me “command not found”. What’s wrong? codeblocks can’t find gfortran too. Why do you make life so hard ? :slight_smile: Can you return us apt-get install ? In debian and ubuntu it’s so easy.

$ flatpak run org.freedesktop.Sdk//1.6
sh-4.3$ source /usr/lib/sdk/gfortran-62/use.sh
sh-4.3$ cat >/tmp/main.f95
program main
  implicit none 
  write(*,*) "Hello World!"
end
sh-4.3$ gfortran -o /tmp/main /tmp/main.f95
sh-4.3$ LD_LIBRARY_PATH=/usr/lib/sdk/gfortran-62/lib /tmp/main 
 Hello World!

As per the Octave flatpak bug linked above, things don’t necessarily work as one might hope, as the LD_LIBRARY_PATH bit might suggest!

Obviously, dear WJT, we use other endless
I obtained next

sergiy@endless:~$ sudo flatpak run org.freedesktop.Sdk//1.6
[sudo] password for sergiy:
sh-4.3# gfortran -o main main.f90
sh: gfortran: command not found
sh-4.3#

@Sergiy_Yaremchenko you’re missing a key step, you need to run this:

source /usr/lib/sdk/gfortran-62/use.sh

in the subshell.

Thank you very much, dear Wjt and Ptomato. it’s working. bu i can’t find files main and main.95 in folder /tmp. Where are they? :slight_smile: Obviously, to work with gfortan in this form is impossible. I think it’s impossible too to use codeblocks with such commands. I’m so sad. But. Thanks , guys, for your answers and work.

I don’t think it will work with Codeblocks, in any case, unless you can start the Codeblocks sandbox with the Fortran extension and run the use.sh script within Codeblocks.