How to build the GetFEM++-3.1 interface for Matlab 2007b on Windows XP 32bit

Here I describe how I built the getfem_toolbox. This description is based on the original readme. I hope it is helpful. Feel free to correct this description!

Prerequisites

Building and Installing the Matlab Interface

  • Download the latest release getfem++ (here 3.1 is described): http://download.gna.org/getfem/html/homepage/download.html
  • Untar it to $HOME/getfem++-3.1/
  • Open the msys shell, untar and configure and compile it with the following commands (no need to do a “make install”):
    ./configure --enable-matlab=yes --with-getfem-config=$HOME/getfem++-3.1/getfem-config-notinstalled \
      --with-toolbox-dir=$HOME/getfem_toolbox
    make
  • Ensure that you have mex.bat in the PATH. If necessary, add the path to this file for example with:
    export PATH=/c/Program\ Files/MATLAB/R2007b/bin:$PATH
  • It should build fine until the “mex” stage. At this point the script will fail, it is expected. Build the mex by hand, in a windows shell (not msys)
    1. use short DOS names (i.e. c:\Progra~1 etc) as the mex.bat of matlab does not handle spaces in file names
    2. add the -D”MATLAB_RELEASE=14” option
    3. I did use the following command to build the gf_matlab.mexw32 (<YOUR_MSYS_USER> must be replaced):
      cd getfem++-3.1/interface/src/matlab
      "c:/Progra~1/MATLAB704/bin/win32/mex.bat" -v -f c:/path/to/mexopts.bat ^
       -output gf_matlab -g -D"MATLAB_RELEASE=14" ./gfm_mex.c ./gfm_common.c ^
       -I. -I.. ./../gfi_array.c ../.libs/libgetfemint.a ^
       C:/msys/1.0/home/<YOUR_MSYS_USER>/getfem++-2.0/src/.libs/libgetfem.a ^
       c:/MinGW/lib/libstdc++.a
    4. If you have set up Matlab correctly for gnumex (http://gnumex.sourceforge.net/#matlab_steps) you can use this from within the MATLAB shell (<YOUR_MSYS_USER> must be replaced):
      cd getfem++-3.1/interface/src/matlab
      mex -v -output gf_matlab -g -D"MATLAB_RELEASE=14" ./gfm_mex.c ./gfm_common.c -I. -I.. ./../gfi_array.c ../.libs/libgetfemint.a C:/msys/1.0/home/<YOUR_USERNAME>/getfem++-3.1/src/.libs/libgetfem.a c:/MinGW/lib/libstdc++.a
  • Finally go back in msys and type “make install”. Everything is available in c:\msys\1.0\home\<YOUR_MSYS_USER>\getfem_toolbox
  • Open Matlab, go to
    1. File > Set Path… > Add Folder… >
    2. Choose “c:\msys\1.0\home\<YOUR_MSYS_USER>\getfem_toolbox”
    3. Ok > Save > Close. Now you are ready to work with getfem++ in Matlab.

Remarks

When using the graphical interface of matlab, a number of intermediate messages of getfem get lost (for example those displaying the progression of iterative solvers). You may want to launch matlab from the msys shell instead of launching it from its shortcut. In that case, those intermediate messages from getfem will be displayed in the msys window.

Comments

 
 
how_to/build_getfem_matlab_toolbox_on_windows_xp.txt · Last modified: 28.11.2010 03:17 (external edit)
Recent changes RSS feed Creative Commons License Valid XHTML 1.0 Valid CSS Driven by DokuWiki
Drupal Garland Theme for Dokuwiki