windowsmacossimulinkmodelicafmi

How to compile an FMU on Windows to be used in Mac?


I have generated one FMU on Windows, and imported the FMU on Mac using Matlab Simulink, and got the following error. I searched for the problem and get some clues from the answer here, it seems like FMU will be stored as different form when generated on Windows and Mac.

The question is: is it possible to generate an FMU on Windows that still works on Mac?

enter image description here


Solution

  • In order to compile for MacOS, you need the C headers for the MacOS platform. These are only available in XCode which only runs on MacOS and the headers themselves are not allowed to be redistributed.

    As such, it's pretty hard to cross-compile for MacOS. You can install XCode on your Mac, move the required headers to your system and compile a Darwin toolchain on your Windows machine (I believe), but it's very error-prone and annoying to update for newer MacOS versions.

    The easiest way would be to run MacOS and cross-compile Windows+Linux binaries since these platforms are less closed.

    Or like @matth commented, generate a source-code FMU and compile that using the native toolchain on any platform you need.