MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn moreOpportunities for recent engineering grads.

Apply TodayTo resolve issues starting MATLAB on Mac OS X 10.10 (Yosemite) visit: http://www.mathworks.com/matlabcentral/answers/159016

Asked by Edward on 22 Jan 2013

Using gcc / g++ 4.4.7, I get the following errors on attempting to compile SeDuMi:

mex -O -DUNIX -DmwIndex=int -DmwSize=int -DmwSignedIndex=int bwblkslv.c sdmauxFill.c sdmauxRdot.c "-lmwlapack" In file included from /usr/local/MATLAB/R2012b/extern/include/matrix.h:294, from /usr/local/MATLAB/R2012b/extern/include/mex.h:58, from bwblkslv.c:44: /usr/local/MATLAB/R2012b/extern/include/tmwtypes.h:792: error: two or more data types in declaration specifiers /usr/local/MATLAB/R2012b/extern/include/tmwtypes.h:792: warning: useless type name in empty declaration /usr/local/MATLAB/R2012b/extern/include/tmwtypes.h:793: error: two or more data types in declaration specifiers /usr/local/MATLAB/R2012b/extern/include/tmwtypes.h:793: warning: useless type name in empty declaration /usr/local/MATLAB/R2012b/extern/include/tmwtypes.h:794: error: two or more data types in declaration specifiers /usr/local/MATLAB/R2012b/extern/include/tmwtypes.h:794: warning: useless type name in empty declaration

mex: compile of ' "bwblkslv.c"' failed.

I'm not able to make much sense of the error, but it seems rather odd to have a built-in header fail this way.

The only system-wide change that I've made is modifying mexopts.sh to use gcc/g++-4.4 instead of the system's gcc/g++-4.6.

Anyway, I'm totally over my head here. Help much appreciated!

Edit: Spot manages to use mex just fine though, so maybe it is a bug in SeDuMi...

*No products are associated with this question.*

Answer by James Tursa on 22 Jan 2013

Accepted answer

I suspect the defines -DmwIndex=int -DmwSize=int -DmwSignedIndex=int were intended for older versions of MATLAB (R2006a and earlier) that did not have these defined. But mwIndex, mwSize, and mwSignedIndex **are** defined for R2006b and later, including the R2012b you are using. I would suggest deleting these defines from the mex command line. E.g., try this instead:

mex -O -DUNIX bwblkslv.c sdmauxFill.c sdmauxRdot.c "-lmwlapack"

Edward on 22 Jan 2013

Thanks! For future reference, doing as you reccomended solved the initial problem, and pointed out that the larger problem was the install script not recognizing the MATLAB version (which caused a linking problem later on).

James Tursa on 22 Jan 2013

Another item to be aware of for automated scripts using BLAS and LAPACK functions is that up through R2007a the functions for both of these libraries were physically combined into the single LAPACK library that ships with MATLAB. Starting with R2007b the BLAS and LAPACK libraries are shipped as two separate library files.

Answer by Jan Simon on 22 Jan 2013

Edited by Jan Simon on 22 Jan 2013

This code can be added the C/C++ files to support the new types for old Matlab versions:

// Assume 32 bit addressing for Matlab 6.5: // See MEX option "compatibleArrayDims" for MEX in Matlab >= 7.7. #ifndef MWSIZE_MAX #define mwSize int32_T // Defined in tmwtypes.h #define mwIndex int32_T #define mwSignedIndex int32_T #define MWSIZE_MAX MAX_int32_T #endif

## 0 Comments