Skip to content

feat: add pybind11 package - #528

Merged
Sunrisepeak merged 7 commits into
mcpplibs:mainfrom
tz12323:add_pybind11
Oct 13, 2026
Merged

Sunrisepeak merged 7 commits into
mcpplibs:mainfrom
tz12323:add_pybind11

Conversation

@tz12323

@tz12323 tz12323 commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

Adds compat.pybind11 and a consumer example resolved from this checkout.

The follow-up review fixes descriptor identity/layout and validates actual library behavior. Source URLs are pinned and hashed; plain-string GLOBAL URLs retain the documented CN fallback. See .agents/docs/2026-10-13-add-pybind11-plan.md for build shape, feature assessment and validation.

The pinned upstream revision is a 3.2.0 development snapshot, indexed as 3.2.0-dev.6254086. The example uses the declared xim:python@3.13.12 SDK and checks Python evaluation and C++ callbacks.

tz12323 and others added 3 commits October 13, 2026 19:16
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@tz12323

tz12323 commented Oct 13, 2026

Copy link
Copy Markdown
Contributor Author

[CI][linux-llvm] pybind11 embed test fails: dual libc conflict

Observation

On linux-llvm CI, mcpp test -p pybind11 fails at the embed test.

rule B: artifact ... resolves libc from /usr/lib/x86_64-linux-gnu/libc.so.6
while RuntimeBinding glibc@2.44.3 selects /home/runner/.mcpp/registry/data/xpkgs/xim-x-glibc/2.44.3/lib;
one process cannot have two libcs.
Fix: rebuild after selecting a compatible SubOS in mcpp.toml ([xlings] subos = "<name>").

Root cause

The embed example links against host Python interpreter.
Host Python binary depends on the system glibc (/usr/lib/x86_64-linux-gnu/libc.so.6).
Meanwhile the mcpp build graph pulls in the standalone xim packaged glibc@2.44.3.
A single ELF process cannot load two distinct glibc implementations, triggering the mcpp runtime binding check failure at build time.

@Sunrisepeak Sunrisepeak left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed canonical compat.pybind11 identity, the honest 3.2.0 development-snapshot version and the pinned archive/hash. The example declares one Python SDK and uses matching headers, import library/runtime and standard library; it evaluates Python and calls C++ from Python. No guessed Python ABI macros or duplicate DLL staging remain. The CI-pinned local embedding test passes and every current CI check passes (conditional reporting jobs are skipped). No unresolved review findings.

@Sunrisepeak
Sunrisepeak merged commit cfb808b into mcpplibs:main Oct 13, 2026
17 checks passed
@tz12323

tz12323 commented Oct 17, 2026

Copy link
Copy Markdown
Contributor Author

Regarding this PR:

I would like to raise a feature expectation for pybind11 integration here.
Currently it is tied to the Python interpreter bundled inside xlings, which limits which Python versions we can target.

I hope pybind11 can work with system‑provided / user‑selected Python interpreters, supporting multiple Python versions flexibly.
We want the similar flexibility that Rust’s pyo3 + maturin brings:

  • Build against different user Python versions
  • Support abi3 / multiple Python ABI
  • Avoid being locked into one single bundled Python copy from xlings

Binding to xlings‑bundled Python reduces real‑world usability, as users often use different Python versions (system python, venv, conda, uv-managed python etc).
Could we consider decoupling from xlings internal Python and let pybind11 discover & build against target Python interpreter on host?

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.

2 participants