Page 1 of 2

Invalid MEX-FILE in MATLAB 2017 prerelease version

PostPosted: Sun Feb 12, 2017 11:11 am
by katejcooper
Hi Everyone,

I have a problem running my code which is written in Dynare and runs in MATLAB. It is a log-linearized model with Bayesian estimation of parameters. The code runs perfectly in earlier versions of MATLAB on both PC and Mac but cannot run after computing steady state in my current version of MATLAB: 2017 prerelease (updated in December 2016).
The error reports:
Invalid MEX-file '/Applications/Dynare/4.4.3/matlab/../mex/matlab/osx64/mjdgges.mexmaci64':
dlopen(/Applications/Dynare/4.4.3/matlab/../mex/matlab/osx64/mjdgges.mexmaci64, 6): Library not loaded:
@loader_path/libmex.dylib
Referenced from: /Applications/Dynare/4.4.3/mex/matlab/osx64/mjdgges.mexmaci64
Reason: image not found.

Does anyone encounter the same problem and does anyone know how to solve this?

I tried copying the 'mex' file under Dynare/4.4.3/matlab but it didn't work, still reporting the same error. I also tried changing the path in the 'Dynare_config.m' to make MATLAB follow the path of 'Dynare/4.4.3/mex' but still reporting the same error.


Thanks in advance

Kate

Re: Invalid MEX-FILE in MATLAB 2017 prerelease version

PostPosted: Mon Feb 13, 2017 2:06 pm
by HoutanBastani
My first guess is that, with this version, Matlab renamed or removed a shared library that they used to distribute. In any case, I'd recommend you stick with an earlier version of Matlab as Dynare 4.4.3 was released a few years ago it's not guaranteed to be compatible with versions of Matlab or Octave that have been released since then.

If this problem persists in the official Matlab release, I'll consider making new mex files and distributing them. I'll make a post here if I do.

Re: Invalid MEX-FILE in MATLAB 2017 prerelease version

PostPosted: Mon Feb 13, 2017 10:28 pm
by katejcooper
Thank you Houtan. The code does run in earlier versions of MATLAB. I'll let you know when I get the 2017 official version if the problem still exists.

Best,
Kate

Re: Invalid MEX-FILE in MATLAB 2017 prerelease version

PostPosted: Sun Mar 19, 2017 4:15 am
by katejcooper
Hi Houtan,

I'm posting this follow-up replay to let you know that, regarding the problem with invalid MEX-File in MATLAB with Dynare 4.4.3, I updated my MATLAB to the official release R2017a, but the problem remains. It happens after the computation of initial values (steady states). Error reports as below:

************************************************************************************************************************************
Invalid MEX-file
'/Applications/Dynare/4.4.3/matlab/../mex/matlab/osx64/mjdgges.mexmaci64':
dlopen(/Applications/Dynare/4.4.3/matlab/../mex/matlab/osx64/mjdgges.mexmaci64, 6):
Library not loaded: @loader_path/libmex.dylib
Referenced from: /Applications/Dynare/4.4.3/mex/matlab/osx64/mjdgges.mexmaci64
Reason: image not found.
************************************************************************************************************************************


Do you have any suggestions for this problem, besides turning the clock back to pre-2017 matlab time?

Many thanks.

Best,
Kate

Re: Invalid MEX-FILE in MATLAB 2017 prerelease version

PostPosted: Sun Mar 19, 2017 1:26 pm
by jpfeifer
Dear Kate,
is the problem also present when you use the unstable version of Dynare?

Re: Invalid MEX-FILE in MATLAB 2017 prerelease version

PostPosted: Mon Mar 20, 2017 11:13 am
by HoutanBastani
Hi Kate,

I'm unable to produce the same problem as you're experiencing, but I am encountering other problems and am working to fix them.

My question for you is, does your code run with Dynare 4.4.3 or the unstable version on a previous version of Matlab?

Re: Invalid MEX-FILE in MATLAB 2017 prerelease version

PostPosted: Mon Mar 20, 2017 3:36 pm
by wjgatt
I am experiencing the same problem, which cropped up when I updated to Matlab 2017a. I am using the stable 4.4.3 release.

I confirm the problem crops up on MacOS Sierra but not on Windows 10. On windows the new Matlab release runs dynare just fine.

Will

Re: Invalid MEX-FILE in MATLAB 2017 prerelease version

PostPosted: Mon Mar 20, 2017 4:02 pm
by HoutanBastani
Hi Will,

Do you get the same error as Kate? Does R2016b work for you with Dynare on OS X?

Re: Invalid MEX-FILE in MATLAB 2017 prerelease version

PostPosted: Mon Mar 20, 2017 4:41 pm
by wjgatt
Yes I was getting the same error message, right after the steady state values are displayed. The problem occurs when dynare calls 'dyn_first_order_solver'

Error in dyn_first_order_solver (line 216)
[err, ss, tt, w, sdim, dr.eigval, info1] =
mjdgges(E, D, DynareOptions.qz_criterium,
DynareOptions.qz_zero_threshold);

Downgraded to Matlab 2016b and dynare runs my mod files fine.

Will

Re: Invalid MEX-FILE in MATLAB 2017 prerelease version

PostPosted: Fri Mar 31, 2017 5:28 pm
by JdW
Hi everyone,

I encounter the same problem running Dynare 4.4.3 on Matlab R2017a (official release), running on macOS Sierra. The problem remains when using the unstable Dynare release. I would greatly appreciate a solution (other than downgrading Matlab).

Joris

Re: Invalid MEX-FILE in MATLAB 2017 prerelease version

PostPosted: Mon Apr 03, 2017 9:49 am
by HoutanBastani
The other solution is to build dynare via homebrew. See this page http://www.dynare.org/DynareWiki/InstallOnMacOSX. Follow the directions for Dynare Unstable (which will be the next version of Dynare), replacing R2014b with R2017a and 8.4 with 9.2. If you want to build Dynare 4.4 (current stable), remove
Code: Select all
--HEAD
from the command.


I am not sure I will have the time to make a new dynare release for 4.4. FYI, we hope to have Dynare 4.5 out in the next month or so.

Re: Invalid MEX-FILE in MATLAB 2017 prerelease version

PostPosted: Tue Apr 04, 2017 9:29 pm
by anifab18
Hi everyone
I encounter the same problem running Dynare 4.4.3 on Matlab R2017a (official), running on macOS Sierra. I try as you said to build dynare via homebrew but got an message error in the final step
==> Installing dynare from homebrew/science
Error: You must `brew link ghostscript` before homebrew/science/dynare can be installed
I've tried all the recommended solution but it still don't work
Have any other solution
Fabrice

Re: Invalid MEX-FILE in MATLAB 2017 prerelease version

PostPosted: Tue Apr 04, 2017 9:36 pm
by anifab18
just got the error message after all this step

brew info dynare
homebrew/science/dynare: stable 4.4.3 (bottled), HEAD
Platform for economic models, particularly DSGE and OLG models
http://www.dynare.org
Not installed
From: https://github.com/Homebrew/homebrew-sc ... /dynare.rb
==> Dependencies
Build: boost ✔, cweb ✔, xz ✔
Required: matlab2tikz ✔, fftw ✔, gsl ✔, hdf5 ✔, libmatio ✔, metis ✔, readline ✔, veclibfort ✔, suite-sparse ✘
Recommended: octave
==> Requirements
Build: tex ✔
Required: fortran ✔
Optional: tex ✔
==> Options
--with-matlab-version=
Matlab version, e.g., 8.2 (to build mex files)
--with-matlab=
Path to Matlab root directory (to build mex files)
--with-tex
Build documentation
--without-octave
Build without octave support
--HEAD
Install HEAD version
==> Caveats
To get started with dynare, open Matlab or Octave and type:

addpath /usr/local/opt/dynare/lib/dynare/matlab
10-232-80-132:~ fabriceanicetparfaitdabire$ brew install dynare --with-matlab=/Applications/MATLAB_R2017a.app --with-matlab-version=9.2 --without-check
Updating Homebrew...
==> Auto-updated Homebrew!
Updated 2 taps (homebrew/core, homebrew/science).
==> New Formulae
heimdal lapack make openldap openssh tcl-tk
==> Updated Formulae
afl-fuzz homebrew/science/lumpy-sv
app-engine-java homebrew/science/mir-prefer
arangodb homebrew/science/orocos-kdl
aws-sdk-cpp homebrew/science/picard-tools
awscli jboss-forge
bit jetty
cake kubernetes-cli
chromedriver mercurial
fabio node-build
fio node@4
flow node@6
gollum npth
gotags paket
gpa prettyping
homebrew/science/adam pypy
homebrew/science/afra solr
homebrew/science/circlator stern
homebrew/science/dlib syncthing
homebrew/science/genometools tgui
==> Deleted Formulae
srm

==> Installing dynare from homebrew/science
Error: You must `brew link ghostscript` before homebrew/science/dynare can be installed
10-232-80-132:~ fabriceanicetparfaitdabire$

Re: Invalid MEX-FILE in MATLAB 2017 prerelease version

PostPosted: Wed Apr 05, 2017 10:18 am
by HoutanBastani
Right, so follow the instruction in the error message. It says:
Error: You must `brew link ghostscript` before homebrew/science/dynare can be installed

So, at the terminal prompt, type
Code: Select all
brew link ghostscript

Re: Invalid MEX-FILE in MATLAB 2017 prerelease version

PostPosted: Wed Apr 05, 2017 10:21 am
by HoutanBastani
Also, if you're not going to use Octave, you can execute the following installation command:
Code: Select all
brew install dynare --with-matlab=/Applications/MATLAB_R2017a.app --with-matlab-version=9.2 --without-check --without-octave