如何修复 Jmodelica 编译错误?

问题描述

我正在尝试使用 Jmodelica 编译 Modelica 模型(在 Dymola 中构建),但出现以下错误

编译器参数: 正在生成代码...
====== 模型编译成功 ======== OU44_ZoneR2C2_funcs.o:OU44_ZoneR2C2_funcs.c:(.text+0x24):对'ModelicaStandardTables_CombiTable1D_minimumAbscissa'的未定义引用
OU44_ZoneR2C2_funcs.o:OU44_ZoneR2C2_funcs.c:(.text+0xbc):对'ModelicaStandardTables_CombiTable1D_maximumAbscissa'的未定义引用 OU44_ZoneR2C2_funcs.o:OU44_ZoneR2C2_funcs.c:(.text+0x1e7):对'ModelicaStandardTables_CombiTable1D_init2'的未定义引用
collect2.exe:错误:ld 返回 1 个退出状态
mingw32-make1: *** [fmume20_] 错误 1
mingw32-make: *** [fmume20] 错误 2
"C:/Users/taoy/AppData/Roaming/JModelica.org-2.14/MinGW/bin/mingw32-make" -f "C:\Users\taoy\AppData\Roaming\JModelica.org-2.14\install\Makefiles\ MakeFile" "PLATFORM_FLAG=-m64" "RUNTIMELIBRARY_LIB_DIR=C:\Users\taoy\AppData\Roaming\JModelica.org-2.14\install/lib/RuntimeLibrary64" "MINPACK_LIB_DIR=C:\Users\taoy\AppData\Roaming\ org-2.14\install/ThirdParty/Minpack/lib64" "SUNDIALS_LIB_DIR=C:\Users\taoy\AppData\Roaming\JModelica.org-2.14\install\ThirdParty\Sundials/lib64" "WINPTHREADS_LIB_DIR=C:\Users AppData\Roaming\JModelica.org-2.14\install/ThirdParty/winpthreads/lib/winpthreads64" fmume20_
mingw32-make1:进入目录
'C:/Users/taoy/AppData/Local/Temp/1/jmc7241264750773945049out' "gcc" -m64 -std=c89 -pedantic -msse2 -mfpmath=sse -O1 "-IC:\Users\taoy\AppData\Roaming\JModelica.org-2.14\install/include/RuntimeLibrary" "-IC:\Users \taoy\AppData\Roaming\JModelica.org-2.14\install/ThirdParty/FMI/2.0" "-IC:\Users\taoy\AppData\Roaming\JModelica.org-2.14\install\ThirdParty\Sundials/include" -c -o "OU44_ZoneR2C2_funcs.o" 来源/OU44_ZoneR2C2_funcs.c "gcc" -m64 -std=c89 -pedantic -msse2 -mfpmath=sse "-IC:\Users\taoy\AppData\Roaming\JModelica.org-2.14\install/include/RuntimeLibrary" "-IC:\Users\taoy \AppData\Roaming\JModelica.org-2.14\install/ThirdParty/FMI/2.0" "-IC:\Users\taoy\AppData\Roaming\JModelica.org-2.14\install\ThirdParty\Sundials/include" -c -o “OU44_ZoneR2C2_init_independent.o”来源/OU44_ZoneR2C2_init_independent.c "gcc" -m64 -std=c89 -pedantic -msse2 -mfpmath=sse "-IC:\Users\taoy\AppData\Roaming\JModelica.org-2.14\install/include/RuntimeLibrary" "-IC:\Users\taoy \AppData\Roaming\JModelica.org-2.14\install/ThirdParty/FMI/2.0" "-IC:\Users\taoy\AppData\Roaming\JModelica.org-2.14\install\ThirdParty\Sundials/include" -c -o “OU44_ZoneR2C2_init_dependent.o”来源/OU44_ZoneR2C2_init_dependent.c "gcc" -m64 -std=c89 -pedantic -msse2 -mfpmath=sse "-IC:\Users\taoy\AppData\Roaming\JModelica.org-2.14\install/include/RuntimeLibrary" "-IC:\Users\taoy \AppData\Roaming\JModelica.org-2.14\install/ThirdParty/FMI/2.0" "-IC:\Users\taoy\AppData\Roaming\JModelica.org-2.14\install\ThirdParty\Sundials/include" -c -o “OU44_ZoneR2C2_base.o”来源/OU44_ZoneR2C2_base.c "gcc" -m64 -std=c89 -pedantic -msse2 -mfpmath=sse "-IC:\Users\taoy\AppData\Roaming\JModelica.org-2.14\install/include/RuntimeLibrary" "-IC:\Users\taoy \AppData\Roaming\JModelica.org-2.14\install/ThirdParty/FMI/2.0" "-IC:\Users\taoy\AppData\Roaming\JModelica.org-2.14\install\ThirdParty\Sundials/include" -c -o “OU44_ZoneR2C2_equ.o”来源/OU44_ZoneR2C2_equ.c "gcc" -m64 -std=c89 -pedantic -msse2 -mfpmath=sse "-IC:\Users\taoy\AppData\Roaming\JModelica.org-2.14\install/include/RuntimeLibrary" "-IC:\Users\taoy \AppData\Roaming\JModelica.org-2.14\install/ThirdParty/FMI/2.0" "-IC:\Users\taoy\AppData\Roaming\JModelica.org-2.14\install\ThirdParty\Sundials/include" -c -o “OU44_ZoneR2C2_equ_init.o”来源/OU44_ZoneR2C2_equ_init.c "gcc" -m64 -std=c89 -pedantic -msse2 -mfpmath=sse "-IC:\Users\taoy\AppData\Roaming\JModelica.org-2.14\install/include/RuntimeLibrary" "-IC:\Users\taoy \AppData\Roaming\JModelica.org-2.14\install/ThirdParty/FMI/2.0" "-IC:\Users\taoy\AppData\Roaming\JModelica.org-2.14\install\ThirdParty\Sundials/include" -c -o “OU44_ZoneR2C2.o”来源/OU44_ZoneR2C2.c
mkdir 二进制文件\win64 "C:\Users\taoy\AppData\Roaming\JModelica.org-2.14\MinGW\bin\g++" -m64 -shared -m64 -o "binaries/win64/OU44_ZoneR2C2.dll" OU44_ZoneR2C2_funcs.o OU44_ZoneR2C2_funcs.o OU44_initou4dependent.o OU44_initouR2dependent_ZoneR2D OU44_ZoneR2C2_base.o OU44_ZoneR2C2_equ.o OU44_ZoneR2C2_equ_init.o OU44_ZoneR2C2.o "-LC:\Users\taoy\AppData\Roaming\JModelica.org-2.14\install/lib2++4Runstatic"-jlflib24Runstatic -LC:\Users\taoy\AppData\Roaming\JModelica.org-2.14\install/lib" -L"C:\Users\taoy\Documents\Modelica Standard Library 3.2.3\Modelica 3.2.3\Resources\Library/ win64/gcctdm510" -L"C:\Users\taoy\Documents\Modelica Standard Library 3.2.3\Modelica 3.2.3\Resources\Library/win64" -L"C:\Users\taoy\Documents\Modelica Standard Library 3.2 .3\Modelica 3.2.3\Resources\Library" -lModelicaStandardTables -lModelicaIO -lModelicaMatIO -lzlib -lModelicaExternalC -ljmi_get_set_default -lModelicaStandardTables -lModelicaIO -lModelicaMatIO -lzlib -lModelicaExternalC_ljmi set_default -llapack -lblas -l:libgfortran.a -l:libquadmath.a -lModelicaExternalC -lzlib -ljmi "-LC:\Users\taoy\AppData\Roaming\JModelica.org-2.14\install\ThirdParty\Sundials/lib64" -l:libsundials_kinsol.a -l:libsundials_nvecserial.a -l:libsundials_cvode.a "-LC:\Users\taoy\AppData\Roaming\JModelica.org-2.14\install/ThirdParty/Minpack/lib64" -l:libcminpack. a "-LC:\Users\taoy\AppData\Roaming\JModelica.org-2.14\install/ThirdParty/winpthreads/lib/winpthreads64" -l:libwinpthread.a C:\Users\taoy\AppData\Roaming\JModelica.org-2.14\install\Makefiles\MakeFile:214: 目标“fmume20_”的配方失败 mingw32-make1:离开目录“C:/Users/taoy/AppData/Local/Temp/1/jmc7241264750773945049out” C:\Users\taoy\AppData\Roaming\JModelica.org-2.14\install\Makefiles\MakeFile:210:目标'fmume20'的配方失败
未知程序错误,org.jmodelica.util.exceptions.CcodeCompilationException:编译生成的 C 代码失败。
C文件位置:C:\Users\taoy\AppData\Local\Temp\1\jmc7241264750773945049out\sources\OU44_ZoneR2C2.c

enter image description here

它说模型编译成功,但之后出现错误。我查看了模型,如果我从 Modelica 标准库中删除模型组件“CombiTable1D”,那么错误就修复了。似乎这个组件有问题。但是,这个组件在我的模型中是必需的。

如何解决这个问题?

解决方法

ModelicaStandardTables_CombiTable1D_minimumAbscissa 是在 2017 年添加的,但 JModelica 使用的是 2016 年版本的 MSL C 源代码: https://github.com/JModelica/JModelica/blob/8982e1f4e7ca33b01b398f389b73d2398761ee9c/ThirdParty/MSL/Modelica/Resources/C-Sources/ModelicaStandardTables.c

您可能需要使用较早版本的 Modelica 标准库(3.2.2 包含在 JModelica 中)或其他 Modelica 工具,因为 JModelica 已停产。