Skip to content

rust-cbindgen: fix test failures due to env vars#348031

Merged
emilazy merged 1 commit intoNixOS:staging-nextfrom
bryango:rust-cbindgen
Oct 16, 2024
Merged

rust-cbindgen: fix test failures due to env vars#348031
emilazy merged 1 commit intoNixOS:staging-nextfrom
bryango:rust-cbindgen

Conversation

@bryango
Copy link
Copy Markdown
Member

@bryango bryango commented Oct 12, 2024

... specifically, it's the CARGO_BUILD_TARGET env var introduced in commit: 683f97e. See: #298108.

Targeted master but tested against a cherry-picked 683f97e (which is currently staging).

Upstream PR is linked in the code; not linking here to avoid excessive notifications to upstream.
cc @trofi for testing 🚀

Things done

  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandboxing enabled in nix.conf? (See Nix manual)
    • sandbox = relaxed
    • sandbox = true
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 24.11 Release Notes (or backporting 23.11 and 24.05 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
  • Fits CONTRIBUTING.md.

Add a 👍 reaction to pull requests you find important.

@trofi
Copy link
Copy Markdown
Contributor

trofi commented Oct 12, 2024

It fixes rust-cbindgen build on staging for x86_64-linux. Thank you!

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

this needs to be a stable url, like: https://github.com/mozilla/cbindgen/commit/f8efe01d7f23c56b593ec686f0b430e6d47404e0.patch?full_index=1, and the other commit, but also needs to be merged in the tree otherwise the commits can get garbage collected -- so with unmerged PRs we are just vendoring the patch rather than using fetchpatch.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Good idea! I will wait till next week and see if it can get merged upstream. They are pretty responsive.

stable url, like: https://github.com/mozilla/cbindgen/commit/f8efe01d7f23c56b593ec686f0b430e6d47404e0.patch?full_index=1

I have heard this before and will do so once upstream has responded. But just out of curiosity: how might https://patch-diff.githubusercontent.com/raw/*/*/pull/*.patch differ from the stable URL? Maybe the hash will change?

Copy link
Copy Markdown
Contributor

@paparodeo paparodeo Oct 12, 2024

Choose a reason for hiding this comment

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

https://github.com/mozilla/cbindgen/pull/1010.patch will change when the PR is updated, thus creating hash mismatch and breaking the package.

@ofborg ofborg bot requested a review from mweinelt October 12, 2024 10:00
@ofborg ofborg bot added 10.rebuild-darwin: 1-10 This PR causes between 1 and 10 packages to rebuild on Darwin. 10.rebuild-linux: 501+ This PR causes many rebuilds on Linux and should normally target the staging branches. 10.rebuild-linux: 1001-2500 This PR causes many rebuilds on Linux and should target the staging branches. labels Oct 12, 2024
@bryango
Copy link
Copy Markdown
Member Author

bryango commented Oct 12, 2024

I didn't expect this to be a mass rebuild 💀 I will wait for ofborg to finish first and retarget staging... For now I will mark this PR as draft just to be safe.

Update: the mass rebuild is most probably due to mesa:

$ nix why-depends --precise --derivation nixpkgs#mesa nixpkgs#rust-cbindgen 
/nix/store/9wdy52gv1y9nvc4zyjl8nnziallqvz7a-mesa-24.2.2.drv
└───/: ….9.3.drv",["out"]),("/nix/store/r0dzbar9b3q3pq72ywffq4w50q8zsxww-rust-cbindgen-0.27.0.drv",["out…
    → /nix/store/r0dzbar9b3q3pq72ywffq4w50q8zsxww-rust-cbindgen-0.27.0.drv

$ nix derivation show nixpkgs#mesa | grep rust-cbindgen
      "nativeBuildInputs": "/nix/store/idhgl5z435l1hid29af4hkp8v952w8v3-meson-1.5.1 /nix/store/02vzklfgfpaf457rq927fq3jj5hn133f-pkg-config-wrapper-0.29.2 /nix/store/m0g218hn4rbq2wj7szzg8a112alq1qvc-ninja-1.12.1 /nix/store/snk7p4lim2snqiy9339ghij0km41n46k-intltool-0.51.0 /nix/store/za1x44ayl8x3dga0ampj1prqsdnq2yxd-bison-3.8.2 /nix/store/9z7zqgsw0lcn79rdvmak680sjzi5pyzf-flex-2.6.4 /nix/store/xvsyiva0lnb60m6hihazkc11gdjgfy8i-file-5.45-dev /nix/store/h3i0acpmr8mrjx07519xxmidv8mpax4y-python3-3.12.5 /nix/store/zxl97260xfw4pd13jrnkaghkalbin3y5-python3.12-packaging-24.1 /nix/store/f4kd84nwjrac6sbkgb3w8q2jmfdnq9vn-python3.12-pycparser-2.22 /nix/store/77nakwgzax6xlj20zxx7i41lldlzkfsg-python3.12-mako-1.3.5 /nix/store/wxf86z24p2pk1vzrsj3051nal0d3mhf9-python3.12-ply-3.11 /nix/store/84b7b30qi2v9x63pqda03z0z1yfdgq0p-python3.12-pyyaml-6.0.2 /nix/store/rxj2fhgd3rh9fxcmwncvdza3sfylmgw1-jdupes-1.28.0 /nix/store/5q83mzmq7ifjahdf7wc8d51xggfcmsx4-glslang-14.3.0-bin /nix/store/n4nnqpcaxk621i8lwr86116fv5kfy3jl-rustc-wrapper-1.80.1 /nix/store/g637s3hvjgvm4xnypqg0ynr7xwxp1r62-rust-bindgen-0.69.4 /nix/store/sssc67hl67w7vhfx0l383b81vv58mk7b-rust-cbindgen-0.27.0 /nix/store/fhq35yg47i18i1zz8j7az904823r6cxr-rust-bindgen-hook /nix/store/0m1ggm1y9dj8r9cp4jd52k0k96rfinfp-wayland-scanner-1.23.1-dev /nix/store/xicrk4waf3kazyf96aaavsirgx241r0s-separate-debug-info.sh",
      "/nix/store/r0dzbar9b3q3pq72ywffq4w50q8zsxww-rust-cbindgen-0.27.0.drv": {

ofborg reports:

Update:

  • retargeted staging-next, waiting for upstream response to stabilize the patch URL & hash.
  • upstream has stalled, so vendored the patch in nixpkgs, waiting for ofborg...

@bryango bryango marked this pull request as draft October 12, 2024 10:10
@bryango bryango changed the base branch from master to staging October 13, 2024 04:53
@alyssais alyssais changed the base branch from staging to staging-next October 15, 2024 16:49
@ofborg ofborg bot added 10.rebuild-darwin: 11-100 This PR causes between 11 and 100 packages to rebuild on Darwin. and removed 10.rebuild-darwin: 1-10 This PR causes between 1 and 10 packages to rebuild on Darwin. labels Oct 15, 2024
fabianhjr added a commit to fabianhjr/nixpkgs that referenced this pull request Oct 16, 2024
currently fails with:

```
error: builder for '/nix/store/7g13ladvphijvrhswzl6zdwx373ks6ac-rust-cbindgen-0.27.0.drv' failed with exit code 101;
       last 25 log lines:
       >   left: ["release", "x86_64-unknown-linux-gnu"]
       >  right: ["release"]
       > note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
       >
       > ---- bin_explicit_debug_build stdout ----
       > thread 'bin_explicit_debug_build' panicked at tests/profile.rs:93:5:
       > assertion `left == right` failed
       >   left: ["debug", "x86_64-unknown-linux-gnu"]
       >  right: ["debug"]
       >
       > ---- bin_default_uses_debug_build stdout ----
       > thread 'bin_default_uses_debug_build' panicked at tests/profile.rs:87:5:
       > assertion `left == right` failed
       >   left: ["debug", "x86_64-unknown-linux-gnu"]
       >  right: ["debug"]
       >
       >
       > failures:
       >     bin_default_uses_debug_build
       >     bin_explicit_debug_build
       >     bin_explicit_release_build
       >
       > test result: FAILED. 0 passed; 3 failed; 0 ignored; 0 measured; 3 filtered out; finished in 0.42s
       >
       > error: test failed, to rerun pass `--test profile`
       For full logs, run 'nix log /nix/store/7g13ladvphijvrhswzl6zdwx373ks6ac-rust-cbindgen-0.27.0.drv'.
````

Related to: NixOS#348031
@fabianhjr fabianhjr mentioned this pull request Oct 16, 2024
13 tasks
... specifically, it's the `CARGO_BUILD_TARGET` env var introduced in
commit: 683f97e
@bryango
Copy link
Copy Markdown
Member Author

bryango commented Oct 16, 2024

Since we already have a working patch (pending upstream), I think it would be better to vendor it (instead of disabling all the tests as is currently implemented in #348935). The patch is small and straightforward so it should be okay. What do you think? cc @alyssais @fabianhjr

I have rebased this PR with the vendored patch on top of #348935.

@bryango bryango marked this pull request as ready for review October 16, 2024 05:36
Copy link
Copy Markdown
Member

@emilazy emilazy left a comment

Choose a reason for hiding this comment

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

I’m okay with the patch; even if upstream wants changes it’s “only” tests that we’re not running without them anyway. Thanks!

@emilazy emilazy merged commit 27c05ca into NixOS:staging-next Oct 16, 2024
@bryango
Copy link
Copy Markdown
Member Author

bryango commented Oct 16, 2024

There is no cache available yet so I cannot test this on top of staging-next; it does build fine on top of master. Please ping me if things blow up 😆

@emilazy
Copy link
Copy Markdown
Member

emilazy commented Oct 16, 2024

Don’t worry, something always blows up.

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

Labels

10.rebuild-darwin: 11-100 This PR causes between 11 and 100 packages to rebuild on Darwin. 10.rebuild-linux: 501+ This PR causes many rebuilds on Linux and should normally target the staging branches. 10.rebuild-linux: 1001-2500 This PR causes many rebuilds on Linux and should target the staging branches.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants