fix(docker): add libolm-dev so matrix lazy-install can build python-olm - #27795
fix(docker): add libolm-dev so matrix lazy-install can build python-olm#27795konsisumer wants to merge 1 commit into
Conversation
The matrix extra (mautrix[encryption]) was removed from the [all] Docker build extra in NousResearch#24515 and is instead lazy-installed on first gateway boot. python-olm, a transitive dependency, must be compiled from source because no pre-built wheel exists for linux/amd64; this compilation requires the libolm C library headers. Without libolm-dev in the image the lazy-install silently fails and the Matrix adapter never connects. Add libolm-dev to the apt-get install layer so that the lazy-install of mautrix[encryption] can succeed inside the container. Fixes NousResearch#25495
|
CI triage: the only failing check is I reproduced this locally on the PR head and after merging current This PR only edits a Dockerfile package and a pyproject comment, so the narrow fix is just to run |
There was a problem hiding this comment.
Pull request overview
This PR fixes Matrix lazy-install failures in the official Docker image by ensuring the container has the system headers needed to compile python-olm (pulled in by mautrix[encryption]) when tools/lazy_deps.py runs after dropping root privileges.
Changes:
- Add
libolm-devto the Docker image’sapt-get installlayer sopython-olmcan build from source during lazy-install. - Document in
pyproject.tomlthat the Docker image shipslibolm-devspecifically for the Matrix lazy-install path.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
Dockerfile |
Installs libolm-dev in the base image to support compiling python-olm during non-root lazy installs. |
pyproject.toml |
Updates the [all] policy comment to note the Docker image includes libolm-dev for Matrix lazy-install builds. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
austinpickett
left a comment
There was a problem hiding this comment.
LGTM, just use PULL_REQUEST_TEMPLATE.md please.
|
Thanks for the review. Addressed in this update:
|
|
@austinpickett friendly nudge — the template feedback is addressed: the PR description now follows The only red check is Happy to make any further changes if needed. |
On macOS, `mautrix[encryption]` pulls in python-olm 3.2.16, which
bundles libolm source containing a C++ const-pointer bug in
`libolm/include/olm/list.hh`:
T * const other_pos = other._data;
// ...
++other_pos; // error: cannot assign to const-qualified variable
Apple clang (Xcode 15+) rejects this as a hard compile error even
without -Werror, so `platform.matrix` lazy-install always fails on
macOS with:
error: subprocess-exited-with-error
× Getting requirements to build wheel did not run successfully.
Fix: when `ensure("platform.matrix")` runs on darwin, pre-install
python-olm from a patched copy of the sdist (one-line removal of the
spurious `const` qualifier) before the main pip install runs.
mautrix[encryption] then finds python-olm already satisfied and skips
the broken bundled-source build.
The patch is idempotent — if the target line is absent (upstream fixed
it), we log a warning and proceed without patching.
Relates to: NousResearch#27795 (adds libolm-dev for Docker, same root cause)
Relates to: NousResearch#14139 (replaces python-olm with fresholm long-term)
|
Thanks for catching this @konsisumer — I've reconstructed this fix against current You're attributed as Co-author on the salvage commit and credited in the PR body. Closing this one in favor of #33685 — apologies it sat unrebased for so long; #25495 is still real and you spotted the right fix. |
Closes #25495 (matrix/synapse broken in the official docker image). `tools/lazy_deps.py` routes `platform.matrix` to `mautrix[encryption]==0.21.0`, which transitively depends on `python-olm`. `python-olm` is a Cython extension that links against `libolm`; without `libolm-dev` in the image's apt set the lazy-install build fails. Add `libolm-dev` to the runtime apt install line so the in-container source build succeeds on first matrix use. Salvages #27795 by @konsisumer. Their PR targeted a pre-rework Dockerfile (still had `build-essential nodejs npm` in the apt list, no `ca-certificates`); cherry-pick conflicts on incidental apt-list churn, so this re-applies the same one-word insert against the current apt line plus the matching pyproject.toml comment update. Co-authored-by: konsisumer <11262660+konsisumer@users.noreply.github.com>
…lm (#33685) Closes #25495 (matrix/synapse broken in the official docker image). `tools/lazy_deps.py` routes `platform.matrix` to `mautrix[encryption]==0.21.0`, which transitively depends on `python-olm`. `python-olm` is a Cython extension that links against `libolm`; without `libolm-dev` in the image's apt set the lazy-install build fails. Add `libolm-dev` to the runtime apt install line so the in-container source build succeeds on first matrix use. Salvages #27795 by @konsisumer. Their PR targeted a pre-rework Dockerfile (still had `build-essential nodejs npm` in the apt list, no `ca-certificates`); cherry-pick conflicts on incidental apt-list churn, so this re-applies the same one-word insert against the current apt line plus the matching pyproject.toml comment update. Co-authored-by: konsisumer <11262660+konsisumer@users.noreply.github.com>
…lm (NousResearch#33685) Closes NousResearch#25495 (matrix/synapse broken in the official docker image). `tools/lazy_deps.py` routes `platform.matrix` to `mautrix[encryption]==0.21.0`, which transitively depends on `python-olm`. `python-olm` is a Cython extension that links against `libolm`; without `libolm-dev` in the image's apt set the lazy-install build fails. Add `libolm-dev` to the runtime apt install line so the in-container source build succeeds on first matrix use. Salvages NousResearch#27795 by @konsisumer. Their PR targeted a pre-rework Dockerfile (still had `build-essential nodejs npm` in the apt list, no `ca-certificates`); cherry-pick conflicts on incidental apt-list churn, so this re-applies the same one-word insert against the current apt line plus the matching pyproject.toml comment update. Co-authored-by: konsisumer <11262660+konsisumer@users.noreply.github.com>
…lm (NousResearch#33685) Closes NousResearch#25495 (matrix/synapse broken in the official docker image). `tools/lazy_deps.py` routes `platform.matrix` to `mautrix[encryption]==0.21.0`, which transitively depends on `python-olm`. `python-olm` is a Cython extension that links against `libolm`; without `libolm-dev` in the image's apt set the lazy-install build fails. Add `libolm-dev` to the runtime apt install line so the in-container source build succeeds on first matrix use. Salvages NousResearch#27795 by @konsisumer. Their PR targeted a pre-rework Dockerfile (still had `build-essential nodejs npm` in the apt list, no `ca-certificates`); cherry-pick conflicts on incidental apt-list churn, so this re-applies the same one-word insert against the current apt line plus the matching pyproject.toml comment update. Co-authored-by: konsisumer <11262660+konsisumer@users.noreply.github.com>
…lm (NousResearch#33685) Closes NousResearch#25495 (matrix/synapse broken in the official docker image). `tools/lazy_deps.py` routes `platform.matrix` to `mautrix[encryption]==0.21.0`, which transitively depends on `python-olm`. `python-olm` is a Cython extension that links against `libolm`; without `libolm-dev` in the image's apt set the lazy-install build fails. Add `libolm-dev` to the runtime apt install line so the in-container source build succeeds on first matrix use. Salvages NousResearch#27795 by @konsisumer. Their PR targeted a pre-rework Dockerfile (still had `build-essential nodejs npm` in the apt list, no `ca-certificates`); cherry-pick conflicts on incidental apt-list churn, so this re-applies the same one-word insert against the current apt line plus the matching pyproject.toml comment update. Co-authored-by: konsisumer <11262660+konsisumer@users.noreply.github.com>
…lm (#33685) Closes #25495 (matrix/synapse broken in the official docker image). `tools/lazy_deps.py` routes `platform.matrix` to `mautrix[encryption]==0.21.0`, which transitively depends on `python-olm`. `python-olm` is a Cython extension that links against `libolm`; without `libolm-dev` in the image's apt set the lazy-install build fails. Add `libolm-dev` to the runtime apt install line so the in-container source build succeeds on first matrix use. Salvages #27795 by @konsisumer. Their PR targeted a pre-rework Dockerfile (still had `build-essential nodejs npm` in the apt list, no `ca-certificates`); cherry-pick conflicts on incidental apt-list churn, so this re-applies the same one-word insert against the current apt line plus the matching pyproject.toml comment update. Co-authored-by: konsisumer <11262660+konsisumer@users.noreply.github.com>
…lm (NousResearch#33685) Closes NousResearch#25495 (matrix/synapse broken in the official docker image). `tools/lazy_deps.py` routes `platform.matrix` to `mautrix[encryption]==0.21.0`, which transitively depends on `python-olm`. `python-olm` is a Cython extension that links against `libolm`; without `libolm-dev` in the image's apt set the lazy-install build fails. Add `libolm-dev` to the runtime apt install line so the in-container source build succeeds on first matrix use. Salvages NousResearch#27795 by @konsisumer. Their PR targeted a pre-rework Dockerfile (still had `build-essential nodejs npm` in the apt list, no `ca-certificates`); cherry-pick conflicts on incidental apt-list churn, so this re-applies the same one-word insert against the current apt line plus the matching pyproject.toml comment update. Co-authored-by: konsisumer <11262660+konsisumer@users.noreply.github.com>
…lm (NousResearch#33685) Closes NousResearch#25495 (matrix/synapse broken in the official docker image). `tools/lazy_deps.py` routes `platform.matrix` to `mautrix[encryption]==0.21.0`, which transitively depends on `python-olm`. `python-olm` is a Cython extension that links against `libolm`; without `libolm-dev` in the image's apt set the lazy-install build fails. Add `libolm-dev` to the runtime apt install line so the in-container source build succeeds on first matrix use. Salvages NousResearch#27795 by @konsisumer. Their PR targeted a pre-rework Dockerfile (still had `build-essential nodejs npm` in the apt list, no `ca-certificates`); cherry-pick conflicts on incidental apt-list churn, so this re-applies the same one-word insert against the current apt line plus the matching pyproject.toml comment update. Co-authored-by: konsisumer <11262660+konsisumer@users.noreply.github.com>
…lm (NousResearch#33685) Closes NousResearch#25495 (matrix/synapse broken in the official docker image). `tools/lazy_deps.py` routes `platform.matrix` to `mautrix[encryption]==0.21.0`, which transitively depends on `python-olm`. `python-olm` is a Cython extension that links against `libolm`; without `libolm-dev` in the image's apt set the lazy-install build fails. Add `libolm-dev` to the runtime apt install line so the in-container source build succeeds on first matrix use. Salvages NousResearch#27795 by @konsisumer. Their PR targeted a pre-rework Dockerfile (still had `build-essential nodejs npm` in the apt list, no `ca-certificates`); cherry-pick conflicts on incidental apt-list churn, so this re-applies the same one-word insert against the current apt line plus the matching pyproject.toml comment update. Co-authored-by: konsisumer <11262660+konsisumer@users.noreply.github.com>
…lm (NousResearch#33685) Closes NousResearch#25495 (matrix/synapse broken in the official docker image). `tools/lazy_deps.py` routes `platform.matrix` to `mautrix[encryption]==0.21.0`, which transitively depends on `python-olm`. `python-olm` is a Cython extension that links against `libolm`; without `libolm-dev` in the image's apt set the lazy-install build fails. Add `libolm-dev` to the runtime apt install line so the in-container source build succeeds on first matrix use. Salvages NousResearch#27795 by @konsisumer. Their PR targeted a pre-rework Dockerfile (still had `build-essential nodejs npm` in the apt list, no `ca-certificates`); cherry-pick conflicts on incidental apt-list churn, so this re-applies the same one-word insert against the current apt line plus the matching pyproject.toml comment update. Co-authored-by: konsisumer <11262660+konsisumer@users.noreply.github.com>
…lm (NousResearch#33685) Closes NousResearch#25495 (matrix/synapse broken in the official docker image). `tools/lazy_deps.py` routes `platform.matrix` to `mautrix[encryption]==0.21.0`, which transitively depends on `python-olm`. `python-olm` is a Cython extension that links against `libolm`; without `libolm-dev` in the image's apt set the lazy-install build fails. Add `libolm-dev` to the runtime apt install line so the in-container source build succeeds on first matrix use. Salvages NousResearch#27795 by @konsisumer. Their PR targeted a pre-rework Dockerfile (still had `build-essential nodejs npm` in the apt list, no `ca-certificates`); cherry-pick conflicts on incidental apt-list churn, so this re-applies the same one-word insert against the current apt line plus the matching pyproject.toml comment update. Co-authored-by: konsisumer <11262660+konsisumer@users.noreply.github.com>
…lm (NousResearch#33685) Closes NousResearch#25495 (matrix/synapse broken in the official docker image). `tools/lazy_deps.py` routes `platform.matrix` to `mautrix[encryption]==0.21.0`, which transitively depends on `python-olm`. `python-olm` is a Cython extension that links against `libolm`; without `libolm-dev` in the image's apt set the lazy-install build fails. Add `libolm-dev` to the runtime apt install line so the in-container source build succeeds on first matrix use. Salvages NousResearch#27795 by @konsisumer. Their PR targeted a pre-rework Dockerfile (still had `build-essential nodejs npm` in the apt list, no `ca-certificates`); cherry-pick conflicts on incidental apt-list churn, so this re-applies the same one-word insert against the current apt line plus the matching pyproject.toml comment update. Co-authored-by: konsisumer <11262660+konsisumer@users.noreply.github.com>
…lm (NousResearch#33685) Closes NousResearch#25495 (matrix/synapse broken in the official docker image). `tools/lazy_deps.py` routes `platform.matrix` to `mautrix[encryption]==0.21.0`, which transitively depends on `python-olm`. `python-olm` is a Cython extension that links against `libolm`; without `libolm-dev` in the image's apt set the lazy-install build fails. Add `libolm-dev` to the runtime apt install line so the in-container source build succeeds on first matrix use. Salvages NousResearch#27795 by @konsisumer. Their PR targeted a pre-rework Dockerfile (still had `build-essential nodejs npm` in the apt list, no `ca-certificates`); cherry-pick conflicts on incidental apt-list churn, so this re-applies the same one-word insert against the current apt line plus the matching pyproject.toml comment update. Co-authored-by: konsisumer <11262660+konsisumer@users.noreply.github.com>
…lm (NousResearch#33685) Closes NousResearch#25495 (matrix/synapse broken in the official docker image). `tools/lazy_deps.py` routes `platform.matrix` to `mautrix[encryption]==0.21.0`, which transitively depends on `python-olm`. `python-olm` is a Cython extension that links against `libolm`; without `libolm-dev` in the image's apt set the lazy-install build fails. Add `libolm-dev` to the runtime apt install line so the in-container source build succeeds on first matrix use. Salvages NousResearch#27795 by @konsisumer. Their PR targeted a pre-rework Dockerfile (still had `build-essential nodejs npm` in the apt list, no `ca-certificates`); cherry-pick conflicts on incidental apt-list churn, so this re-applies the same one-word insert against the current apt line plus the matching pyproject.toml comment update. Co-authored-by: konsisumer <11262660+konsisumer@users.noreply.github.com>
What does this PR do?
Add
libolm-devto the Docker image'sapt-get installlayer so thatpython-olm(a transitive dependency ofmautrix[encryption]) can build from source during the Matrix gateway's first-boot lazy-install.Since #24515 (2026-05-12), the
matrixextra was dropped from the[all]Docker build extra and replaced with a first-boot lazy-install viatools/lazy_deps.py. The lazy-install runs as the non-roothermesuser after root privileges are dropped, so no system package can be installed at that point. Withoutlibolm-devalready in the base image,python-olm(sdist-only, requires libolm headers to compile) fails silently, causing the✗ matrix error: Invalid event type/No adapter available for matrixerrors reported in #25495.A comment in
pyproject.tomlis also updated to document that the Docker image shipslibolm-devto support this build path.Related Issue
Fixes #25495
Type of Change
Changes Made
Dockerfile: addlibolm-devto theapt-get installlayer sopython-olmcan compile during lazy-installpyproject.toml: update[all]policy comment to note that Docker shipslibolm-devfor Matrix lazy-install buildsHow to Test
docker build -t hermes-test .docker run --rm -e MATRIX_HOMESERVER=... -e MATRIX_ACCESS_TOKEN=... hermes-test gateway runLazy install complete for feature 'platform.matrix'followed byConnecting to matrix...without the✗ matrix error: Invalid event typeerror.docker run --rm hermes-test /bin/bash -c "/opt/hermes/.venv/bin/python -c 'import olm; print(olm.__version__)'"— should print a version string instead of an ImportError.Checklist
Code
fix(scope):,feat(scope):, etc.)pytest tests/ -qand all tests passDocumentation & Housekeeping
docs/, docstrings) — N/Acli-config.yaml.exampleif I added/changed config keys — N/ACONTRIBUTING.mdorAGENTS.mdif I changed architecture or workflows — N/AScreenshots / Logs
The only failing CI check (
uv lock --check) is a systemic issue onmainunrelated to this PR's changes, as confirmed by BoardJames-Bot's analysis — being addressed separately in #27837.