Skip to content

Update sundials 5.4.0 --> 7.8.0 - #16158

Draft
AnHeuermann wants to merge 9 commits into
OpenModelica:masterfrom
AnHeuermann:update-sundials
Draft

Update sundials 5.4.0 --> 7.8.0#16158
AnHeuermann wants to merge 9 commits into
OpenModelica:masterfrom
AnHeuermann:update-sundials

Conversation

@AnHeuermann

@AnHeuermann AnHeuermann commented Jul 31, 2026

Copy link
Copy Markdown
Member

Related Issues

Fixes #16127.

Purpose

  • Update Sundials to latest stable release and get all the nice updates

Approach

  • TODO....

Testing

  • Linux: C runtime (Jenkins CI)
  • Linux: C++ runtime (Jenkins CI)
  • Linux: OMSICpp runtime (Jenkins CI)
  • Linux: C FMUs (Jenkins CI)
  • Linux: C++ FMUs (Jenkins CI)
  • Win UCRT: C runtime (Jenkins CI)
  • Win UCRT: C++ runtime (Jenkins CI)
  • Win UCRT: OMSICpp runtime (Jenkins CI)
  • Win UCRT: C FMUs (Jenkins CI)
  • Win UCRT: C++ FMUs (Jenkins CI)
  • Win MSVC: C runtime (Jenkins CI)
  • Win MSVC: C++ runtime (Jenkins CI)
  • Win MSVC: OMSICpp runtime (Jenkins CI)
  • Win MSVC: C FMUs (Jenkins CI)
  • Win MSVC: C++ FMUs (Jenkins CI)

@AnHeuermann AnHeuermann self-assigned this Jul 31, 2026
@AnHeuermann

Copy link
Copy Markdown
Member Author

Blocked by #15879.

AnHeuermann and others added 6 commits August 10, 2026 10:33
- Rename the CMake options SUNDIALS 6/7 dropped (SUNDIALS_KLU_ENABLE,
  SUNDIALS_LAPACK_ENABLE, SUNDIALS_BUILD_*_LIBS, SUNDIALS_EXAMPLES_*),
  which were silently ignored, leaving KLU and LAPACK off
- Install the headers under $(builddir_inc)/sundials again, where
  -I$(builddir_inc)/sundials/ and the cpp runtimes expect them
- Link sundials_core, split out in SUNDIALS 7
- Derive the macOS install names from the installed libraries instead of
  hardcoding versions that now differ per package
- Pre-set SUNDIALS_POSIX_TIMERS for the wasm cross-build; the probe
  builds a sub-project without the toolchain file and always fails

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
- Unify cvodeErrorHandlerFunction and idaErrorHandlerFunction into
  sundialsErrorHandlerFunction; they only differed in the banner, and
  func/file already name the module
- checkReturnFlag_CV and _KIN named their flags with the linear solver
  tables, which give the same integers different names (CV_TOO_MUCH_WORK
  printed as CVLS_MEM_NULL); use CVodeGetReturnFlagName / KINGetReturnFlagName
- Add the missing break in checkReturnFlag_SUNDIALS' UNKNOWN_FLAG case,
  which fell through into checkReturnFlag_CV
- Type the SUNErrCode-carrying parameters, returns and locals as SUNErrCode
  instead of int; nlsKinsolErrorHandler gets its own variable for it, since
  its flag also carries KIN_* and KINLS_* macros
- Record in _omc_SUNMatScaleIAdd_Sparse why SUNDIALS still cannot replace it

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
- The libraries are copied out of 3rdParty/sundials/build/lib with their
  RPATH still pointing there, so libsundials_*.so only find
  libsundials_core.so.7 while that build tree exists
- Only broke with SUNDIALS 7: before the core split no SUNDIALS library
  depended on another, and a consumer's DT_RUNPATH does not apply to a
  transitive lookup
- Pass the rpath via CMAKE_SHARED_LINKER_FLAGS; SUNDIALS overwrites
  CMAKE_INSTALL_RPATH itself in cmake/SundialsSetupCompilers.cmake
- Drop -DLDFLAGS, which SUNDIALS never reads

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@AnHeuermann

Copy link
Copy Markdown
Member Author

Most C/C++ tests should be fixed, but the OMSimulator test testsuite/omsimulator/testSynchronousFMU_02.mos is still failing:

error:   [doStepCVODE] CVode failed with flag = -27
warning: Bad return code at time 0.080000

I got a similar error while working on OpenModelica/OMSimulator#1600 (see OpenModelica/OMSimulator#1600 (comment)). In the end I removed the fix for it because tests were passing without it anyway. Building the FMU with the master version of omc results in the same error, so we should add this clocked example FMU to OMSimulator testsuite and fix it there.

@AnHeuermann

Copy link
Copy Markdown
Member Author

Blocked by OpenModelica/OMSimulator#1621.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Update Sundials

1 participant