Skip to content

[FMIL] System expat, minizip, zlib, libz - #240

Merged
AnHeuermann merged 1 commit into
OpenModelica:masterfrom
AnHeuermann:system-expat
Sep 24, 2026
Merged

AnHeuermann merged 1 commit into
OpenModelica:masterfrom
AnHeuermann:system-expat

Conversation

@AnHeuermann

@AnHeuermann AnHeuermann commented Sep 23, 2026 •

Copy link
Copy Markdown
Member

Related Issues

Needed for OpenModelica/OpenModelica#16849.

FMIL is built with its bundled expat and minizip. Its FMILIB_SYSTEM_EXPAT, FMILIB_SYSTEM_MINIZIP and FMILIB_SYSTEM_ZLIB options already exist, but nothing turns them on.

Purpose

  • Use system versions of expat and minizip
  • Ensure FMIL doesn't silently build zlib

Approach

  • Added OM_USE_SYSTEM_EXPAT and OM_USE_SYSTEM_MINIZIP. Default to ON on Linux
  • Added interface library for zlib when system zlib is used.

@AnHeuermann AnHeuermann self-assigned this Sep 23, 2026
@AnHeuermann AnHeuermann changed the title System expat [FMIL] System expat, minizip, zlib Sep 23, 2026
@AnHeuermann AnHeuermann changed the title [FMIL] System expat, minizip, zlib [FMIL] System expat, minizip, zlib, libz Sep 23, 2026
The bundled expat, minizip and zlib are static libraries, so
libOpenModelicaCompiler.so, OMEdit, libSimulationRuntimeC.so and
libModelicaMatIO.so each carried a copy of them. Debian's lintian
reports that as embedded-library.

Adds OM_USE_SYSTEM_EXPAT and OM_USE_SYSTEM_MINIZIP. They default to ON
for native Linux builds and OFF elsewhere (Windows, macOS, cross
builds). OM_USE_SYSTEM_ZLIB now uses the same default and links the
shared libz instead of libz.a.

- expat: FMIL is built with FMILIB_SYSTEM_EXPAT, and fmilib links
  EXPAT::EXPAT, which omc::3rd::FMIL::expat aliases. The bundled Expat
  is neither built nor installed.
- minizip: FMIL is built with FMILIB_SYSTEM_MINIZIP, and fmilib links
  the system libminizip, which omc::3rd::FMIL::minizip aliases. When
  the option is OFF, the bundled minizip target exports its header
  directory so om_unzip.c can include <unzip.h>.
- zlib: the bundled zlib is still always built and installed. Generated
  simulation code links it as -lzlib (Library="zlib" annotations), and
  FMIL reuses its target instead of building a copy of its own. The
  system zlib gets its own target, omc_system_zlib, which
  omc::3rd::zlib aliases. find_package(ZLIB) is avoided because
  OMSimulator defines its own ZLIB::ZLIB.
- fmilib links omc::3rd::zlib only with the bundled minizip, the only
  part of libfmilib.a that calls zlib. A system libminizip.so brings in
  libz itself.

Bumps fmi-library to 83a7965 on om/3.0.4, which fixes the build against
minizip-ng's compat headers. They do not include zlib.h.

CI installs the system expat, minizip and zlib. A new AlmaLinux 10 job
builds against expat, minizip-ng-compat and zlib-ng-compat.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@AnHeuermann
AnHeuermann merged commit ded9a59 into OpenModelica:master Sep 24, 2026
7 checks passed
@AnHeuermann
AnHeuermann deleted the system-expat branch September 24, 2026 14:32
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.

1 participant