Installing Dynare for octave on macosx

Hello,
I am trying to install stable Dynare for octave according to the manual dynare.org/DynareWiki/InstallOnMacOSX. I tried: brew install dynare --HEAD --without-check and other options, but it gives the following error:

Last 15 lines from /Users/macbookpro/Library/Logs/Homebrew/dynare/03.make:
make[2]: Nothing to be done for all-am'. Making all in mex/build/octave Making all in mjdgges clang -DPACKAGE_NAME=\"dynare\" -DPACKAGE_TARNAME=\"dynare\" -DPACKAGE_VERSION=\"4.5-unstable\" -DPACKAGE_STRING=\"dynare\ 4.5-unstable\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE_URL=\"\" -DPACKAGE=\"dynare\" -DVERSION=\"4.5-unstable\" -DHAVE_PTHREAD_PRIO_INHERIT=1 -DHAVE_PTHREAD=1 -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_LIBM=1 -DHAVE_LIBZ=1 -DHAVE_LIBHDF5=1 -DOCTAVE_MEX_FILE -DMEXEXT=\".mex\" -I. -I/usr/local/Cellar/octave/4.2.0/include/octave-4.2.0/octave/.. -I/usr/local/Cellar/octave/4.2.0/include/octave-4.2.0/octave -I/usr/local/Cellar/octave/4.2.0/include -I../../../sources -fPIC -D_REENTRANT -Wall -Wno-parentheses -c -o mjdgges.otest -f ‘…/…/…/sources/mjdgges/mjdgges.c’ || echo ‘./’`…/…/…/sources/mjdgges/mjdgges.c
…/./install-sh -c -d …/…/…/octave
cd …/…/…/octave &&
for p in mjdgges.mex; do
ln -s -f /private/tmp/dynare-20161116-41076-1ncmapr/mex/build/octave/mjdgges/$p $p;
done
clang -fPIC -D_REENTRANT -Wall -Wno-parentheses -bundle -bundle_loader /usr/local/Cellar/octave/4.2.0/bin/octave-4.2.0 -L/usr/local/Cellar/octave/4.2.0/lib/octave/4.2.0 -L/usr/local/Cellar/octave/4.2.0/lib -L/usr/local/opt/readline/lib -lreadline -L/usr/local/opt/suite-sparse/lib -lsuitesparseconfig -L/usr/local/opt/metis/lib -lmetis -o mjdgges.mex mjdgges.o -loctinterp -loctave -L/usr/local/opt/veclibfort/lib -lvecLibFort -L/usr/local/Cellar/fftw/3.3.5/lib -lfftw3_threads -lfftw3 -L/usr/local/Cellar/fftw/3.3.5/lib -lfftw3f_threads -lfftw3f -lm -L/usr/local/opt/readline/lib -L/usr/local/opt/suite-sparse/lib -L/usr/local/opt/metis/lib -L/usr/local/Cellar/gcc/6.2.0/lib/gcc/6/gcc/x86_64-apple-darwin16.0.0/6.2.0 -L/usr/local/Cellar/gcc/6.2.0/lib/gcc/6/gcc/x86_64-apple-darwin16.0.0/6.2.0/…/…/… -lreadline -lsuitesparseconfig -lmetis -lgfortran -lquadmath -lm
ld: library not found for -lgfortran
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [mjdgges.mex] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all-recursive] Error 1

What can be done to fix the issue? I have already updated brew and ran brew doctor, and it didn’t help.

What is the output of > env && echo $PATH && ls -la /usr/local/lib/gcc/6/libgfortran*

Also please post the output of > brew doctor

[quote=“HoutanBastani”]What is the output of > env && echo $PATH && ls -la /usr/local/lib/gcc/6/libgfortran*

Also please post the output of > brew doctor[/quote]

Hey

Not the same guy but I have the same error code. I will post my error code, and the output of the commands you have written. First the error code after installation:

[code]> brew install dynare --with-matlab=/Applications/MATLAB_R2014b.app --with-matlab-version=8.4 --without-check
Updating Homebrew…
==> Auto-updated Homebrew!
Updated Homebrew from eb20f59 to eece770.
No changes to formulae.

==> Installing dynare from homebrew/science
Warning: homebrew/science/dynare: this formula has no --without-check option so it will be ignored!
==> Using Homebrew-provided fortran compiler.
This may be changed by setting the FC environment variable.
==> Downloading https://www.dynare.org/release/source/dynare-4.4.3.tar.xz
Already downloaded: /Users/USERNAME/Library/Caches/Homebrew/dynare-4.4.3.tar.xz
==> ./configure --disable-silent-rules --prefix=/usr/local/Cellar/dynare/4.4.3_3 --with-matlab=/Applications/MATLAB_R2014b.app MATLAB_VERSION=8.4
==> make
Last 15 lines from /Users/USERNAME/Library/Logs/Homebrew/dynare/02.make:
make[2]: Nothing to be done for all-am'. Making all in mex/build/octave Making all in mjdgges clang -DPACKAGE_NAME=\"dynare\" -DPACKAGE_TARNAME=\"dynare\" -DPACKAGE_VERSION=\"4.4.3\" -DPACKAGE_STRING=\"dynare\ 4.4.3\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE_URL=\"\" -DPACKAGE=\"dynare\" -DVERSION=\"4.4.3\" -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 -DHAVE_LIBHDF5=1 -DOCTAVE_MEX_FILE -DMEXEXT=\".mex\" -I. -I/usr/local/Cellar/octave/4.2.0_1/include/octave-4.2.0/octave/.. -I/usr/local/Cellar/octave/4.2.0_1/include/octave-4.2.0/octave -I/usr/local/Cellar/octave/4.2.0_1/include -I../../../sources -fPIC -D_REENTRANT -Wall -Wno-parentheses -c -o mjdgges.otest -f ‘…/…/…/sources/mjdgges/mjdgges.c’ || echo ‘./’`…/…/…/sources/mjdgges/mjdgges.c
…/./install-sh -c -d …/…/…/octave
cd …/…/…/octave &&
for p in mjdgges.mex; do
ln -s -f /private/tmp/dynare-20170117-1807-lhgpwp/dynare-4.4.3/mex/build/octave/mjdgges/$p $p;
done
clang -fPIC -D_REENTRANT -Wall -Wno-parentheses -bundle -bundle_loader /usr/local/Cellar/octave/4.2.0_1/bin/octave-4.2.0 -L/usr/local/Cellar/octave/4.2.0_1/lib/octave/4.2.0 -L/usr/local/Cellar/octave/4.2.0_1/lib -L/usr/local/opt/readline/lib -lreadline -L/usr/local/opt/suite-sparse/lib -lsuitesparseconfig -L/usr/local/opt/metis/lib -lmetis -o mjdgges.mex mjdgges.o -loctinterp -loctave -L/usr/local/opt/veclibfort/lib -lvecLibFort -L/usr/local/Cellar/fftw/3.3.5/lib -lfftw3_threads -lfftw3 -L/usr/local/Cellar/fftw/3.3.5/lib -lfftw3f_threads -lfftw3f -lm -L/usr/local/opt/readline/lib -L/usr/local/opt/suite-sparse/lib -L/usr/local/opt/metis/lib -L/usr/local/Cellar/gcc/6.3.0/lib/gcc/6/gcc/x86_64-apple-darwin16.3.0/6.3.0 -L/usr/local/Cellar/gcc/6.3.0/lib/gcc/6/gcc/x86_64-apple-darwin16.3.0/6.3.0/…/…/… -lreadline -lsuitesparseconfig -lmetis -lgfortran -lquadmath -lm
ld: library not found for -lgfortran
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [mjdgges.mex] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all-recursive] Error 1

READ THIS: http://docs.brew.sh/Troubleshooting.html

[/code]

Now when I type

I get this:

TMPDIR=/var/folders/69/3t33q11s4sb0st6pytt4fql00000gn/T/ TERM_PROGRAM_VERSION=388 Apple_PubSub_Socket_Render=/private/tmp/com.apple.launchd.FFdN0IGyNH/Render LANG=en_US.UTF-8 TERM_PROGRAM=Apple_Terminal XPC_SERVICE_NAME=0 XPC_FLAGS=0x0 DISPLAY=/private/tmp/com.apple.launchd.pItlOuIkeb/org.macosforge.xquartz:0 SSH_AUTH_SOCK=/private/tmp/com.apple.launchd.9O4eM4o3h5/Listeners TERM=xterm-256color TERM_SESSION_ID=BE025953-3756-4725-B411-B6538F41DEEE __CF_USER_TEXT_ENCODING=0x1F5:0x0:0x0 SHELL=/bin/zsh HOME=/Users/USERNAME LOGNAME=USERNAME USER=USERNAME PATH=/Users/USERNAME/anaconda/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/Library/TeX/texbin:/opt/local/bin:/opt/local/sbin SHLVL=1 PWD=/Users/USERNAME OLDPWD=/Users/USERNAME ZSH=/Users/USERNAME/.oh-my-zsh PAGER=less LESS=-R LC_CTYPE=en_US.UTF-8 LSCOLORS=Gxfxcxdxbxegedabagacad HOMEBREW_EDITOR=subl VISUAL=subl _=/usr/bin/env /Users/USERNAME/anaconda/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/Library/TeX/texbin:/opt/local/bin:/opt/local/sbin -r--r--r-- 1 USERNAME admin 1620200 Jan 17 14:54 /usr/local/lib/gcc/6/libgfortran.3.dylib -r--r--r-- 1 USERNAME admin 7447936 Dec 21 12:56 /usr/local/lib/gcc/6/libgfortran.a lrwxr-xr-x 1 USERNAME admin 19 Dec 21 12:56 /usr/local/lib/gcc/6/libgfortran.dylib -> libgfortran.3.dylib -r--r--r-- 1 USERNAME admin 198 Dec 21 12:56 /usr/local/lib/gcc/6/libgfortran.spec

Finally when I typed > brew doctor, I get the following:

[code] Warning: Anaconda is known to frequently break Homebrew builds, including Vim and
MacVim, due to bundling many duplicates of system and Homebrew-available
tools.

If you encounter a build failure please temporarily remove Anaconda
from your $PATH and attempt the build again prior to reporting the
failure to us. Thanks!

Warning: python is symlinked to python3
This will confuse build scripts and in general lead to subtle breakage.

Warning: “config” scripts exist outside your system or Homebrew directories.
./configure scripts often look for *-config scripts to determine if
software packages are installed, and what additional flags to use when
compiling and linking.

Having additional scripts in your path can confuse software installed via
Homebrew if the config script overrides a system or Homebrew provided
script of the same name. We found the following “config” scripts:
/Users/USERNAME/anaconda/bin/curl-config
/Users/USERNAME/anaconda/bin/freetype-config
/Users/USERNAME/anaconda/bin/icu-config
/Users/USERNAME/anaconda/bin/libdynd-config
/Users/USERNAME/anaconda/bin/libpng-config
/Users/USERNAME/anaconda/bin/libpng16-config
/Users/USERNAME/anaconda/bin/python3-config
/Users/USERNAME/anaconda/bin/python3.5-config
/Users/USERNAME/anaconda/bin/python3.5m-config
/Users/USERNAME/anaconda/bin/xml2-config
/Users/USERNAME/anaconda/bin/xslt-config

Warning: Unbrewed dylibs were found in /usr/local/lib.
If you didn’t put them there on purpose they could cause problems when
building Homebrew formulae, and may need to be deleted.

Unexpected dylibs:
/usr/local/lib/libtcl8.6.dylib
/usr/local/lib/libtk8.6.dylib

Warning: Unbrewed header files were found in /usr/local/include.
If you didn’t put them there on purpose they could cause problems when
building Homebrew formulae, and may need to be deleted.

Unexpected header files:
/usr/local/include/fakemysql.h
/usr/local/include/fakepq.h
/usr/local/include/fakesql.h
/usr/local/include/itcl.h
/usr/local/include/itcl2TclOO.h
/usr/local/include/itclDecls.h
/usr/local/include/itclInt.h
/usr/local/include/itclIntDecls.h
/usr/local/include/itclMigrate2TclCore.h
/usr/local/include/itclTclIntStubsFcn.h
/usr/local/include/mysqlStubs.h
/usr/local/include/odbcStubs.h
/usr/local/include/pqStubs.h
/usr/local/include/tcl.h
/usr/local/include/tclDecls.h
/usr/local/include/tclOO.h
/usr/local/include/tclOODecls.h
/usr/local/include/tclPlatDecls.h
/usr/local/include/tclThread.h
/usr/local/include/tclTomMath.h
/usr/local/include/tclTomMathDecls.h
/usr/local/include/tdbc.h
/usr/local/include/tdbcDecls.h
/usr/local/include/tdbcInt.h
/usr/local/include/tk.h
/usr/local/include/tkDecls.h
/usr/local/include/tkPlatDecls.h

Warning: Unbrewed .pc files were found in /usr/local/lib/pkgconfig.
If you didn’t put them there on purpose they could cause problems when
building Homebrew formulae, and may need to be deleted.

Unexpected .pc files:
/usr/local/lib/pkgconfig/tcl.pc
/usr/local/lib/pkgconfig/tk.pc

Warning: Unbrewed static libraries were found in /usr/local/lib.
If you didn’t put them there on purpose they could cause problems when
building Homebrew formulae, and may need to be deleted.

Unexpected static libraries:
/usr/local/lib/libtclstub8.6.a
/usr/local/lib/libtkstub8.6.a
[/code]

I have done > brew reinstall gcc, but it didn’t do anything.

Thanks for the help

Whenever you have a problem installing via homebrew, the first thing you should do is look at the output of brew doctor. You have many warnings, each telling you the steps to take to take care of them. These warnings can be ignored if you don’t have any problems installing homebrew packages. But, if you do, they are the first thing to take care of. So please take care of all of these warnings and try again.

They are not really related to the problem at thand.

The problem is I think this line:

I tried to reinstall fortran but doesn’t do anything. It can’t find that command or library.

What is the output of:

Sorry for the late response.

This is the output I get:

-r--r--r-- 1 USERNAME admin 1620200 Jan 18 16:40 /usr/local/lib/gcc/6/libgfortran.3.dylib -r--r--r-- 1 USERNAME admin 7447936 Dec 21 12:56 /usr/local/lib/gcc/6/libgfortran.a lrwxr-xr-x 1 USERNAME admin 19 Dec 21 12:56 /usr/local/lib/gcc/6/libgfortran.dylib -> libgfortran.3.dylib -r--r--r-- 1 USERNAME admin 198 Dec 21 12:56 /usr/local/lib/gcc/6/libgfortran.spec

Edit: I also submitted a report to github page of homebrew/science, but so far I did not get any response

github.com/Homebrew/homebrew-science/issues/4864

Thanks!

Ok, so your gfortran installation seems fine. Please take care of the problems reported by brew doctor.

I solved all the problems homebrew pointed. I still have the same problem

~ brew doctor Your system is ready to brew.

I was able to find a couple of similar problems on net (not Dynare related). Apparently there is an incompatibility between the gfortran baked into homebrew and whatever the Dynare is using.I guess this problem can be replicated on other Mac machines using homebrew now.

Thanks

I do not encounter the same problem when I install via homebrew so there is something wrong with your setup that is difficult to debug from a distance.

However, you have a problem only if you want both matlab and octave mex files. If you want one or the other, you’re ok. Your build works well when compiling Matlab mex files. So, if you only want these, you can just type

If, on the other hand, you only want Octave files, you’re in luck as these are bottled by homebrew and do not require local compilation. Simply type

If you want both you can:

  1. Install Dynare for Octave as above
  2. Copy the files in /usr/local/Cellar/dynare/4.4.3_3/lib/dynare/mex/octave to your desktop
  3. run brew uninstall dynare
  4. Install Dynare for Matlab as above
  5. Copy the files from step 2 to /usr/local/Cellar/dynare/4.4.3_3/lib/dynare/mex/octave

Dear sir, I kindly ask a few clarifying questions.

1a. At this (dynare.org/DynareWiki/InstallOnMacOSX) instead seem to read to install Octave 3.6.4 for systems beyond the 10.6 release? - Won’t Homebrew, in other words, install Octave’s latest version?

1b. Further, could this (wiki.octave.org/Octave_for_MacOS_X)?

  1. Presuming successful Octave and Dynare installations, which of these 2 instructions, here (dynare.org/DynareWiki/InstallOnMacOSX) found, is to be followed:

2. At the Octave prompt, type: addpath /usr/local/opt/dynare/lib/dynare/matlab 2. Before executing MOD files, you need to execute the following command at Octave prompt: addpath /Applications/Dynare/<<version>>/matlab?

Thanks in advance for your time.

Hi,

To answer your question, the only supported Octave on OS X is available via Homebrew, which will install the latest Octave.

I updated dynare.org/DynareWiki/InstallOnMacOSX to make it more clear as the formatting was leading you to read instructions for Dynare 4.3 even though that is not the current stable release.

So, if you look closely at the instructions for Dynare stable (currently 4.4.3) you see that, once Octave is installed via Homebrew, you should type addpath /usr/local/opt/dynare/lib/dynare/matlab

Best,
Houtan

Grateful for your helpful answer. One further query, please: will addpath /usr/local/opt/dynare/lib/dynare/matlab also work for the unstable version? Thanks.

Yes, as you can see here: github.com/DynareTeam/dynare#mac-os-x

Much obliged.

[quote=“HoutanBastani”]I do not encounter the same problem when I install via homebrew so there is something wrong with your setup that is difficult to debug from a distance.

However, you have a problem only if you want both matlab and octave mex files. If you want one or the other, you’re ok. Your build works well when compiling Matlab mex files. So, if you only want these, you can just type

If, on the other hand, you only want Octave files, you’re in luck as these are bottled by homebrew and do not require local compilation. Simply type

If you want both you can:

  1. Install Dynare for Octave as above
  2. Copy the files in /usr/local/Cellar/dynare/4.4.3_3/lib/dynare/mex/octave to your desktop
  3. run brew uninstall dynare
  4. Install Dynare for Matlab as above
  5. Copy the files from step 2 to /usr/local/Cellar/dynare/4.4.3_3/lib/dynare/mex/octave[/quote]

Thanks for the help
I ended up installing the regular Mac package from dynare.org/download/dynare-stable. I just wanted to test it with Octave as well as my license for Matlab is about to expire and will probably not be able to get an extension soon. Also I am trying to use open source solutions as they are more future proof for the research in my experience (pyton, fortran…etc).

But now I will try your method to get it worked for both Octave and Matlab.

Thanks again