fmi-cross-check icon indicating copy to clipboard operation
fmi-cross-check copied to clipboard

Missing libgfortran.so.3 for JModelica FMU on Linux

Open AnHeuermann opened this issue 5 years ago • 4 comments

When simulating fmus/2.0/me/linux64/JModelica.org/1.15/ControlledTemperature/ControlledTemperature.fmu with fmuChecker a shared library for gfortran can't be found. See the following error log:

$ fmuCheck -k me ControlledTemperature.fmu
[INFO][FMUCHK] FMI compliance checker Test [FMILibrary: Test] build date: Dec 13 2018
[INFO][FMUCHK] Called with following options:
[INFO][FMUCHK] fmuCheck -k me ControlledTemperature.fmu
[INFO][FMUCHK] Will process FMU ControlledTemperature.fmu
[INFO][FMILIB] XML specifies FMI standard version 2.0
[INFO][FMUCHK] Model name: ControlledTemperature
[INFO][FMUCHK] Model GUID: 14ac906d8d18e8da4c3d119d0c9a8a4
[INFO][FMUCHK] Model version:
[INFO][FMUCHK] FMU kind: ModelExchange
[INFO][FMUCHK] The FMU contains:
7 constants
42 parameters
4 discrete variables
38 continuous variables
0 inputs
1 outputs
48 local variables
0 independent variables
11 calculated parameters
80 real variables
6 integer variables
0 enumeration variables
16 boolean variables
0 string variables

[INFO][FMUCHK] Printing output file header
"time","TRes"
[INFO][FMUCHK] Model identifier for ModelExchange: ControlledTemperature
[INFO][FMILIB] Loading 'linux64' binary with 'default' platform types
[FATAL][FMICAPI] Could not load the DLL: libgfortran.so.3: 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
```
What am I missing here? Do I need some additional libraries.
Are the provided test fmu's run with CircleCI? I could not find it there.

GFortran is installed on my Linux (Ubuntu64) fmu. The problem also occures with OMSimulator (which also uses FMI-Library for FMU loading) but it's working on a travis job for my julia FMISimulator, which is not using FMI-Library.

AnHeuermann avatar Jun 25 '19 10:06 AnHeuermann

[FATAL][FMICAPI] Could not load the DLL: libgfortran.so.3: cannot open shared object file: No such file or directory

This signifies that the dynamic loader can't find libgfortran, and since it works on your machine which runs travis, your environments are most likely different.

If you unpack the ControlledTemperature.fmu and then call ldd on the .so file, you'll probably find that libgfortran.so can't be found.

ldd ControlledTemperature.so

I'd try to re-install and make sure "apt-get install libgfortran3" shows that fortran is installed

filip-stenstrom avatar Jun 26 '19 13:06 filip-stenstrom

Indeed I didn't had the right version of libgfortan on my machine. Thanks for the help!

AnHeuermann avatar Jun 26 '19 13:06 AnHeuermann

I would actually reopen this since you must package all dependencies in the FMU and libgfortran3 is not available on all Linux base distributions.

sjoelund avatar Jun 26 '19 14:06 sjoelund

Any news on this issue?

The libgfortran3 dependency is breaking my automated tests for a Julia FMU simulator I'm working on.

The runner I'm using doesn't has libgfortan3. While I could add it for now that doesn't really solve the problem. As soon as the GitHub actions CI changes to Ubuntu Focal runners it will no longer be possible to install gfortran 3 on them and my tests will fail again.

According to https://github.com/modelica/fmi-cross-check/issues/99 it is fine for FMUs to have external dependencies. So my only option as a FMU importer is to skip all JModelica.org tests since they can't run anyway. But what is the point of the cross-check then if it is not possible to import these FMUs?

So my suggestion is to add nonCompliantWithLatestRules to all JModelica.org FMUs that depend on libgfortran.so.3.

AnHeuermann avatar Feb 27 '21 11:02 AnHeuermann