title: Can I build mex for linux on mac?
body: <p>Is it possible to use MATLAB on macOS to build a mex file for running on linux (with the <code>.mexa64</code> extension)? Suppose that I have an appropriate compiler such as GCC. How would I do this? I couldn't find any useful arguments in <a href="https://www.mathworks.com/help/matlab/ref/mex.html" rel="nofollow noreferrer"><code>mex</code></a>.</p>
  
  <p>I understand building for a different platform would <a href="https://stackoverflow.com/questions/5245444/cross-compiler-for-linux-on-mac-os-x">require a full toolchain</a>, but I'm wondering if MATLAB has one already under the hood.</p>