Page 1 of 1

Compiling Failed

PostPosted: Wed Apr 01, 2009 6:25 pm
by bigbigben
I try to compile the SVN version of dynare, but it does not work for mw.

Following the instruction in Dynare Wiki: http://www.dynare.org/DynareWiki/BuildingDlls, I run the build_matlab.m file. Below is the error message:

--> lcc -c -Zp8 -I"C:\JH\PROGRA~1\MATLAB\R2008B\sys\lcc\include" -DMATLAB_MEX_FILE -noregistrylookup -FoC:\DOCUME~1\ECONGRAD\LOCALS~1\TEMP\MEX_RK~1\isopenmp.obj -IC:\JH\PROGRA~1\MATLAB\R2008B\extern\include -IC:\JH\PROGRA~1\MATLAB\R2008B\simulink\include -DNDEBUG -DMX_COMPAT_32 C:\JH\DYNARE~2\DYNARE~1\TRUNK\MEX\SOURCES\THREADS\isopenmp.cc

Error C:\JH\DYNARE~2\DYNARE~1\TRUNK\MEX\SOURCES\THREADS\isopenmp.cc: 40 illegal statement termination
Error C:\JH\DYNARE~2\DYNARE~1\TRUNK\MEX\SOURCES\THREADS\isopenmp.cc: 40 skipping `double'
Error C:\JH\DYNARE~2\DYNARE~1\TRUNK\MEX\SOURCES\THREADS\isopenmp.cc: 40 undeclared identifier `z'
Error C:\JH\DYNARE~2\DYNARE~1\TRUNK\MEX\SOURCES\THREADS\isopenmp.cc: 40 type error: pointer expected
Warning C:\JH\DYNARE~2\DYNARE~1\TRUNK\MEX\SOURCES\THREADS\isopenmp.cc: 40 Statement has no effect
Error C:\JH\DYNARE~2\DYNARE~1\TRUNK\MEX\SOURCES\THREADS\isopenmp.cc: 41 operands of = have illegal types `int' and `pointer to double'
Error C:\JH\DYNARE~2\DYNARE~1\TRUNK\MEX\SOURCES\THREADS\isopenmp.cc: 44 type error: pointer expected
Error C:\JH\DYNARE~2\DYNARE~1\TRUNK\MEX\SOURCES\THREADS\isopenmp.cc: 48 type error: pointer expected
7 errors, 1 warnings

C:\JH\PROGRA~1\MATLAB\R2008B\BIN\MEX.PL: Error: Compile of 'THREADS\isopenmp.cc' failed.

??? Error using ==> mex at 213
Unable to complete successfully.

Error in ==> build_matlab at 105
eval([ 'mex ' COMPILE_OPTIONS ' -outdir ' OUTPUT_DIR ' threads/isopenmp.cc '
]);


Furthermore, the compile of the binary file does not work well. Here is the link to the Wiki: http://www.dynare.org/DynareWiki/BuildingPreprocessor.
I type "make" under the same directory where the file "makefile" is . Unfortunately, the message in CYGWIN is too long and can't be copied. After the compilation, when I try running some .mod file, an error message pops up:

'"C:\JH\dynare_v4\dynare_v4_svn\trunk\matlab\dynare_m"' is not recognized as an internal or external command,
operable program or batch file.

??? Error using ==> dynare at 119
DYNARE: preprocessing failed

Does anyone know how to fix it?

Re: Compiling Failed

PostPosted: Wed Apr 01, 2009 7:12 pm
by StephaneAdjemian
Hi, You have at least three problems here:

  1. You are trying to compile with lcc (the c compiler distributed with matlab) files with a cc extension (c++)... I think that for isopenmp.cc and the kronecker product related files you can change the cc extensions with c extensions (these files contain pure c code). But this simple fix won't work for the gensylv related files (these are real c++ files).
  2. More generally you have to use gcc instead of lcc, we will never test our routines against lcc.
  3. Before the end of the week I will remove from build_matlab.m the compilation of isopenmp.cc. This mex file detects if your PC has a recent openmp library (a library used for parallel computing). But this is a very unstable feature, so we decided to remove this from the matlab script and to create another script for "advanced users".

For the compilation of the preprocessor, I don't know... Could you post, at least, the begining of the error message ? Are you using windows XP/vista 32/64 bits?

Best,
Stéphane.

Re: Compiling Failed

PostPosted: Thu Apr 02, 2009 2:15 pm
by bigbigben
Thanks for your response, Stephane. How should I compile with gcc, if I only have Matlabe. As for the compilation of preprocessor, I don't know how to copy the messages from CYGWIN. The message is too long and moves too fast. I can only see the end of it. I am using windows XP 32 bit with Matlab 2008b.

Re: Compiling Failed

PostPosted: Thu Apr 02, 2009 2:48 pm
by StephaneAdjemian
You will find some informations about the compilation of the mex files with cygwin/gcc [url=http://www.dynare.org/DynareWiki/BuildingDlls]here[url] (you will need the file mexopts.bat to configure the matlab command mex). I am not a Windows user so I have no experience with this...

You can redirect the output given by the compilation in a log file. For instance, if you type:

Code: Select all
make > make.log


you won't see any output in the command window but a file named make.log will be created (with all the messages inside).

Best, Stéphane.

Re: Compiling Failed

PostPosted: Thu Apr 02, 2009 5:25 pm
by bigbigben
Deare Stephane:

I figured out the compilation of the preprocessors. Actually, I didn't create the symbolic link in the director /usr/include/mingw. Instead, I copy the file directly. I should type "make" under the directory of preprocessor, instead of "trunk", even the file" makefile" is under the latter directory.

As for the compiling of DLLS. How should I run mexopts in CYGWIN? I run it under windows and it generates a folder under the director of Matlab. Is that supposed to be the case?

Thank you very much for your help.

Re: Compiling Failed

PostPosted: Fri Apr 03, 2009 1:46 pm
by StephaneAdjemian
You do not have to run mexopts.bat, but to save it under your matlab directory as described on the DynareWiki.

Stéphane.