ThummeTo/FMIExport.jl

FMI Exports Fails on Compilation - Windows g++

Closed this issue · 8 comments

Compilation of Bouncing Ball Demo fails on windows with g++

ME/header/FMU2_init.o:FMU2_init.c:(.text+0x214): undefined reference to init_FMU

Missing a library reference?

Can you please provide some more information like the used libraries/versions?
Which script is executed?

Just trying to compile the Bouncing Ball example. Turns out my initial problem was the TMP directory and McAfee deleting the .dll. Now not compiling with error at "type FMU2 has no field instanceName"

I see, patch is coming #15

Should be resolved in v0.1.8, please reopen if not.
Best regards!

Compiles but FMU is not compliant and crashes:

fatal: error thrown and no exception handler available.
MethodError(f=FMICore.fmi2ScalarVariable, args=("ball.s", 0x00000001), world=0x0000000000007b09)
jl_method_error_bare at /cygdrive/c/buildbot/worker/package_win64/build/src\gf.c:1821
jl_method_error at /cygdrive/c/buildbot/worker/package_win64/build/src\gf.c:1839
jl_lookup_generic_ at /cygdrive/c/buildbot/worker/package_win64/build/src\gf.c:2410
jl_apply_generic at /cygdrive/c/buildbot/worker/package_win64/build/src\gf.c:2425
#fmi2ModelDescriptionAddModelVariable#7 at %PATH_OBFUSCATE%\FMI2_md.jl:161
fmi2ModelDescriptionAddModelVariable##kw at %PATH_OBFUSCATE%\FMI2_md.jl:157
#fmi2ModelDescriptionAddRealState#1 at %PATH_OBFUSCATE%\FMI2_md.jl:47
fmi2ModelDescriptionAddRealState##kw at %PATH_OBFUSCATE%\FMI2_md.jl:45
#fmi2ModelDescriptionAddRealStateAndDerivative#3 at %PATH_OBFUSCATE%\FMI2_md.jl:80
fmi2ModelDescriptionAddRealStateAndDerivative##kw at %PATH_OBFUSCATE%\FMI2_md.jl:80
fmi2ModelDescriptionAddRealStateAndDerivative##kw at %PATH_OBFUSCATE%\FMI2_md.jl:80
#fmi2AddRealStateAndDerivative#30 at %PATH_OBFUSCATE%\FMIExport.jl:206
fmi2AddRealStateAndDerivative##kw at .%PATH_OBFUSCATE%\FMIExport.jl:206
unknown function (ip: 000001cd613929a4)
#9 at .%PATH_OBFUSCATE%\FMI_Testing.jl:247
init_FMU at .%PATH_OBFUSCATE%\FMI_Testing.jl:33
unknown function (ip: 000001cd61382d79)
init_FMU at .%PATH_OBFUSCATE%\FMI_Testing.dll (unknown line)
DllMain at .%PATH_OBFUSCATE%\FMI_Testing.dll (unknown line)
__DllMainCRTStartup at .%PATH_OBFUSCATE%\FMI_Testing.dll (unknown line)
RtlActivateActivationContextUnsafeFast at C:\WINDOWS\SYSTEM32\ntdll.dll (unknown line)
LdrGetProcedureAddressEx at C:\WINDOWS\SYSTEM32\ntdll.dll (unknown line)
LdrGetProcedureAddressEx at C:\WINDOWS\SYSTEM32\ntdll.dll (unknown line)
RtlSwitchedVVI at C:\WINDOWS\SYSTEM32\ntdll.dll (unknown line)
RtlGetFullPathName_UstrEx at C:\WINDOWS\SYSTEM32\ntdll.dll (unknown line)
RtlDosPathNameToNtPathName_U at C:\WINDOWS\SYSTEM32\ntdll.dll (unknown line)
LdrLoadDll at C:\WINDOWS\SYSTEM32\ntdll.dll (unknown line)
unknown function (ip: 00007ffa919f048e)

Crash occurs with both Julia - fmiLoad() and Python - FMpy

Are you sure you are using all libraries at the current state? Especially the line FMICore.fmi2ScalarVariable, args=("ball.s", 0x00000001) was changed from 2 to 5 arguments in the update v0.1.8 ...

BTW: FMUs exported with FMI.jl can't be imported by FMI.jl (because of a current restriction of the Julia sysimg architecture). But on the other hand you can use a FMU created via fmiCreate just like a loaded FMU via fmiLoad - it just behaves like a regular imported FMU.

Updated all packages. Turned out I was using a local dev package to try and diagnose the issue. Now the issue is:
MethodError(f=FMICore.FMU2Component{F} where F, args=(), world=0x0000000000007a7c) jl_method_error_bare at /cygdrive/c/buildbot/worker/package_win64/build/src\gf.c:1821 jl_method_error at /cygdrive/c/buildbot/worker/package_win64/build/src\gf.c:1839 jl_lookup_generic_ at /cygdrive/c/buildbot/worker/package_win64/build/src\gf.c:2410 jl_apply_generic at /cygdrive/c/buildbot/worker/package_win64/build/src\gf.c:2425 simple_fmi2Instantiate at D:\Julia\Packages\packages\FMIExport\1ciLm\src\FMI2_simple.jl:156 unknown function (ip: 0000023b28c7c618) ...

because this is another issue I opened #16