CATIA-Systems / FMPy

Simulate Functional Mockup Units (FMUs) in Python
Other
429 stars 118 forks source link

FMUs with aarch64-darwin binaries not supported #623

Closed Maplesoft-fmigroup closed 8 months ago

Maplesoft-fmigroup commented 10 months ago

In version 0.3.19 of fmpy, we get the following error when trying to simulate FMI3.0 FMU with binaries/aarch64-darwin:

Python/3.11.6/APPLE_ARM64_MACOS/lib/python3.11/site-packages/fmpy/simulation.py", line 667, in simulate_fmu\n    raise
Exception(f"The FMU cannot be simulated on the current platform ({platform}).")\n', 'Exception: The FMU cannot be simulated on the current platform (darwin64).\n']

the issue is probably on line 100 of __init__.py: 100 if head in {'binaries/darwin64', 'binaries/x86_64-darwin'} and tail.endswith('.dylib'):

t-sommer commented 10 months ago

Unfortunately I don't have access to an Apple Silicon Mac. Can you suggest a change that works for you?

Maplesoft-fmigroup commented 10 months ago

These are the changes I made to get around the problem: in __init__.py:

import platform
if platform.machine() == 'arm64':
    architecture = 'aarch64'

and on line 100: if head in {'binaries/darwin64', 'binaries/x86_64-darwin', 'binaries/aarch64-darwin'} and tail.endswith('.dylib'): These allowed me to simulate FMI3.0 FMU with ARM binaries. Additionally, I made some changes in util.py line 867: if target_platform in ['darwin64', 'x86_64-darwin', 'aarch64-darwin']: