feat: Derive c_stdlib build variants from system requirements#6320
feat: Derive c_stdlib build variants from system requirements#6320hunger wants to merge 2 commits into
c_stdlib build variants from system requirements#6320Conversation
|
Nope thats wrong. Its handled by the macosx_deployment_target package. |
87ffb9f to
b6cca2b
Compare
|
This should mostly work, but it has severe trouble in the presence of "old" lockfiles. That needs looking into still. |
937a1bb to
f2ddb9e
Compare
Inject conda-forge c_stdlib/c_stdlib_version build variants from a platform's declared virtual packages (__osx, __glibc) in Workspace::variants(), so build backends pin the minimum OS/libc target and stop emitting wheels tagged for the host OS version (e.g. macosx_26_0). Explicit [workspace.build-variants] entries still win; derivation only fills absent keys. osx-* derives macosx_deployment_target, linux-* derives sysroot; windows and unmatched platforms are skipped. The providers are conda-forge packages, so derivation is gated on the workspace resolving at least one conda-forge channel; the macosx_deployment_target package's activation script sets MACOSX_DEPLOYMENT_TARGET during the build. musl and __cuda are left for a follow-up (TODO marker). Refs: prefix-dev#6175
f2ddb9e to
c73a6f4
Compare
|
We report better build variants to the build backend, which filters them and hands them back to us, so we can store them in the lock file. So this PR does invalidate lock files. I think that is what we need to do in this case and users will benefit from better builds. I have no Mac to test this on, but the linux side works reliably, and the mac shows up with the expected variants in the lock file, so I am positive this works as expected. Windows is unchanged, nothing to test there. The |
|
I am going to ping @h-vetinari as he might have some opinions here and I would love his input. |
Derive
c_stdlibbuild variants from system requirementsProblem
When pixi-build builds a compiled (non-noarch) package, the C stdlib target is
selected through conda-forge's
c_stdlib/c_stdlib_versionbuild variants(consumed by the
stdlib('c')recipe function). Today users have to spell thoseout by hand in
[workspace.build-variants], even though pixi already knows thetarget from the workspace's
platforms.Changes
Derive the variant pair from system requirements (
pixi_core)Workspace::variantsnow derivesc_stdlib/c_stdlib_versionfrom theplatform's declared virtual packages and fills them in only where the user
hasn't set them explicitly (an explicit
[workspace.build-variants]entryalways wins):
c_stdlibc_stdlib_versionosx-*__osxmacosx_deployment_target__osxversionlinux-*__glibcsysroot__glibcversionWindows is skipped (no meaningful stdlib version), and a platform with no
matching virtual package derives nothing rather than inventing a value. The
logic lives in the new
crates/pixi_core/src/workspace/stdlib_variants.rs.__musland__cudaare noted as follow-ups (TODO(#6175)). They are not fully describedin any CEP, so whatever we do there is goiung to be incomplete.
Set
MACOSX_DEPLOYMENT_TARGETon macOS (pixi_build_python)For compiled macOS builds where the
c_stdlib_versionvariant is present, thepython backend injects
MACOSX_DEPLOYMENT_TARGET=${{ c_stdlib_version }}intothe build-script env (rendered lazily by rattler-build). It's skipped for noarch
builds, off macOS, and when the variant is absent. An explicit
MACOSX_DEPLOYMENT_TARGETin the backend config is left untouched — the derivedvalue only fills the gap.
Tests
derive_stdlib_variants(osx, linux, windows-skipped,glibc-absent, and bare-subdir defaults).
unset key is still filled in.
macos_deployment_target_envand two end-to-endgenerate_recipetests (derived value wired in; user config respected).test_macos_deployment_target_from_system_requirementsplus fixture
tests/data/pixi-build/system-requirements-osx-pythonpinningmacos = "12.0"(deliberately different from the 13.0 osx-subdir default).It asserts a single compiled artifact is produced on every platform, and on
macOS that the build script env carries
MACOSX_DEPLOYMENT_TARGET=12.0.Fixes #6175.
AI Disclosure
Tools: Claude
Checklist:
schema/model.py.