Skip to content

Set up a full monolithic installer for MDIO#172

Merged
BrianMichell merged 1 commit into
feat/shared-lib-buildfrom
build_and_install
Jul 9, 2026
Merged

Set up a full monolithic installer for MDIO#172
BrianMichell merged 1 commit into
feat/shared-lib-buildfrom
build_and_install

Conversation

@BrianMichell

Copy link
Copy Markdown
Collaborator

Makes some fixes and sets up a full installer to replace the unofficial installer.

@BrianMichell BrianMichell merged commit 4728cc7 into feat/shared-lib-build Jul 9, 2026
10 checks passed
@BrianMichell BrianMichell deleted the build_and_install branch July 9, 2026 19:43
BrianMichell added a commit that referenced this pull request Jul 9, 2026
…170)

* Add opt-in monolithic shared library for ODR-safe plugin co-loading

MDIO is consumed header-only, so every translation unit that touches it
statically links its own copy of tensorstore and its vendored Abseil.
That is harmless for a single executable, but a process that dlopen()s
more than one such plugin ends up with several copies of Abseil's global
state and aborts at runtime with the infamous "ODR violation in Cord".

This adds an opt-in MDIO_BUILD_MONOLITHIC_SHARED (default OFF, so static
consumers are untouched) that emits one libmdio_monolith.so, exposed via
the mdio::monolith alias. Plugins link that single object instead of the
tensorstore::* static deps, so the dynamic linker maps tensorstore and
Abseil exactly once per process and the globals are singletons again.

Getting a self-contained shared object right took two non-obvious steps:

  - WHOLE_ARCHIVE on the tensorstore::* targets is a no-op because they
    are INTERFACE aggregators. A small recursive collector walks the link
    closure down to the concrete STATIC_LIBRARY targets (unwrapping the
    $<LINK_LIBRARY:WHOLE_ARCHIVE,...> genexes tensorstore uses for its
    alwayslink driver libs) and whole-archives those, so the explicit
    template instantiations (Spec / Zarr metadata JSON binders) and the
    driver self-registration objects are all force-included.

  - The interface deps are re-exposed to consumers as $<COMPILE_ONLY:...>
    usage requirements, propagating the transitive tensorstore/Abseil/
    nlohmann include dirs and defines without dragging the static archives
    back into the consumer (which would re-duplicate Abseil and defeat the
    whole exercise).

Co-authored-by: Cursor <cursoragent@cursor.com>

* Set up a full monolithic installer for MDIO (#172)

---------

Co-authored-by: Ben Lasscock <ben.lasscock@tgs.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Brian Michell <brianm314@comcast.net>
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