Opened 7 years ago
Last modified 3 years ago
#4540 new defect
Cannot change CFLAGS for C++ FMI simulations
Reported by: | Martin Sjölund | Owned by: | somebody |
---|---|---|---|
Priority: | high | Milestone: | |
Component: | Cpp Run-time | Version: | |
Keywords: | Cc: | Rüdiger Franke, Niklas Worschech |
Description
The C++ runtime does not respect the optimization flags set by the user using the setCFlags()
API function (and additionally you cannot query which flags are being used from within OM).
Change History (9)
comment:1 by , 7 years ago
comment:2 by , 7 years ago
In Simulation Setup:
C/C++ Compiler Flags (Optional): textbox
This option is accepted by the C++ makefiles (uses translateModel(M, cflags="...")
). But, setCFlags()
which is supposed to do the same thing is not accepted.
translateModelFMU does not accept the cflags="..."
optional argument.
comment:3 by , 7 years ago
Hmm... The simulators of the C and Cpp runtime are compiled with -O0
per default. Specifying -O2
in the textbox results in both: -O0 ... -O2
. Doesn't appear hard to implement. Does neither look like change CFLAGS; more like a means to add something missing, like an include path.
Should -O0
possibly be removed from the default flags?
Moreover, couldn't the textbox be placed under Tools->Options->Simulation, next to Target Compiler?
How to treat the -g
flag?
comment:4 by , 7 years ago
-g
is not in the default flags. -O0 -O2
is identical to -O2
so having it in the default flags doesn't hurt and it is indeed changing the level (but also doesn't actually do anything, so it can be removed); note that with setCFlags()
you do change the flag and can remove the default (including -fPIC
which is necessary for compilation to succeed).
comment:6 by , 5 years ago
Milestone: | 1.14.0 → 1.16.0 |
---|
Releasing 1.14.0 which is stable and has many improvements w.r.t. 1.13.2. This issue is rescheduled to 1.16.0
comment:8 by , 4 years ago
Milestone: | 1.17.0 → 1.18.0 |
---|
Retargeted to 1.18.0 because of 1.17.0 timed release.
The current practice is to manually modify the automatically generated <modelName>.makefile in the working directory and call
to get different compiler optimizations applied.
It would indeed be good if these flags could be changed within the automatic process. Where do you enter CFLAGS in OMEdit?