← Back to Pull requests

feat: Require the OpenMP runtime for CRAN packages that use OpenMP #2935

Merged
matthewfeickert merged 4 files (359 lines) on Nov 16, 2026 08:22 UTC
View on GitHub
matthewfeickert matthewfeickert commented on Nov 11, 2026 08:50 UTC
Author

Part of Issue #2891 (feedback from @danielnachun originally posted in PR #2759), following PR #2901, PR #2918 and PR #2929.

A compiled CRAN package built with R's OpenMP flags, such as data.table, got no OpenMP runtime in its host requirements. The src/Makevars files that PR #2929 reads for BLAS and LAPACK are now also checked for $(SHLIB_OPENMP_CFLAGS), $(SHLIB_OPENMP_CXXFLAGS), $(SHLIB_OPENMP_FFLAGS) and $(SHLIB_OPENMP_FCFLAGS) (in either the $(…) or ${…} form), and a reference to any of them adds the OpenMP runtime of the platform's compilers to host: llvm-openmp on macOS, where conda-forge builds with clang, and libgomp elsewhere, where it builds with GCC or, on Windows, MinGW GCC.

The check reuses the Makevars contents from PR #2929, so the tarball is still decompressed only once, and the BLAS and LAPACK check and the new one now share a single helper that asks whether any Makevars file references any of a list of make variables. As the two runtimes are platform-conditional, they are added after the plain host requirements, as if:/then: entries. Without a tarball there is nothing to inspect, and the output is unchanged.

For example, rattler-build generate-recipe cran data.table now gives:

requirements:
  host:
    - r-base
    - if: osx
      then:
        - llvm-openmp
    - if: not osx
      then:
        - libgomp

This is the fourth of a series of small PRs for Issue #2891, kept apart for easier review. The last one builds on this one and will follow:

1. PR #2901: the Fortran compiler for Fortran sources (merged)
2. PR #2918: the C++ compiler only for packages with C++ sources (merged)
3. PR #2929: libblas and liblapack for packages whose src/Makevars
use $(BLAS_LIBS) or $(LAPACK_LIBS) (merged)
4. this PR: the OpenMP runtime for $(SHLIB_OPENMP_FLAGS)
5. the MinGW (m2w64_
) compilers and MSYS2 (m2-*) tools on Windows

Testing

  • pixi run cargo test -p rattler_build_recipe_generator, with a new unit test that builds in-memory tarballs with each of the four OpenMP flags, checks that a Makevars file without them does not count, and compares the resulting host requirements, conditionals included, as values

  • pixi run --environment=lint cargo-fmt (no changes) and cargo clippy -p rattler_build_recipe_generator --all-targets -- -D warnings

  • generated the recipes of data.table (gets the OpenMP runtime), quantreg (gets only libblas and liblapack) and glmnet (gets neither, as its src/Makevars uses no OpenMP flags)
  • I did not build data.table from the generated recipe for this PR. Its build fails for an unrelated reason that this series does not touch: the generator maps its MPL-2.0 license to a license file that r-base does not ship, so no license file is copied.

    🤖 Generated with Claude Code

    Diff: 359 lines (+269 / -90) across 4 files Reviewer: None requested Review duration: 7171m
    All Vouch review confidence checks passed
    Residual risk 0.30 = Change Risk (0.55) × (1 − Review Confidence (0.44)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.55 · 359 lines diff across 4 files
    0.55
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.02 · 1 substantive comment(s)
    0.02
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 10%
    44%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.352
    Shallow Review Depth shallow_review_depth
    0.344
    No Reviewer Assigned no_reviewer_assigned
    0.120
    Real PR Conversation Timeline
    1 comments
    "Review active on #2935"
    general weight: 0.35
    Reviewers
    None requested
    Assignees
    matthewfeickert matthewfeickert
    Labels
    risk: low confidence: 44.2% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 54.6% (MEDIUM) · Higher = larger blast radius
    54.6%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 44.2% · Lower = rushed or shallow review
    44.2%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 30.5% · Safe to merge
    30.5%