Opened 5 years ago
Last modified 4 years ago
#6017 assigned defect
FMUs don't export libopenblas.so — at Version 1
| Reported by: | Andreas Heuermann | Owned by: | Lennart Ochel |
|---|---|---|---|
| Priority: | blocker | Milestone: | 1.19.0 |
| Component: | FMI | Version: | v1.16.0-dev |
| Keywords: | fmi-cross-check | Cc: | Martin Sjölund |
Description (last modified by )
I'm building a static C FMU 2.0 for ModelExchange with OpenModelica and try to simulate it with FMPy in a clean testing environment without omc available.
Our OpenModelica FMUs can't be simulated with FMPy since they are missing openblas.so
How to reproduce
Note: You will need omc and docker in your path.
Also you have to trust my docker container or build your own ;-)
Run in your shell:
$ omc buildFMU.mos
true
""
"/home/.../ticket6010/BouncingBall.fmu"
""
$ docker run -it --rm -v $(pwd):/testDir anheuermann/fmpy:focal-arm64 /bin/bash
root@19cd9af7df5a:/# cd /testDir/
root@19cd9af7df5a:/testDir# ls *.fmu
BouncingBall.fmu
root@19cd9af7df5a:/testDir# python3
Python 3.8.2 (default, Apr 27 2020, 15:53:34)
[GCC 9.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from fmpy import *
>>> fmu='BouncingBall.fmu'
>>> result = simulate_fmu(fmu)
Traceback (most recent call last):
File "/usr/local/lib/python3.8/dist-packages/fmpy/fmi1.py", line 142, in __init__
self.dll = cdll.LoadLibrary(libraryPath)
File "/usr/lib/python3.8/ctypes/__init__.py", line 451, in LoadLibrary
return self._dlltype(name)
File "/usr/lib/python3.8/ctypes/__init__.py", line 373, in __init__
self._handle = _dlopen(self._name, mode)
OSError: libopenblas.so.0: cannot open shared object file: No such file or directory
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python3.8/dist-packages/fmpy/simulation.py", line 557, in simulate_fmu
fmu = instantiate_fmu(unzipdir, model_description, fmi_type, visible, debug_logging, logger, fmi_call_logger, use_remoting)
File "/usr/local/lib/python3.8/dist-packages/fmpy/simulation.py", line 646, in instantiate_fmu
fmu = FMU2Model(**fmu_args)
File "/usr/local/lib/python3.8/dist-packages/fmpy/fmi2.py", line 409, in __init__
super(FMU2Model, self).__init__(**kwargs)
File "/usr/local/lib/python3.8/dist-packages/fmpy/fmi2.py", line 85, in __init__
super(_FMU2, self).__init__(**kwargs)
File "/usr/local/lib/python3.8/dist-packages/fmpy/fmi1.py", line 144, in __init__
raise Exception("Failed to load shared library %s. %s" % (libraryPath, e))
Exception: Failed to load shared library /tmp/tmprujxrrsu/binaries/linux64/BouncingBall.so. libopenblas.so.0: cannot open shared object file: No such file or directory
>>>
buildFMU.mos
loadString("
model BouncingBall
parameter Real e=0.7 \"coefficient of restitution\";
parameter Real g=9.81 \"gravity acceleration\";
Real h(fixed=true, start=1) \"height of ball\";
Real v(fixed=true) \"velocity of ball\";
Boolean flying(fixed=true, start=true) \"true, if ball is flying\";
Boolean impact;
Real v_new(fixed=true);
Integer foo;
equation
impact = h <= 0.0;
foo = if impact then 1 else 2;
der(v) = if flying then -g else 0;
der(h) = v;
when {h <= 0.0 and v <= 0.0,impact} then
v_new = if edge(impact) then -e*pre(v) else 0;
flying = v_new > 0;
reinit(v, v_new);
end when;
end BouncingBall;");
getErrorString();
buildModelFMU(BouncingBall, version="2.0", fmuType="me", fileNamePrefix="BouncingBall", platforms={"static"});
getErrorString();
Note:
See TracTickets
for help on using tickets.

Same problem for fmuChecker:
$ docker run -it --rm -v $(pwd):/testDir docker.openmodelica.org/fmuchecker:v2.0.4 /bin/bash root@f7f16bbcefb2:/# cd /testDir/ root@f7f16bbcefb2:/testDir# ls *.fmu BouncingBall.fmu root@f7f16bbcefb2:/testDir# fmuCheck.linux64 -f -h 0.002 -n 0 -k me BouncingBall.fmu [INFO][FMUCHK] FMI compliance checker 2.0.4 [FMILibrary: 2.0.3] build date: Nov 6 2017 [INFO][FMUCHK] Called with following options: [INFO][FMUCHK] fmuCheck.linux64 -f -h 0.002 -n 0 -k me BouncingBall.fmu [INFO][FMUCHK] Will process FMU BouncingBall.fmu [INFO][FMILIB] XML specifies FMI standard version 2.0 [INFO][FMUCHK] Model name: BouncingBall [INFO][FMUCHK] Model GUID: {26e75b47-c6e0-4645-bf77-9ef0c8e991af} [INFO][FMUCHK] Model version: [INFO][FMUCHK] FMU kind: ModelExchange [INFO][FMUCHK] The FMU contains: 0 constants 2 parameters 4 discrete variables 4 continuous variables 0 inputs 0 outputs 8 local variables 0 independent variables 0 calculated parameters 7 real variables 1 integer variables 0 enumeration variables 2 boolean variables 0 string variables [INFO][FMUCHK] Printing output file header "time","h","v","der(h)","der(v)","v_new","e","g","foo","flying","impact" [INFO][FMUCHK] Model identifier for ModelExchange: BouncingBall [INFO][FMILIB] Loading 'linux64' binary with 'default' platform types [FATAL][FMICAPI] Could not load the DLL: libopenblas.so.0: cannot open shared object file: No such file or directory [FATAL][FMUCHK] Could not create the DLL loading mechanism(C-API) for ME. FMU check summary: FMU reported: 0 warning(s) and error(s) Checker reported: 0 Warning(s) 2 Error(s) 2 Fatal error(s) occurred during processing root@f7f16bbcefb2:/testDir#