[SOLVED] Error while build Dynare 6.0 from source

Hello,

I’m trying to build Dynare from source on Linux ( 4.18.0-477.27.1.el8_8.x86_64 ). I’ve followed the instructions in the README.md and I’m stuck with the following error:

[outscale@ip-192-168-49-46 dynare-6.0]$ ~/.local/bin/meson setup -Dmatlab_path=/home/outscale/matlab -Dprefix=/home/outscale/dynare/dynare-6.0 -Dfortran_args="[ '-B', '/home/$USER/dynare/slicot']" -Dbuildtype=debugoptimized build-matlab /tmp/dynare-6.0/
The Meson build system
Version: 1.3.2
Source dir: /tmp/dynare-6.0
Build dir: /tmp/dynare-6.0/build-matlab
Build type: native build
Project name: dynare
Project version: 6.0
Fortran compiler for the host machine: gfortran (gcc 8.5.0 "GNU Fortran (GCC) 8.5.0 20210514 (Red Hat 8.5.0-18)")
Fortran linker for the host machine: gfortran ld.bfd 2.30-119
C compiler for the host machine: cc (gcc 8.5.0 "cc (GCC) 8.5.0 20210514 (Red Hat 8.5.0-18)")
C linker for the host machine: cc ld.bfd 2.30-119
C++ compiler for the host machine: c++ (gcc 8.5.0 "c++ (GCC) 8.5.0 20210514 (Red Hat 8.5.0-18)")
C++ linker for the host machine: c++ ld.bfd 2.30-119
Host machine cpu family: x86_64
Host machine cpu: x86_64
Found pkg-config: YES (/usr/bin/pkg-config) 1.4.2
Run-time dependency Boost found: YES 1.66.0 (/usr)
Program flex found: YES (/usr/bin/flex)
Has header "FlexLexer.h" : YES 
Program bison found: YES (/usr/local/bin/bison)
Program sed found: YES (/usr/bin/sed)
Run-time dependency dl found: YES
Run-time dependency OpenMP found: YES 4.5
Run-time dependency gsl found: YES 2.5
Checking for size of "pthread_t" : 8 
Program /home/outscale/matlab/bin/matlab found: YES (/home/outscale/matlab/bin/matlab)
Library slicot64_pic found: YES
Program sphinx-build found: YES (/usr/bin/sphinx-build)
Program latexmk found: YES (/usr/bin/latexmk)
Program git found: YES (/usr/bin/git)
Program etags found: NO
Build targets in project: 45

dynare 6.0

  User defined options
    buildtype   : debugoptimized
    prefix      : /home/outscale/dynare/dynare-6.0
    fortran_args: [ '-B', '/home/outscale/dynare/slicot']
    matlab_path : /home/outscale/matlab

Found ninja-1.8.2 at /usr/bin/ninja
Traceback (most recent call last):
  File "/home/outscale/.local/lib/python3.9/site-packages/mesonbuild/mesonmain.py", line 194, in run
    return options.run_func(options)
  File "/home/outscale/.local/lib/python3.9/site-packages/mesonbuild/msetup.py", line 358, in run
    app.generate()
  File "/home/outscale/.local/lib/python3.9/site-packages/mesonbuild/msetup.py", line 181, in generate
    return self._generate(env, capture, vslite_ctx)
  File "/home/outscale/.local/lib/python3.9/site-packages/mesonbuild/msetup.py", line 251, in _generate
    captured_compile_args = intr.backend.generate(capture, vslite_ctx)
  File "/home/outscale/.local/lib/python3.9/site-packages/mesonbuild/backend/ninjabackend.py", line 632, in generate
    self.generate_target(t)
  File "/home/outscale/.local/lib/python3.9/site-packages/mesonbuild/backend/ninjabackend.py", line 1035, in generate_target
    o, s = self.generate_single_compile(target, src, False, [],
  File "/home/outscale/.local/lib/python3.9/site-packages/mesonbuild/backend/ninjabackend.py", line 2996, in generate_single_compile
    extra_deps += self.get_fortran_deps(compiler, abs_src, target)
  File "/home/outscale/.local/lib/python3.9/site-packages/mesonbuild/backend/ninjabackend.py", line 2682, in get_fortran_deps
    mod_files = _scan_fortran_file_deps(src, srcdir, dirname, tdeps, compiler)
  File "/home/outscale/.local/lib/python3.9/site-packages/mesonbuild/backend/ninjabackend.py", line 3737, in _scan_fortran_file_deps
    mod_files.extend(_scan_fortran_file_deps(incfile, srcdir, dirname, tdeps, compiler))
  File "/home/outscale/.local/lib/python3.9/site-packages/mesonbuild/backend/ninjabackend.py", line 3728, in _scan_fortran_file_deps
    with src.open(encoding='ascii', errors='ignore') as f:
  File "/usr/lib64/python3.9/pathlib.py", line 1252, in open
    return io.open(self, mode, buffering, encoding, errors, newline,
  File "/usr/lib64/python3.9/pathlib.py", line 1120, in _opener
    return self._accessor.open(self, flags, mode)
FileNotFoundError: [Errno 2] No such file or directory: '/tmp/dynare-6.0/build-matlab/../mex/sources/mjdgges/defines.F08'

I tried both clone the repo using the 6.x branch and using the archive at https://www.dynare.org/release/source/dynare-6.0.tar.xz
Both yield the same error.

The directory mentioned in the error only contains the following file:

$ ls /tmp/dynare-6.0/mex/sources/mjdgges
total 8.0K
-rw-rw-r-- 1 outscale outscale 5.7K Feb  2 17:35 mjdgges.F08

Has anyone encoutered a similar error?

With regarsds,

The file that the build system is looking for is mex/sources/defines.F08. I don’t know why Meson does not find it, because it is supposed to look for it at the right place.

But before we try to debug this further, please note that Dynare 6 requires at least GCC version 10. You are using GCC 8, which is too old.

Please try again with a more recent GCC, and report whether you still have the same problem.

Hello,

I used a different Rocky Linux version (version 9) which comes with gcc version 11 and the compilation seems to be working properly out of the box.

Thank you for pointing this out.

SOLVED: You need version 10+ of gcc/gfortran

Thanks for your feedback, I’m happy that you got it working.

Note that it’s not sure that your original problem comes from the version of GCC. It might come from another component, because you tested on a different distribution which ships other versions of various components.