MEX for different platforms - deployment question.
9 views (last 30 days)
Show older comments
HI,
I have some software than will be used by different members of a team. Everyone has matlab, but annoyingly on different platforms (i.e. Linux, Win and OSX).
There is some fortran mex involved, which compiles without problem on Linux, but annoyingly we don't have compatible Fortran compilers on Windows (or MAc, but that's probably in Xcode somewhere I guess).
My question is can you use mex to compile for different targets? So on the linux machine (gfortran) it makes xxxx.mexa64, is it possible to get it to make xxxx.mexw64 and xxxx.mexmaci with some switch or something?
I have coder, but don't see how that would help because the source is Fortran.
My third option would be maybe to build the Fortran as a shared library in each case and try 'loadlibrary' maybe?
So basically, I'm developing on Linux, the code needs a Fortran mex but I need to be able to deploy on Mac and Windows also. What's considered best practice for this kind of thing?
Cheers,
Arwel
1 Comment
Walter Roberson
on 20 Mar 2019
Edited: Walter Roberson
on 20 Mar 2019
Note: the only supported Fortran for Mac is Intel Parallel Studios https://www.mathworks.com/content/dam/mathworks/mathworks-dot-com/support/sysreq/files/system-requirements-release-2018b-supported-compilers.pdf . You might be able to hack g77 to work, but it is not supported.
Answers (1)
Walter Roberson
on 20 Mar 2019
No; you have to compile on a compatible system. The only cross-compilation support that existed historically was that you used to be able to target Windows 32 bit systems while running on Windows 64 bit.
On Linux you just might be able to work something out involving Vine or similar to run Windows in parallel, but it would probably be a nuisance.
0 Comments
See Also
Categories
Find more on Fortran with MATLAB in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!