Issue with Ubuntu 20.04 and source compile - gnu++20 error


  • mathworks/matlab:r2021a
  • Ubuntu 20.04
  • dynare=4.6.0+dfsg-2 installed
  • previous attempt to install dynare-matlab (which failed, see other post


git clone --recurse-submodules dynare/
   26  cd dynare/
   32  sudo apt-get install -y autoconf automake
   33  autoreconf -si
   35  sudo apt-get  install -y flex bison 
   36  autoreconf -si
   37  ./configure --with-matlab=/opt/matlab/R2021a/
   38  ./configure --with-matlab=/opt/matlab/R2021a/ --disable-octave --disable-doc
   39  make
   42  sudo apt install build-essential gfortran liboctave-dev libboost-graph-dev libgsl-dev libmatio-dev libslicot-dev libslicot-pic libsuitesparse-dev flex libfl-dev bison autoconf automake  x13as
   43  make


make[5]: Entering directory '/usr/src/dynare/preprocessor/src/macro'
g++ -DPACKAGE_NAME=\"dynare-preprocessor\" -DPACKAGE_TARNAME=\"dynare-preprocessor\" -DPACKAGE_VERSION=\"6-unstable\" -DPACKAGE_STRING=\"dynare-preprocessor\ 6-unstable\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE_URL=\"\" -DPACKAGE=\"dynare-preprocessor\" -DVERSION=\"6-unstable\" -DHAVE_BOOST=/\*\*/ -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_BOOST_GRAPH_ADJACENCY_LIST_HPP=1 -DHAVE_BOOST_ALGORITHM_STRING_TRIM_HPP=1 -DHAVE_BOOST_ALGORITHM_STRING_SPLIT_HPP=1 -DBOOST_NO_HASH=/\*\*/ -I.  -I/usr/include -I..  -std=gnu++20 -Wall -Wno-dangling-else -Wextra -Wold-style-cast -g -O2 -Wno-old-style-cast -MT libmacro_a-Tokenizer.o -MD -MP -MF .deps/libmacro_a-Tokenizer.Tpo -c -o libmacro_a-Tokenizer.o `test -f '' || echo './'`
g++: error: unrecognized command line option '-std=gnu++20'; did you mean '-std=gnu++2a'?

(my ref: (myid)/matlab2021a:2022-11-23 - so I can find it again)

You need at least GCC version 10 to compile Dynare unstable. You are probably using a version of GCC that is too old.

Also note that Dynare 5.3 (the latest stable version) only requires GCC version 8. I recommend that you install that version, unless you have a good reason to use the unstable version (the master branch of the git repository).