﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc
3616	RHEL 6.7: FMU fails to compile: stringAppend missing	cxh@…	Martin Sjölund	"Under RHEL 6.7, the attached FMU is successfully created, but unzipping the .fmu file, configuring and running make fails because stringAppend is missing.

A workaround is to add -L/usr/local/openmodelica/lib/omc -lSimulationRuntimeC to the Makefile.

A fix would be to include the definition of stringAppend() from OMCompiler/SimulationRuntime/c/meta/meta_modelica_builtin.c

To replicate:
{{{
[cxh@terra tmp]$ mkdir /tmp/hc
[cxh@terra tmp]$ cd /tmp/hc
[cxh@terra hc]$ cp /home/cxh/src/ptII/ptolemy/actor/lib/fmi/fmus/omc/HeatConductorComplex/HeatConductorComplex.mo .
[cxh@terra hc]$ cp /home/cxh/src/ptII/ptolemy/actor/lib/fmi/fmus/omc/HeatConductorComplex/HeatConductorComplex.mos .
[cxh@terra hc]$ /usr/local/openmodelica/bin/omc --version
v1.9.4-dev.719+ga6c7cb2
[cxh@terra hc]$ /usr/local/openmodelica/bin/omc HeatConductorComplex.mos
true
""""
true
""""
""SimCode: The model HeatConductorComplex has been translated to FMU""
""Warning: The initial conditions are not fully specified. Use +d=initialization for more information.
""
[cxh@terra hc]$ mkdir tmp
[cxh@terra hc]$ cd tmp
[cxh@terra tmp]$ unzip ../HeatConductorComplex.fmu
Archive:  ../HeatConductorComplex.fmu
   creating: binaries/
   creating: binaries/linux64/

...

  inflating: sources/HeatConductorComplex_04set.c
  inflating: sources/config.guess
[cxh@terra tmp]$ cd sources
[cxh@terra sources]$ ./configure
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu

...

vers/zscal.o include/./external_solvers/ztrmm.o include/./external_solvers/ztrmv.o include/./external_solvers/d_cnjg.o include/./externa\
l_solvers/i_len.o include/./external_solvers/i_nint.o include/./external_solvers/pow_di.o include/./external_solvers/s_cmp.o include/./e\
xternal_solvers/s_copy.o -L""/tmp/hc""   -Wl,--no-undefined -shared -static-libgcc -lm -lpthread
HeatConductorComplex_08bnd.o: In function `HeatConductorComplex_eqFunction_40':
HeatConductorComplex_08bnd.c:(.text+0x15e): undefined reference to `stringAppend'
HeatConductorComplex_10asr.o: In function `HeatConductorComplex_eqFunction_41':
HeatConductorComplex_10asr.c:(.text+0x7e): undefined reference to `stringAppend'
HeatConductorComplex_10asr.o: In function `HeatConductorComplex_eqFunction_42':
HeatConductorComplex_10asr.c:(.text+0x1ce): undefined reference to `stringAppend'
HeatConductorComplex_10asr.o: In function `HeatConductorComplex_eqFunction_43':
HeatConductorComplex_10asr.c:(.text+0x324): undefined reference to `stringAppend'
HeatConductorComplex_10asr.o: In function `HeatConductorComplex_eqFunction_44':
HeatConductorComplex_10asr.c:(.text+0x46c): undefined reference to `stringAppend'
include/./util/rtclock.o: In function `rt_tick':
/tmp/hc/tmp/sources/include/./util/rtclock.c:417: undefined reference to `clock_gettime'
include/./util/rtclock.o: In function `rt_tock':
/tmp/hc/tmp/sources/include/./util/rtclock.c:429: undefined reference to `clock_gettime'
include/./util/rtclock.o: In function `rt_accumulate':
/tmp/hc/tmp/sources/include/./util/rtclock.c:487: undefined reference to `clock_gettime'
include/./util/rtclock.o: In function `rt_ext_tp_tock':
/tmp/hc/tmp/sources/include/./util/rtclock.c:534: undefined reference to `clock_gettime'
include/./util/rtclock.o: In function `rt_ext_tp_tick':
/tmp/hc/tmp/sources/include/./util/rtclock.c:523: undefined reference to `clock_gettime'
collect2: error: ld returned 1 exit status
make: *** [HeatConductorComplex_FMU] Error 1
[cxh@terra sources]$
}}}

Note that this FMU has the problem with clock_gettime() reported in #3615, which is fixed by adding -lrt to LDFLAGS in Makefile.

The workaround here is to modify Makefile:
{{{
LDFLAGS= -Wl,--no-undefined -shared -static-libgcc -lm -lpthread 
}}}
to
{{{
LDFLAGS= -Wl,--no-undefined -shared -static-libgcc -lm -lpthread -lrt -L/usr/local/openmodelica/lib/omc -lSimulationRuntimeC
}}}"	defect	closed	blocker	1.9.4	FMI		fixed		
