Help needed with Dynare-Maltab 4.4.1 Install on Ubuntu 14.04

Hi,

I am trying to install ‘dynare-matlab’ on Ubuntu 14.04 but I am getting the following error message:

Building Matlab extensions (logfile at /tmp/dynare-matlab-mexbuild-1420758439.EWAvdAo)
<command-line>:0:16: error: invalid suffix "x" on integer constant
../../../sources/dynmex.h:30:33: note: in expansion of macro ‘MATLAB_VERSION’
 #if defined(MATLAB_MEX_FILE) && MATLAB_VERSION < 0x0703
                                 ^
In file included from ../../../sources/mjdgges/mjdgges.c:23:0:
../../../sources/dynmex.h:31:13: error: conflicting types for ‘mwIndex’
 typedef int mwIndex;
             ^
In file included from /usr/local/MATLAB/R2014b/extern/include/matrix.h:25:0,
                 from /usr/local/MATLAB/R2014b/extern/include/mex.h:57,
                 from ../../../sources/dynmex.h:27,
                 from ../../../sources/mjdgges/mjdgges.c:23:
/usr/local/MATLAB/R2014b/extern/include/tmwtypes.h:796:19: note: previous declaration of ‘mwIndex’ was here
 typedef size_t    mwIndex;        /* unsigned pointer-width integer */
                   ^
In file included from ../../../sources/mjdgges/mjdgges.c:23:0:
../../../sources/dynmex.h:32:13: error: conflicting types for ‘mwSize’
 typedef int mwSize;
             ^
In file included from /usr/local/MATLAB/R2014b/extern/include/matrix.h:25:0,
                 from /usr/local/MATLAB/R2014b/extern/include/mex.h:57,
                 from ../../../sources/dynmex.h:27,
                 from ../../../sources/mjdgges/mjdgges.c:23:
/usr/local/MATLAB/R2014b/extern/include/tmwtypes.h:795:19: note: previous declaration of ‘mwSize’ was here
 typedef size_t    mwSize;         /* unsigned pointer-width integer */
                   ^
<command-line>:0:16: error: invalid suffix "x" on integer constant
../../../sources/dynlapack.h:33:33: note: in expansion of macro ‘MATLAB_VERSION’
 #if defined(MATLAB_MEX_FILE) && MATLAB_VERSION >= 0x0708
                                 ^
make[1]: *** [mjdgges.o] Error 1
make: *** [all-recursive] Error 1
dpkg: error processing package dynare-matlab (--configure):
 subprocess installed post-installation script returned error exit status 2
Processing triggers for libc-bin (2.19-0ubuntu6.4) ...
Errors were encountered while processing:
 dynare-matlab
E: Sub-process /usr/bin/dpkg returned an error code (1)

The following the log from \tmp\ file:

debian-matlab-mexhelper 0.0.18

Copyright (C) 2010-2011 Michael Hanke <michael.hanke@gmail.com>

Licensed under GNU Public License version 3 or later.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Written by Michael Hanke.

Attempt to build Matlab extensions

Package name:        dynare-matlab
Source directory:    /usr/src/matlab/dynare-matlab
MEX dir:             /usr/lib/matlab/site/dynare-matlab
M dir:               /usr/share/matlab/site/m/dynare-matlab
Build user (if any):
Build command:       cd mex/build/matlab && ./configure --with-matlab=$(dirname $(dirname $(readlink -f `which matlab`))) MATLAB_VERSION=$(echo version | matlab -nodesktop -nodisplay -nosplash 2>/dev/null | grep -A2 "ans ="|tail -1| cut -d "." -f 1,2) && make
Install command:     mkdir -p /usr/lib/dynare/mex/matlab && install -m644 /usr/src/matlab/dynare-matlab/mex/matlab/* /usr/lib/dynare/mex/matlab
Clean command:       cd mex/build/matlab && make distclean && rmdir /usr/src/matlab/dynare-matlab/mex/matlab

Attempt to build Matlab extensions:
cd mex/build/matlab && ./configure --with-matlab=$(dirname $(dirname $(readlink -f `which matlab`))) MATLAB_VERSION=$(echo version | matlab -nodesktop -nodisplay -nosplash 2>/dev/null | grep -A2 "ans ="|tail -1| cut -d "." -f 1,2) && make
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... no
checking for mawk... mawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking for MATLAB prefix... /usr/local/MATLAB/R2014b
checking whether to enable MATLAB support... yes
checking for MATLAB version... >>
checking for MEX-file suffix... mexa64
setting MEX-file suffix to .mexa64
checking for MATLAB machine architecture... glnxa64
checking for a sed that does not truncate output... /bin/sed
checking for options to compile MEX for MATLAB... ok
checking for gfortran... gfortran
checking whether the Fortran 77 compiler works... yes
checking for Fortran 77 compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU Fortran 77 compiler... yes
checking whether gfortran accepts -g... yes
checking for gcc... gcc
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking whether gcc understands -c and -o together... yes
checking for style of include used by make... GNU
checking dependency style of gcc... gcc3
checking for g++... g++
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking dependency style of g++... gcc3
checking for ranlib... ranlib
checking whether ln -s works... yes
checking for ar... ar
checking the archiver (ar) interface... ar
checking for the pthreads library -lpthreads... no
checking whether pthreads work without any flags... yes
checking for joinable pthread attribute... PTHREAD_CREATE_JOINABLE
checking if more special flags are required for pthreads... no
checking for dlopen in -ldl... yes
checking how to run the C preprocessor... gcc -E
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking gsl/gsl_cdf.h usability... no
checking gsl/gsl_cdf.h presence... no
checking for gsl/gsl_cdf.h... no
checking for cos in -lm... yes
checking for cblas_dgemm in -lgslcblas... no
checking for gsl_cdf_ugaussian_P in -lgsl... no
checking for compress in -lz... yes
checking matio.h usability... yes
checking matio.h presence... yes
checking for matio.h... yes
checking for Mat_Open in -lmatio... yes
checking how to get verbose linking output from gfortran... -v
checking for Fortran 77 libraries of gfortran...  -L/usr/lib/gcc/x86_64-linux-gnu/4.8 -L/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../x86_64-linux-gnu -L/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../lib -L/lib/x86_64-linux-gnu -L/lib/../lib -L/usr/lib/x86_64-linux-gnu -L/usr/lib/../lib -L/usr/lib/gcc/x86_64-linux-gnu/4.8/../../.. -lgfortran -lm -lquadmath
checking for dummy main to link with Fortran 77 libraries... none
checking for Fortran 77 name-mangling scheme... lower case, underscore, no extra underscore
checking for sb02od_ in -lslicot_pic... no
configure:

Dynare is now configured for building the following components...

Binaries (with "make"):
 MEX files for MATLAB (except those listed below):                   yes
 k-order and dynare_simul MEX files for MATLAB:                      yes
 MS-SBVAR MEX files for MATLAB:                                      no (missing GSL)
 Kalman Steady State MEX file for MATLAB:                            no (missing SLICOT)
M2HTML documentation:                                               no


checking that generated files are newer than configure... done
configure: creating ./config.status
config.status: creating Makefile
config.status: creating mjdgges/Makefile
config.status: creating kronecker/Makefile
config.status: creating bytecode/Makefile
config.status: creating libdynare++/Makefile
config.status: creating gensylv/Makefile
config.status: creating k_order_perturbation/Makefile
config.status: creating dynare_simul_/Makefile
config.status: creating kalman_steady_state/Makefile
config.status: creating ms_sbvar/Makefile
config.status: creating block_kalman_filter/Makefile
config.status: creating sobol/Makefile
config.status: creating local_state_space_iterations/Makefile
config.status: executing depfiles commands
Making all in mjdgges
make[1]: Entering directory `/usr/src/matlab/dynare-matlab/mex/build/matlab/mjdgges'
gcc -DPACKAGE_NAME=\"dynare\" -DPACKAGE_TARNAME=\"dynare\" -DPACKAGE_VERSION=\"4.4.1\" -DPACKAGE_STRING=\"dynare\ 4.4.1\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE_URL=\"\" -DPACKAGE=\"dynare\" -DVERSION=\"4.4.1\" -DHAVE_MATLAB=1 -DHAVE_PTHREAD=1 -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_LIBM=1 -DHAVE_LIBZ=1 -D_GNU_SOURCE -DNDEBUG -DMATLAB_VERSION=0x -DMATLAB_MEX_FILE -DMEXEXT=\".mexa64\" -I.  -I/usr/local/MATLAB/R2014b/extern/include -I../../../sources   -fexceptions -fPIC -pthread -g -O2 -fno-omit-frame-pointer -Wall -Wno-parentheses -MT mjdgges.o -MD -MP -MF .deps/mjdgges.Tpo -c -o mjdgges.o `test -f '../../../sources/mjdgges/mjdgges.c' || echo './'`../../../sources/mjdgges/mjdgges.c
make[1]: Leaving directory `/usr/src/matlab/dynare-matlab/mex/build/matlab/mjdgges'

Dynare is working fine with Octave but I am facing trouble with the Matlab installation on Ubuntu 14.04

PS : My Matlab is installed under /usr/local/MATLAB/2014b/

I think that something is wrong with your MATLAB installation.

Can you please give me the output of the “version” command run from the MATLAB prompt?

Best,

Hi Sebastien :

This is the output :

>> version
ans =
8.4.0.150421 (R2014b)

Is your MATLAB licence limited to only one user of your Ubuntu system? In that case, you should run “sudo dpkg-reconfigure matlab-support”, and make sure that the right username is given in the question titled “Authorized user for MATLAB”.

I had same trouble, but it dissapeared after symlinking the directory: /usr/lib/jvm/default-java --> /usr/lib/jvm/java-8-oracle.

Sorry for reviving this old thread, but I got similar problem with ubuntu 18.04 LTS on remote server.

In the terminal, i wrote “java version” to get my current version, and used the output to do a symlinking as victor302 suggested (it’s currently 11, but could be higher for other people looking at this thread later). Using the “dynare-matlab” apt never worked, but dl the source files and using the “./configure” command worked well after symlinking.

Best,

@sebastien Could you please have a look?

@Vermandel Can you paste the error message that you encounter? Also, what is your MATLAB version?

I had exactly the same message as @gazia21 when i was downloading the source files and tried to compile them using ./configure command (but thanksfully it works since then).

Currently if try to install the dynare-matlab package, I still get the following message:

$ sudo apt-get install dynare-matlab
Lecture des listes de paquets... Fait
Construction de l'arbre des dépendances       
Lecture des informations d'état... Fait
Les NOUVEAUX paquets suivants seront installés :
  dynare-matlab
0 mis à jour, 1 nouvellement installés, 0 à enlever et 0 non mis à jour.
Il est nécessaire de prendre 0 o/784 ko dans les archives.
Après cette opération, 7 544 ko d'espace disque supplémentaires seront utilisés.
Sélection du paquet dynare-matlab précédemment désélectionné.
(Lecture de la base de données... 286927 fichiers et répertoires déjà installés.)
Préparation du dépaquetage de .../dynare-matlab_4.5.4-1_all.deb ...
Dépaquetage de dynare-matlab (4.5.4-1) ...
Paramétrage de dynare-matlab (4.5.4-1) ...
Building Matlab extensions (logfile at /tmp/dynare-matlab-mexbuild-1556176693.1kCDT1L)
configure: WARNING: you should use --build, --host, --target
configure: WARNING: invalid host type: '9.4
Invalid configuration `'9.4': machine `'9.4' not recognized
configure: error: /bin/bash ./config.sub '9.4 failed
dpkg: erreur de traitement du paquet dynare-matlab (--configure) :
installed dynare-matlab package post-installation script subprocess returned error exit status 1
Des erreurs ont été rencontrées pendant l'exécution :
 dynare-matlab
E: Sub-process /usr/bin/dpkg returned an error code (1)

I have the MATLAB files installed, not not the MEX files.

I tried with the R2019a and R2018a (9.4.0.813654), but it does not work with both of them.

Kindly,
gauthier

The problem is that your version of MATLAB is too recent for the version of the Ubuntu package (4.5.4-1). More recent versions of the package work fine, but they’re not available in Ubuntu LTS 18.04. There’s unfortunately not much that I can do here (but I understand that you’ve found a workaround).

Best,

Ok thanks a lot Sebastien for your feedback, it’s much appreciated. Yes I have a workaround.