-
Notifications
You must be signed in to change notification settings - Fork 259
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Build failed when compiling to mexfile #872
Comments
Could you please share the complete context of the first error message? |
Sure, bere it is The first one
|
IIUC, this error is emitted if you include I'm not entirely sure why @DrTimothyAldenDavis: Wouldn't it be cleaner if it were left to the user to include Matlab headers as needed? @smsimone: Does it make a difference if you include the SuiteSparse headers before |
When SuiteSparse_config is compiled for a mexFunction, it sets the default memory allocators to be mxMalloc and company; you don't want SuiteSparse to use malloc/free when inside a MATLAB mexFunction. That's why it needs mex.h. Both SuiteSparse_config.h and mex.h are C header files. Can you try placing SuiteSparse_config.h inside an extern "C" { ... } block? |
That probably won't help. That error message in
So, it won't make a difference whether or not |
That sounds like a pretty annoying limitation. |
OK ... I'll think about a workaround for the current version (a hack to /usr/include/suitesparse/SuiteSparse_config.h for @smsimone so the existing libsuitesparse-dev:7.6.1 can be used), and then also a cleaner fix for SuiteSparse 7.8.3. The hack to SuiteSparse_config.h might be something like change its "#include 'mex.h'" to
Alternatively, the inclusion of mex.h could be avoided in the end user application by adding
before including SuiteSparse_config.h. That would allow the existing SuiteSparse_config.h from v7.6.1 to work without |
I revised the draft SuiteSparse 7.8.3 to fix this issue: 39c23ae The mex.h and matrix.h files are no longer #include'd in SuiteSparse_config.h in that update. To workaround your issue and continue to use the libsuitesparse-dev:7.6.1, you could either edit your /usr/include/suitesparse/SuiteSparse_config.h file to remove those 2 lines, or you can try adding these lines to your own application, before including any SuiteSparse packages, if you can't edit your /usr/include/suitesparse/SuiteSparse_config.h file:
Let me know if either works. |
Since I was on Ubuntu 22.04 and
libsuitesparse-dev:5.10.1
my application did compile correctly, now I've updated my system to ubuntu 24.04 withlibsuitesparse-dev:7.6.1
and it does not compile anymore with the errorerror: #error Using MATLAB Data API with C Matrix API is not supported.
I've tried to use the
mex
compiler from both Matlab 23.2 and Matlab 24.1.Between the logs I've found also this statement here (it was after the matlab error) which I don't know if it belongs to the previous error or not:
The text was updated successfully, but these errors were encountered: