====== Building 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 ===== * If you don't want to build the getfem, you can download a compiled version here: [[http://d.windhoff.net:8080/m/getfem31-w32.zip]]. I had problems with gnumex and Windows XP 64bit, but may be I just did not try enough. * Install mingw [[http://www.mingw.org/]] * Install msys [[http://www.mingw.org/wiki/msys]] * Install gnumex [[http://gnumex.sourceforge.net/#matlab_steps]], and use it to create a mexopts.bat file for mingw. ===== Building and Installing the Matlab Interface ===== * Download the latest release getfem++ (here 3.1 is described): [[http://home.gna.org/getfem/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) - use short DOS names (i.e. c:\Progra~1\ etc) as the mex.bat of matlab does not handle spaces in file names - add the -D"MATLAB_RELEASE=14" option - I did use the following command to build the gf_matlab.mexw32 ( 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//getfem++-2.0/src/.libs/libgetfem.a c:/MinGW/lib/libstdc++.a - If you have set up Matlab correctly for gnumex ([[http://gnumex.sourceforge.net/#matlab_steps]]) you can use this from within the MATLAB shell ( 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//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\\getfem_toolbox * Open Matlab, go to - File > Set Path... > Add Folder... > - Choose "c:\msys\1.0\home\\getfem_toolbox" - 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. ====== Building getfem++ from SVN on Ubuntu Jaunty 64bit for Matlab 2007b or 2008a ====== That's what I did - might be incomplete etc. # Determine MATLAB directory, mex must be in the PATH. MATLAB_ROOT=`mex -v 2>&1 | grep "MATLAB " | awk '{print $4}' | sed -e '2,$d'` # May be thats not all you need sudo apt-get install build-essential subversion libtool # Get the sources svn co http://svn.gna.org/svn/getfem/trunk getfem cd getfem/getfem++/ ./autogen.sh ./configure --enable-matlab --with-pic --with-matlab-toolbox-dir=$MATLAB_ROOT/toolbox/getfem_toolbox make && make check # If all checks passed do sudo make install # Add the path to the matlab path definitions file echo "p=[matlabroot,'/toolbox/getfem_toolbox:',p];" | sudo tee -a $MATLAB_ROOT/toolbox/local/pathdef.m # Then I had to move the old libraries to a different folder to make matlab use the newer ones from ubuntu cd $MATLAB_ROOT/sys/os/glnxa64/ sudo mkdir old sudo mv libstdc* libgcc_s* old/. # If you see an empty output, the path should be added correctly $MATLAB_ROOT/bin/matlab -nojvm -nosplash -r "gf_workspace('clear'); exit;"