Opened 9 years ago

Last modified 6 years ago

#3950 new enhancement

Cross compilation of FMUs under Windows

Reported by: Rüdiger Franke Owned by: Martin Sjölund
Priority: high Milestone: Future
Component: Build Environment Version:
Keywords: Cc: Adrian Pop

Description (last modified by Rüdiger Franke)

Recently a 64bit Windows version of OpenModelica was introduced. A separate 32bit version is still needed for the export of 32bit FMUs. This should be covered with cross compilation instead.

Cross compilation already works under Linux, including an extended

CevalScriptBackend.buildModelFMU(className = "MyModel", platforms = {"i686-w64-mingw32"})

where platforms is a list of "static", "dynamic" and target triplets, like 32 bit windows in the example. Moreover the OMEdit configuration of FMI export was extended for cross compilation (Tools -> Options -> FMI). The C runtime implements cross compilation of minimal FMUs including source code; the Cpp runtime implements export of full FMUs using pre-compiled runtime libs for the respective target platform.

If cross compilation shall work like under Linux then we need:

  • compilers with the name i686-w64-mingw32-gcc and i686-w64-mingw32-g++ (OMEdit and the FMU makefiles would expect it)
  • static versions of libgcc and libstdc++ (and possibly libwinpthread) along with these compilers
  • call the Cpp FMU makefile with a triplet argument TARGET_TRIPLET=i686-w64-mingw32 (this happens automatically if checked in OMEdit, calling CevalScriptBackend.buildModelFMU with platforms argument)
  • an additional version of the Cpp runtime *_static libs generated with this compiler and placed in the directory "$(OMHOME)/lib/$(TARGET_TRIPLET)/omc/cpp"

The concept of the target triplet might be extended to msvc. Then msvc libs would not be placed in subdirectories of the gcc libs anymore, like

$(OMHOME)/lib/omc/cpp/msvc

but besides the gcc libs using another TARGET_TRIPLET, like

$(OMHOME)/lib/$(TARGET_TRIPLET_FOR_MSVC)/omc/cpp

Change History (5)

comment:1 by Rüdiger Franke, 9 years ago

Description: modified (diff)

comment:2 by Martin Sjölund, 8 years ago

Milestone: 1.10.01.11.0

Ticket retargeted after milestone closed

comment:3 by Martin Sjölund, 8 years ago

Milestone: 1.11.01.12.0

Milestone moved to 1.12.0 due to 1.11.0 already being released.

comment:4 by Francesco Casella, 7 years ago

Milestone: 1.12.0Future

The milestone of this ticket has been reassigned to "Future".

If you think the issue is still valid and relevant for you, please select milestone 1.13.0 for back-end, code generation and run-time issues, or 2.0.0 for front-end issues.

If you are aware that the problem is no longer present, please select the milestone corresponding to the version of OMC you used to check that, and set the status to "worksforme".

In both cases, a short informative comment would be welcome.

comment:5 by torsten.knodt+org.openmodelica.trac@…, 6 years ago

Being able to export a 32-bit FMU on 64-bit would be required e.g. to use the FMUs in Vector CANoe, which is a major tool in automotive industry. Sooner or later they will probably also support 64Bit FMUs, but older versions will have to be in the field for many years and should IMHO be supported.

Note: See TracTickets for help on using tickets.