Skip to content

linux: fix cross#429588

Merged
alyssais merged 4 commits intoNixOS:stagingfrom
alyssais:linux-cross
Aug 8, 2025
Merged

linux: fix cross#429588
alyssais merged 4 commits intoNixOS:stagingfrom
alyssais:linux-cross

Conversation

@alyssais
Copy link
Member

The .unwrapped attributes are not correctly spliced. Use the top level attributes instead, which are spliced correctly.

Things done

  • Built on platform:
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • Tested, as applicable:
  • Ran nixpkgs-review on this PR. See nixpkgs-review usage.
  • Tested basic functionality of all binary files, usually in ./result/bin/.
  • Nixpkgs Release Notes
    • Package update: when the change is major or breaking.
  • NixOS Release Notes
    • Module addition: when adding a new NixOS module.
    • Module update: when the change is significant.
  • Fits CONTRIBUTING.md, pkgs/README.md, maintainers/README.md and other READMEs.

Add a 👍 reaction to pull requests you find important.

@ofborg ofborg bot added the 6.topic: cross-compilation Building packages on a different platform than they will be used on label Jul 30, 2025
@alyssais alyssais mentioned this pull request Jul 30, 2025
13 tasks
@nixpkgs-ci nixpkgs-ci bot added 10.rebuild-linux: 501+ This PR causes many rebuilds on Linux and should normally target the staging branches. 10.rebuild-darwin: 1-10 This PR causes between 1 and 10 packages to rebuild on Darwin. 11.by: package-maintainer This PR was created by a maintainer of all the package it changes. 10.rebuild-linux: 2501-5000 This PR causes many rebuilds on Linux and should target the staging branches. 12.approvals: 1 This PR was reviewed and approved by one person. 6.topic: kernel The Linux kernel labels Jul 30, 2025
@nix-owners nix-owners bot requested a review from thoughtpolice July 30, 2025 13:24
@alyssais alyssais marked this pull request as draft July 30, 2025 17:23
@alyssais alyssais marked this pull request as ready for review July 31, 2025 07:26
@alyssais
Copy link
Member Author

Right — had to also do the same fix in kernel/generic.nix.

If we're going to use the unwrapped versions, we should do so
consistently in both parts of the kernel build, not mix and match.

Fixes: e9b2edb ("linux: un-simplify toolchain selection")
@georgewhewell
Copy link
Contributor

i think something is broken-

❯ nix build github:alyssais/nixpkgs/linux-cross#legacyPackages.x86_64-linux.pkgsCross.gnu64.linuxPackages_latest.kernel
error: builder for '/nix/store/nxyhlfp1r7rm0m16ykwrbd1b8sdpp0pj-linux-config-6.16.drv' failed with exit code 255;
       last 25 log lines:
       > GOT: * Runtime Testing
       > GOT: *
       > QUESTION: Runtime Testing, NAME: RUNTIME_TESTING_MENU, ALTS: N/y/?, ANSWER: n
       > GOT: n
       > QUESTION: Memtest, NAME: MEMTEST, ALTS: Y/n/?, ANSWER: y
       > GOT: y
       > QUESTION: Microsoft Hyper-V driver testing, NAME: HYPERV_TESTING, ALTS: N/y/?, ANSWER:
       > GOT:
       > GOT: *
       > GOT: * Rust hacking
       > GOT: *
       > GOT: #
       > GOT: # configuration written to .config
       > GOT: #
       > GOT: make[1]: Leaving directory '/build/linux-6.16/build'
       > GOT: make: Leaving directory '/build/linux-6.16'
       > warning: unused option: CRC32_SELFTEST
       > warning: unused option: CRYPTO_TEST
       > error: unused option: DRM_PANIC_SCREEN_QR_CODE
       > warning: unused option: POWER_RESET_GPIO
       > warning: unused option: POWER_RESET_GPIO_RESTART
       > warning: unused option: REISERFS_FS_POSIX_ACL
       > warning: unused option: REISERFS_FS_SECURITY
       > warning: unused option: REISERFS_FS_XATTR
       > error: unused option: RUST
       For full logs, run:
         nix log /nix/store/nxyhlfp1r7rm0m16ykwrbd1b8sdpp0pj-linux-config-6.16.drv
error: 1 dependencies of derivation '/nix/store/j3n421r34v43g4bjj0psjl4hm155xvlb-linux-6.16.drv' failed to build

it used to work

❯ nix build github:nixos/nixpkgs/nixos-unstable-small#legacyPackages.x86_64-linux.pkgsCross.gnu64.linuxPackages_latest.kernel --print-out-paths
/nix/store/7bh7fkf277bm75s34r12v8jarsandhzr-linux-6.16

@ccicnce113424
Copy link
Member

ccicnce113424 commented Aug 1, 2025

Unwrapped bindgen is missing some libs. Using wrapped bindgen fixes building.

$ make rustavailable
***
*** Running 'bindgen' to check the libclang version (used by the Rust
*** bindings generator) failed with code 101. This may be caused by
*** a failure to locate libclang. See output and docs below for details:
***

thread 'main' panicked at /build/rust-bindgen-unwrapped-0.72.0-vendor/bindgen-0.72.0/lib.rs:616:27:
Unable to find libclang: "couldn't find any valid shared libraries matching: ['libclang.so', 'libclang-*.so', 'libclang.so.*', 'libclang-*.so.*'], set the `LIBCLANG_PATH` environment variable to a path where one of these files can be found (invalid: [])"
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
***
***
*** Please see Documentation/rust/quick-start.rst for details
*** on how to set up the Rust support.
***

@alyssais
Copy link
Member Author

alyssais commented Aug 1, 2025

Yes, it is. I'm looking into it. Adding rustPlatform.bindgenHook fixes it, but ideally bindgen would just link the library…

There's not really any reason for bindgen to dlopen libclang at all in
Nixpkgs.  Moving this out of the wrapper means that it will still work
even when we don't want all the standard Nixpkgs cflags behavior, like
in the Linux kernel build.
rustc.unwrapped is available, but it isn't spliced correctly.  Having
this attribute available at the top level is consistent with
e.g. rust-bindgen-unwrapped.
The .unwrapped attributes are not correctly spliced.  Use the top
level attributes instead, which are spliced correctly.

Fixes: e9b2edb ("linux: un-simplify toolchain selection")
@nixpkgs-ci nixpkgs-ci bot removed the 11.by: package-maintainer This PR was created by a maintainer of all the package it changes. label Aug 2, 2025
@nix-owners nix-owners bot requested a review from JohnTitor August 2, 2025 08:03
@alyssais alyssais merged commit d0584ae into NixOS:staging Aug 8, 2025
25 of 27 checks passed
@alyssais alyssais deleted the linux-cross branch August 8, 2025 09:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

6.topic: cross-compilation Building packages on a different platform than they will be used on 6.topic: kernel The Linux kernel 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: 2501-5000 This PR causes many rebuilds on Linux and should target the staging branches. 12.approvals: 1 This PR was reviewed and approved by one person.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants