如何修复 Jmodelica 编译错误?
how can I fixed the Jmodelica compiling error?
我正在尝试使用 Jmodelica 编译 Modelica 模型(内置于 Dymola),但出现以下错误:
Compiler arguments:
Generating code...
====== Model compiled successfully =======
OU44_ZoneR2C2_funcs.o:OU44_ZoneR2C2_funcs.c:(.text+0x24): undefined reference to 'ModelicaStandardTables_CombiTable1D_minimumAbscissa'
OU44_ZoneR2C2_funcs.o:OU44_ZoneR2C2_funcs.c:(.text+0xbc): undefined reference to 'ModelicaStandardTables_CombiTable1D_maximumAbscissa'
OU44_ZoneR2C2_funcs.o:OU44_ZoneR2C2_funcs.c:(.text+0x1e7): undefined reference to 'ModelicaStandardTables_CombiTable1D_init2'
collect2.exe: error: ld returned 1 exit status
mingw32-make1: *** [fmume20_] Error 1
mingw32-make: *** [fmume20] Error 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\JModelica.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\taoy\AppData\Roaming\JModelica.org-2.14\install/ThirdParty/winpthreads/lib/winpthreads64" fmume20_
mingw32-make1: Entering directory
'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" sources/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" sources/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" sources/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" sources/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" sources/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" sources/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" sources/OU44_ZoneR2C2.c
mkdir binaries\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_init_independent.o OU44_ZoneR2C2_init_dependent.o 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/lib/RuntimeLibrary64" -lfmi2 -static-libstdc++ -static-libgcc -ljmi "-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_get_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: recipe for target 'fmume20_' failed
mingw32-make1: Leaving directory 'C:/Users/taoy/AppData/Local/Temp/1/jmc7241264750773945049out'
C:\Users\taoy\AppData\Roaming\JModelica.org-2.14\install\Makefiles\MakeFile:210: recipe for target 'fmume20' failed
Unknown program error, org.jmodelica.util.exceptions.CcodeCompilationException: Compilation of generated C code failed.
C file location: C:\Users\taoy\AppData\Local\Temp\jmc7241264750773945049out\sources\OU44_ZoneR2C2.c
说模型编译成功,但是之后出现错误。我查看了模型,如果我从 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 中),或者由于 JModelica 已停产,因此需要使用不同的 Modelica 工具。
我正在尝试使用 Jmodelica 编译 Modelica 模型(内置于 Dymola),但出现以下错误:
Compiler arguments: Generating code...
====== Model compiled successfully ======= OU44_ZoneR2C2_funcs.o:OU44_ZoneR2C2_funcs.c:(.text+0x24): undefined reference to 'ModelicaStandardTables_CombiTable1D_minimumAbscissa'
OU44_ZoneR2C2_funcs.o:OU44_ZoneR2C2_funcs.c:(.text+0xbc): undefined reference to 'ModelicaStandardTables_CombiTable1D_maximumAbscissa' OU44_ZoneR2C2_funcs.o:OU44_ZoneR2C2_funcs.c:(.text+0x1e7): undefined reference to 'ModelicaStandardTables_CombiTable1D_init2'
collect2.exe: error: ld returned 1 exit status
mingw32-make1: *** [fmume20_] Error 1
mingw32-make: *** [fmume20] Error 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\JModelica.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\taoy\AppData\Roaming\JModelica.org-2.14\install/ThirdParty/winpthreads/lib/winpthreads64" fmume20_
mingw32-make1: Entering directory
'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" sources/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" sources/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" sources/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" sources/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" sources/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" sources/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" sources/OU44_ZoneR2C2.c
mkdir binaries\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_init_independent.o OU44_ZoneR2C2_init_dependent.o 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/lib/RuntimeLibrary64" -lfmi2 -static-libstdc++ -static-libgcc -ljmi "-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_get_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: recipe for target 'fmume20_' failed mingw32-make1: Leaving directory 'C:/Users/taoy/AppData/Local/Temp/1/jmc7241264750773945049out' C:\Users\taoy\AppData\Roaming\JModelica.org-2.14\install\Makefiles\MakeFile:210: recipe for target 'fmume20' failed
Unknown program error, org.jmodelica.util.exceptions.CcodeCompilationException: Compilation of generated C code failed.
C file location: C:\Users\taoy\AppData\Local\Temp\jmc7241264750773945049out\sources\OU44_ZoneR2C2.c
说模型编译成功,但是之后出现错误。我查看了模型,如果我从 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 中),或者由于 JModelica 已停产,因此需要使用不同的 Modelica 工具。