coin-or / qpOASES

Open-source C++ implementation of the recently proposed online active set strategy
GNU Lesser General Public License v2.1
385 stars 129 forks source link

Problem in compiling qpOASES on OS X with Matlab 2012b #49

Closed svigerske closed 4 years ago

svigerske commented 4 years ago

Issue created by migration from Trac.

Original creator: traversaro

Original creation time: 2016-04-19 17:13:15

Assignee: ferreau

Version: 3.1.0

Due a problem of missing typedef's used by Matlab headers, qpOASES is not compiling on OS X with Matlab 2012b.

There is an easy workaround consisting in including the typeinfo header before including matlab headers (fix described in http://stackoverflow.com/questions/22367516/mex-compile-error-unknown-type-name-char16-t , implemented in https://github.com/robotology-dependencies/qpOASES/commit/6fd1bfa0034e53923e64e80fdf0ff591e19236fd ).

I don't know which Matlab version/operating systems combination you are supporting, anyhow I was wondering if you are interested in including such a patch in upstream qpOASES?

svigerske commented 4 years ago

Comment by ferreau created at 2016-04-26 08:37:05

Thanks a lot for reporting this issue and pointing to an easy work-around. I have already put your modification into the current development trunk, though I commented out the #include <typeinfo> line. This is because I am not familiar with the typeinfo header and I do not know whether it is available on all platforms/Matlab versions. Do you know more about this?

svigerske commented 4 years ago

Comment by ferreau created at 2016-04-26 08:37:05

Changing status from new to assigned.

svigerske commented 4 years ago

Comment by traversaro created at 2016-04-26 19:53:05

typeinfo is a standard header available in C++98. 4218174697 It is available in Visual Studio since at least the 2010 version [2], while on GCC and Clang standard library it is available since more then 10 years.

It exports C++ RTTI functions that are not related at all with Matlab, but its effectiveness in solving the fact that the mex interfaces uses the char16_t even if it is not define is explained in this stack overflow answer : http://stackoverflow.com/a/24174352/1379427 .

4218174697 : http://en.cppreference.com/w/cpp/header/typeinfo [2] : https://msdn.microsoft.com/en-us/library/ee383693%28v=vs.100%29.aspx [3] :

svigerske commented 4 years ago

Comment by traversaro created at 2016-04-26 20:27:42

Notice that given that this is an OS X specific workaround, you can wrap the inclusion with an appropriate preprocessor check:

#ifdef __APPLE__
#include <typeinfo>
#endif 
svigerske commented 4 years ago

Comment by ferreau created at 2016-04-27 13:20:47

Thanks again for the additional information. I have just made the typeinfo header be included by default on OS X platforms as you suggested. It part of the trunk from revision 194.

svigerske commented 4 years ago

Comment by ferreau created at 2016-04-27 13:20:53

Resolution: fixed