Fotran modules not found VS Command not found ?!

Dear all,
hope this is the right place to ask for help, if not please just direct me to the appropriate one and I will delete this topic.

Trying to build a Flatpak for my program Atomes: https://atomes.ipcms.fr/

I am having some issue(s), the issue depending on the method I use to build the Flatpak, with the following command:

$ flatpak-builder atomes org.flatpak.atomes.yml
  1. I use the autotools buildsystem:
app-id: org.flatpak.atomes
runtime: org.freedesktop.Platform.GL.default
runtime-version: '21.08'
sdk: org.freedesktop.Sdk
command: atomes
modules:
  - shared-modules/glu/glu-9.json
  - name: atomes 
    buildsystem: autotools
    no-autogen: true
    config-opts:
      - --enable-flatpak
    sources:
      - type: archive
        url: https://raw.githubusercontent.com/Slookeur/Atomes-flatpak-build/main/atomes-1.1.0.tar.gz
        sha256: 5be58a89f03775f22612b09199b355dd081e9ad1df4ce9f7454fffac211573e9

Then I cannot build the Flatpak, during the compilation gfortran is yelling at me that he cannot find the fortran modules (that were compiled previously, and are located in the appropriate place … go figure).
I tried to used all the related gfortran options here (-I, -J, -fintrinsic-modules-path) to try to correct this issue … nothing works, and gfortran remains unhappy, so I decided to try something else …

  1. Using the simple buildsystem
app-id: org.flatpak.atomes
runtime: org.freedesktop.Platform.GL.default
runtime-version: '21.08'
sdk: org.freedesktop.Sdk
command: atomes
modules:
  - shared-modules/glu/glu-9.json
  - name: atomes 
    buildsystem: simple
    build-commands:
      - ./configure --prefix=/app --enable-flatpak
      - make
      - make install
    sources:
      - type: archive
        url: https://raw.githubusercontent.com/Slookeur/Atomes-flatpak-build/main/atomes-1.1.0.tar.gz
        sha256: 5be58a89f03775f22612b09199b355dd081e9ad1df4ce9f7454fffac211573e9

Then no problem to build the Flatpak !
For some reason here, gfortran is perfectly happy, no issue what so ever … but when I test it, using:

$ flatpak-builder --user --install --force-clean build-dir org.flatpak.atomes.yml
$ flatpak run org.flatpak.atomes

Then Flatpak is trying to launch the app but fails saying that it cannot find the ‘atomes’ command:

bwrap: execvp /app/bin/atomes: No such file or directory

I would really appreciate your ideas/help on the matter.
Thanks in advance.

Sébastien Le Roux

1 Like

This is a reply to my-self, it might help others:

I noticed that with autotools the build is automatically // (-j option),
and that is why I had the issue with the missing fortran modules.
To avoid having errors it is mandatory to ask for the fortran modules to be built first,
and that happens in the file ‘Makefile.am’, in my case I had:

atomes_fortran = $(atomes_fortran_modules) $(atomes_fortran_files)

And I needed to add the following line:

atomes_fortran = $(atomes_fortran_modules) $(atomes_fortran_files)
$(patsubst %.F90,%.o,$(atomes_fortran_files)): $(patsubst %.F90,%.o,$(atomes_fortran_modules))

And that allows the ‘autotools’ build system to work as expected.

After the build I managed to run my app using:

flatpak run --socket=session-bus --nosocket=fallback-x11 --socket=x11 org.flatpak.atomes

The ‘–socket=session-bus’ correct the DBus error, while ‘x11’ related options correct a GTK display error, so now the flatpak seems to run fine, not sure that this way of doing is appropriate,
any advise would be appreciated.

S.