Commit Graph

493 Commits

Author SHA1 Message Date
github-actions[bot]
af7beed7be
Merge master into staging-next 2023-06-16 06:01:09 +00:00
Ben Wolsieffer
87ebad10d6 rustc: add armv6l-linux to platforms
armv6l-linux was incorrectly added to the list of platforms without host
tools in #227987. arm-unknown-linux-gnueabihf is present in the list of
Tier 2 targets with host tools, and this target corresponds to our
armv6l-linux platform.
2023-06-15 16:56:55 -04:00
Francesco Gazzetta
131808261a rustc: use llvm_16
https://github.com/rust-lang/rust/releases/tag/1.70.0 (Internal Changes)
https://github.com/rust-lang/rust/pull/109474/
2023-06-07 11:06:13 +02:00
figsoda
ff16966860 rustc: 1.69.0 -> 1.70.0
https://github.com/rust-lang/rust/releases/tag/1.70.0
2023-06-01 15:00:58 -04:00
figsoda
a95a7508a5
Merge pull request #233521 from alyssais/cargo-cross-broken
cargo: mark broken for cross compilation to x86
2023-05-22 22:40:15 -04:00
Alyssa Ross
467c7ca038
cargo: mark broken for cross compilation to x86 2023-05-23 01:23:44 +00:00
Alyssa Ross
adb54ab7bd rustc: remove unused argument 2023-05-22 21:46:08 +00:00
figsoda
15f699fbf9 rustfmt: fix warning
rustPlatform.rust has been deprecated in https://github.com/NixOS/nixpkgs/pull/230951
2023-05-12 19:49:14 -04:00
Javier Olaechea
dd584d82f1 rustfmt: fix on darwin
Reading this [rust-issue] it seems that we have to link against
rustc_driver. The [clippy.nix] expression already does something similar

Of the 4 executables found in the result of building rustfmt only
rustfmt and git-rustfmt needed to be linked. The other worked without
linking to rustc_driver.

[rust-issue]: https://github.com/rust-lang/rust/pull/105609
[clippy.nix]: c8cf570dae/pkgs/development/compilers/rust/clippy.nix (L27-L36)
2023-05-12 18:44:20 -04:00
Alyssa Ross
46cb0eb1a9 rustPlatform.rust: deprecate
It is almost never correct to use these attributes, because they don't
work correctly with splicing.  Compare:

	% nix repl -f . --argstr crossSystem aarch64-linux
	Welcome to Nix 2.10.3. Type :? for help.

	Loading installable ''...
	Added 18988 variables.
	nix-repl> callPackage ({ stdenv, rustc }: (stdenv.mkDerivation { name = ""; nativeBuildInputs = [ rustc ]; }).nativeBuildInputs) {}
	«derivation /nix/store/bjrkg8kcq3hvg5kb03ivb856zy91qpbk-aarch64-unknown-linux-gnu-rustc-1.69.0.drv» ]

	nix-repl> callPackage ({ stdenv, rustPlatform }: (stdenv.mkDerivation { name = ""; nativeBuildInputs = [ rustPlatform.rust.rustc ]; }).nativeBuildInputs) {}
	«derivation /nix/store/ra5r07j52y7akclr827r3dzxzvqnvfbl-rustc-1.69.0.drv» ]

I'm not sure this is fixable.  I don't think it's worth keeping them
around considering we have top level attributes.  It makes overriding
slightly more annoying, but only slightly.
2023-05-12 15:31:21 +00:00
Alyssa Ross
5e06b3cb19 treewide: don't use rustPlatform.rust
This will be deprecated in the next commit.
2023-05-12 15:31:21 +00:00
Alyssa Ross
454b2058d4
rustc: fix name when cross compiled
I made a mistake when trying to add the target prefix to Rust cross
compilers: pkgsCross.aarch64-multiplatform.rustc ended up being called
"aarch64-unknown-linux-gnu-rustc-aarch64-unknown-linux-gnu-1.69.0",
which is a bit verbose.

With this change:

	nix-repl> rustc.name
	"rustc-1.69.0"

	nix-repl> pkgsCross.aarch64-multiplatform.buildPackages.rustc.name
	"aarch64-unknown-linux-gnu-rustc-1.69.0"

	nix-repl> pkgsCross.aarch64-multiplatform.rustc.name
	"rustc-aarch64-unknown-linux-gnu-1.69.0"

As intended.

Fixes: 57e73d23bb ("rustc,rustPlatform.buildRustPackage: broaden platforms")
2023-05-09 20:13:45 +00:00
github-actions[bot]
c9a253ff7f
Merge staging-next into staging 2023-04-25 12:02:03 +00:00
github-actions[bot]
a39805cda2
Merge master into staging-next 2023-04-25 12:01:31 +00:00
Alyssa Ross
57e73d23bb rustc,rustPlatform.buildRustPackage: broaden platforms
rustc supports way more platforms than Linux and Darwin.  We might not
be able to build it for every platform at the moment, but that's what
meta.broken is for.

There are other platforms that rustc can produce binaries for, but
can't run on itself, so those are listed in the defaults for
buildRustPackage.
2023-04-25 08:27:59 +00:00
Alyssa Ross
37a9ea8f4a cargo-auditable-cargo-wrapper: use more descriptive name 2023-04-24 23:41:03 +00:00
Alyssa Ross
a19acef56f cargo-auditable-cargo-wrapper: use makeWrapper 2023-04-24 23:41:03 +00:00
Luka Blaskovic
081c90ff3b rustc: 1.68.2 -> 1.69.0 2023-04-23 11:44:01 +10:00
github-actions[bot]
cf8e955712
Merge master into staging-next 2023-04-23 00:02:24 +00:00
Adam Joseph
0ac955ad63 rust/cargo.nix: set HOST_PKG_CONFIG_PATH for cross builds
Prior to this commit, builds of
`pkgsCross.aarch64-multiplatform.cargo` would fail due to being
unable to find `-lz` when compiling cargo's own `build.rs` for the
`buildPlatform`.

This environment variable uses the (very confusing) LLVM convention
of calling the buildPlatform "HOST".

Co-authored-by: figsoda <figsoda@pm.me>
2023-04-22 14:41:58 -07:00
Adam Joseph
ad3a532658 rust/cargo.nix: disable audit if audit.meta.broken
Not much point in auditing things that can't be built.
2023-04-22 12:56:30 -07:00
Adam Joseph
758ae7d4f4 cargo-auditable: mark broken if cross 2023-04-22 12:56:30 -07:00
github-actions[bot]
26bd8755a4
Merge master into staging-next 2023-04-18 06:01:10 +00:00
Adam Joseph
53b6e1a3c5 rustc: fix >=1.68 host!=build
Our `rustc.nix` adds a `--target` flag for the host when doing a
host!=target build, but neglects to add a `--target` flag for the
buildPlatform when doing a build!=(host==target) build.  This commit
corrects that.

Before rustc 1.68 omitting the --target flag for the buildPlatform
did not cause any problems.  As of rustc 1.68, build!=host without a
--target for the build will fail like below (with hundreds more
"cannot find std::" errors.

```
$ nix build -f . -L pkgsCross.aarch64-multiplatform.rustc
...
Copying stage1 library from stage1 (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu / aarch64-unknown-linux-gnu)
Uplifting stage1 library (x86_64-unknown-linux-gnu -> aarch64-unknown-linux-gnu)
Copying stage2 library from stage1 (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu / aarch64-unknown-linux-gnu)
Building stage2 tool rust-analyzer-proc-macro-srv (aarch64-unknown-linux-gnu)
   Compiling autocfg v1.1.0
   Compiling libc v0.2.135
   Compiling cfg-if v1.0.0
   Compiling proc-macro2 v1.0.47
   Compiling quote v1.0.21
   Compiling unicode-ident v1.0.5
   Compiling syn v1.0.102
   Compiling once_cell v1.15.0
   Compiling parking_lot_core v0.9.4
   Compiling serde_derive v1.0.145
   Compiling hashbrown v0.12.3
   Compiling scopeguard v1.1.0
   Compiling smallvec v1.10.0
   Compiling log v0.4.17
   Compiling serde v1.0.145
   Compiling rustc-hash v1.1.0
error[E0463]: can't find crate for `std`
error: cannot find macro `println` in this scope
 --> /nix/tmp/nix-build-rustc-aarch64-unknown-linux-gnu-1.68.2.drv-0/rustc-1.68.2-src/vendor/libc-0.2.135/build.rs:7:5
  |
7 |     println!("cargo:rerun-if-changed=build.rs");
  |     ^^^^^^^
error: cannot find macro `println` in this scope
  --> /nix/tmp/nix-build-rustc-aarch64-unknown-linux-gnu-1.68.2.drv-0/rustc-1.68.2-src/vendor/libc-0.2.135/build.rs:16:9
   |
16 |         println!(
   |         ^^^^^^^
error: cannot find macro `println` in this scope
  --> /nix/tmp/nix-build-rustc-aarch64-unknown-linux-gnu-1.68.2.drv-0/rustc-1.68.2-src/vendor/libc-0.2.135/build.rs:29:13
   |
29 |             println!("cargo:rustc-cfg=freebsd10")
   |             ^^^^^^^
```
2023-04-18 14:10:40 +10:00
github-actions[bot]
6176f16de2
Merge staging-next into staging 2023-04-14 12:02:03 +00:00
Alyssa Ross
ecbbd3104f rustc: put targetPrefix in pname
Our rustc package is not universal, because we only build std for the
host and target platforms.  This means that a build graph where cross
is involved will end up with multiple rustc packages in it, so it
would be helpful to have a way to tell them apart, just like we do for
e.g. gcc.
2023-04-14 10:05:27 +00:00
Alyssa Ross
a1924ebbbf clippy: enable debug info
This was useful while tracking down why clippy was broken when
cross-compiling.
2023-04-14 09:01:29 +00:00
github-actions[bot]
5557fcff78
Merge staging-next into staging 2023-04-13 18:01:58 +00:00
figsoda
a1663fbdf6 rustPlatform.buildRustPackage: fix auditable option when cargo-auditable is not provided to makeRustPlatform 2023-04-13 13:30:39 -04:00
github-actions[bot]
97250f238c
Merge staging-next into staging 2023-04-13 12:02:19 +00:00
Alyssa Ross
0944487ccf clippy: use the right rustc when cross compiling
When cross compiling, buildPackages.cargo uses a rustc that can build
for both the build and host platforms.  This was not true of
buildPackages.clippy, so it was not possible to use clippy for a cross
target.  Now it is.

I've modified clippy.nix to use rustc from rustPlatform, so we only
have to add a single override in default.nix.
2023-04-13 10:19:53 +00:00
figsoda
b0b2385325 rustc: reapply re-erased-regions-are-local patch
The patch is not in 1.68, and was mistakenly removed
2023-04-12 09:57:57 +10:00
github-actions[bot]
89ab0e405c
Merge staging-next into staging 2023-04-03 12:02:00 +00:00
Anderson Torres
f59ca237ef cargo: remove retrry from meta.maintainers 2023-04-02 21:24:55 -03:00
figsoda
4cb59fe2e3 rustc: remove unused inputs 2023-03-29 08:00:08 +10:00
figsoda
45b1d4d292 rustc: 1.68.1 -> 1.68.2
Diff: https://github.com/rust-lang/rust/compare/1.68.1...1.68.2

Changelog: https://blog.rust-lang.org/2023/03/28/Rust-1.68.2.html
2023-03-29 08:00:08 +10:00
figsoda
201d4b7c5c rustPlatform.buildRustPackage: make auditable the default 2023-03-26 22:47:06 -04:00
Yureka
91c36201aa rustfmt: fix build for 1.68 2023-03-27 08:08:40 +10:00
Raito Bezarius
370040c2f1 rustc: 1.68.0 -> 1.68.1 2023-03-27 08:08:40 +10:00
Raito Bezarius
20e24e42d4 rustc: 1.67.1 -> 1.68.0 2023-03-27 08:08:40 +10:00
Alyssa Ross
470e6130b3
rust: fix overriding rust flags on musl
If RUSTFLAGS is set in the environment, Cargo will ignore rustflags
settings in its TOML configuration.  So setting RUSTFLAGS=-g (like
separateDebugInfo does) to generate debug info breaks
dynamically-linked Rust packages on musl.  This breakage is visible
for any packages that call into C dynamic libraries.  If the binary is
linked directly to a C dynamic library, it will fail to build, and if
it depends on a Rust library which links a C dynamic library, it will
segfault at runtime when it tries to call a function from the C
library.  I noticed this because pkgsMusl.crosvm is broken for this
reason, since it sets separateDebugInfo = true.

It shouldn't be possible to end up with broken binaries just by using
RUSTFLAGS to do something innocuous like enable debug info, so I think
that, even though we liked the approach of modiyfing .cargo/config
better at the time, it's become clear that it's too brittle, and we
should bite the bullet and patch the compiler instead when targetting
musl.  It does not appear to be necessary to modify the compiler at
all when cross-compiling /from/ dynamically-linked Musl to another
target, so I'm only checking whether the target system is
dynamically-linked Musl when deciding whether to make the modification
to the compiler.

This reverts commit c2eaaae50d
("cargoSetupHook: pass host config flags"), and implements the
compiler patching approach instead.
2023-03-16 02:29:46 +00:00
figsoda
4a3699c08b cargo-auditable: 0.6.0 -> 0.6.1
Diff: https://github.com/rust-secure-code/cargo-auditable/compare/v0.6.0...v0.6.1

Changelog: https://github.com/rust-secure-code/cargo-auditable/blob/v0.6.1/cargo-auditable/CHANGELOG.md
2023-03-06 21:27:01 -05:00
Weijia Wang
39a2b0b3bf rust: remove aarch64-linux workaround
This commit reverts #209113, since aarch64-linux now uses GCC 12 by default.
2023-03-01 18:42:07 +02:00
Winter
d5dc3d17f3 rustc: re-enable parallel building
We previously disabled this based on a now-closed issue from 2015 [0].
I think enough time has passed that we can give it a shot again, given
that the in the worst case scenario we revert, and in the best case
scenario we get a performance boost.

[0]: https://github.com/rust-lang/rust/issues/30181
2023-02-26 09:09:35 +10:00
github-actions[bot]
507feca606
Merge master into staging-next 2023-02-20 12:01:32 +00:00
Winter
f08437edcb clippy: add rust team to maintainers
Missed this in 1e814042af.
2023-02-20 01:19:56 -05:00
Winter
fd5fa383fe clippy: drop rustc from buildInputs
This may have been required when the package was originally added [0],
but it builds and runs just fine without it now.

[0]: 682e6fafa4
2023-02-20 01:19:56 -05:00
Winter
759bd7b26f clippy: fix on darwin
As of Rust 1.67.0, the cargo-clippy binary now relies on the rustc_private
libraries [0], so let's do the RPATH fixup to it too.

I've also added a comment to explain the RPATH situation, as it took me
a bit to figure out.

[0]: https://github.com/rust-lang/rust-clippy/pull/9541
2023-02-20 01:19:56 -05:00
Sandro Jäckel
c90dcc7327 rustc: add ripgrep and wezterm to passthru.tests
ripgrep is a very popular grep replacement (similar to fd and find)
and wezterm is a popular terminal emulator which has a big codebase with
lots of features tested (it also broke in the past multiple times on
rustc upgrades.).
2023-02-20 01:16:58 -05:00
figsoda
5bc96030b0 rustc: 1.67.0 -> 1.67.1
Diff: https://github.com/rust-lang/rust/compare/1.67.0...1.67.1

Changelog: https://blog.rust-lang.org/2023/02/09/Rust-1.67.1.html
2023-02-10 06:55:18 +10:00