Skip to content
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

MacOS Compile Instructions 02/2024 #5

Open
bennm37 opened this issue Mar 1, 2024 · 0 comments
Open

MacOS Compile Instructions 02/2024 #5

bennm37 opened this issue Mar 1, 2024 · 0 comments

Comments

@bennm37
Copy link

bennm37 commented Mar 1, 2024

To get this to compile on an Apple Silicon running MacOS (Sonoma 14.3) with maca64 Matlab, I had to do the following:

  • Change all instances of MEX= mex to MEX=/Applications/MATLAB_R20XX/bin/mex
  • Configure mex to have a real gcc compiler option.

Note on mac by default gcc (/usr/bin/gcc) is a symlink to clang. You'll need to install gcc from homebrew (or macports etc). gcc-11 worked for me
brew install gcc@11
Type gcc-11 into terminal to check that this has installed properly.
To configure mex to use this compiler, you'll then need to add an xml file to /Applications/MATLAB_R20XX/bin/maca64/mexopts which specifies which version of gcc and the architecture. Examples for intel macs can be found here (https://github.com/danfortunato/matlab-gcc).
I cobbled this one together from the intel examples and the clang_maca64.xml that MATLAB uses by default. It worked for me but I'm not an expert in C compiler flags etc by any means so there may be some nonsensical things in there.
gcc_maca64.xml.txt
(.txt added so could upload to markdown, remove this)
With this in place, run
mex -setup c
and choose the gcc option you added.
Now try the typical install instructions.

make mwrap
make mex-matlab 
make test-mex-matlab

Good luck!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant