Skip to content

Future: single shared Botan build per cargo graph (mixed rnp[vendored] + botan[vendored]) #76

Description

@ronaldtse

Summary

Future enhancement — not blocking users today. When a build graph contains both rnp[vendored] and botan[vendored] (e.g. a tool needing OpenPGP plus raw Botan primitives), Botan is compiled twice and the final link binds whichever libbotan-3 archive comes first in search-path order.

What happens today

  • botan-sys (via botan[vendored]) compiles Botan in its OUT_DIR; rnp-src compiles its own in another. botan_src::build() lands the build in whichever crate's OUT_DIR calls it — there is no shared cache.
  • Cargo cannot unify 0.x minor versions, so with version skew the graph carries two different Botan versions. Both emit -lbotan-3 with different search paths; one archive silently wins.
  • The loser's consumer breaks: either missing-symbol link errors, or — worse — a silent C++ ABI/layout mismatch (Botan's C++ ABI is unstable across minors, per its sonames). Nothing warns.

Mitigations already shipped

The actual goal

Exactly one Botan compilation per cargo build graph, shared by every consumer. Real fixes live upstream in botan-rs:

  1. A shared build cache inside botan-src, keyed by version/target/configuration — universal, but pushes cache-key correctness, locking, and staleness onto upstream.
  2. Links metadata (lib_dir/include_dir) from botan-sys's vendored path — small, but insufficient in general: build scripts cannot retroactively configure a dependency's already-finished build (e.g. our BOTAN_CONFIGURE_ENABLE_MODULES for PQC runs before our own Botan build, which ordering can't work when botan-sys's build already ran), and it would expose botan-sys's build-tree layout as a quasi-API.

A meek, constraint-framed issue draft for botan-rs exists and will be filed when we prioritize this. Until then, the mitigations above keep mixed graphs correct-if-wasteful.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions