Commit Graph

144 Commits

Author SHA1 Message Date
Alyssa Ross
adb54ab7bd rustc: remove unused argument 2023-05-22 21:46:08 +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]
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
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
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
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
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
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
Vladimír Čunát
52bef35053
Merge #213694: Revert "rustc: add note about libiconv dependency"
...into staging-next
2023-02-05 15:37:02 +01:00
Winter
1e814042af rustc, cargo: add rust team to maintainers 2023-01-31 18:10:08 +10:00
Winter
ede7b1d98a Revert "rustc: add note about libiconv dependency"
This reverts commit edfbbaf282.

I mistakingly believed that once 1.66.0 was used to bootstrap, we'd be
able to remove libiconv from rustc's build-time dependency tree on Darwin.
Sadly, this isn't the case, because src/tools/bootstrap depends on libc.

Additionally, it seems that my assessment in b1834a461e
was wrong -- *any* dependency on `libc` will cause a requirement on
libiconv, due to rustc unconditionally linking every library specified
in `link` directives, no matter if the function is actually used.

This was worked around somewhat in https://github.com/rust-lang/libc/pull/2944
by not linking libiconv if libc is only a dependency of std, but this
doesn't apply when `libc` is a dependency of anything else.

Maybe one day we'll just rip out libiconv from `libc` entirely (or hide it
behind a feature flag), but for now, we can just keep it in `buildRustPackage`'s
`buildInputs` by default.
2023-01-30 21:13:05 -05:00
Winter
8442601c64 rust: fix on aarch64-linux by using GCC 11 and passing -lgcc
This change switches to using GCC 11 by default on aarch64-linux, as well as passing `-lgcc` to the linker, per #201485.

See #201254 and #208412 for wider context on the issue.
2023-01-04 18:15:20 -05:00
Winter
edfbbaf282 rustc: add note about libiconv dependency 2022-12-23 13:56:08 -05:00
Winter
b1834a461e Revert "rustc: propagate libiconv on darwin"
This reverts commit b6fc00b8f4.

Rust 1.66.0 contains a fix for libiconv being linked unconditionally on macOS, but this only applies to packages that don't depend on older versions of `libc`.

For now, let's go back to including libiconv in `buildInputs` by default for packages that use `buildRustPackage`. As packages bump their `libc` versions, we can eventually stop including it by default, and manually add it where needed.
2022-12-23 13:55:46 -05:00
github-actions[bot]
4b05cc6f66
Merge master into staging-next 2022-11-02 12:01:31 +00:00
Georges Dubus
2c039bba78 rustc: removing madjar as maintainer 2022-11-02 10:53:55 +01:00
Alyssa Ross
f989817c8d rustc: add build stdenv.cc dependency
This is required when cross-compiling, as otherwise the build will
fail due to the missing cc program.
2022-10-16 19:09:09 +02:00
Alyssa Ross
ada5320ea3 rustc: add missing xz dependency
The "bootstrap" and "installer" crates depend on lzma-sys, which will
build its own version of xz if it can't find the liblzma.pc through
pkg-config.  Even though it's used as a library, xz here is a native
build input, as it is used by the build system rather than the end
product.
2022-10-16 19:09:09 +02:00
Vladimír Čunát
6565abc264
Merge branch 'master' into staging-next 2022-10-08 10:20:07 +02:00
Alex Martens
bac7ee3208 rustc: fix build for no_std targets 2022-10-07 07:35:29 -07:00
zowoq
0be05bd970 rustc: fix building emulated x86_64-darwin with jemalloc on aarch64-darwin
Co-authored-by: Randy Eckenrode <randy@largeandhighquality.com>
Co-authored-by: Uri Baghin <uri@canva.com>
Co-authored-by: Winter <winter@winter.cafe>
2022-09-30 12:33:18 +10:00
zowoq
164865d98e Revert "Revert "rustc: build with jemalloc""
This reverts commit 539762709b.

the x86_64-darwin on aarch64-darwin emulation issue was fixed by setting JEMALLOC_SYS_WITH_LG_VADDR
2022-09-30 12:33:18 +10:00
Vladimír Čunát
292756e9ff
Merge #190093: rustc: propagate libiconv on darwin
...into staging
2022-09-28 09:45:11 +02:00
zowoq
539762709b Revert "rustc: build with jemalloc"
This reverts commit 2a699029f4.

hopefully this fixes building x86_64-darwin under emulation on aarch64-darwin
2022-09-22 07:11:33 -04:00
Winter
b6fc00b8f4 rustc: propagate libiconv on darwin
Rust binaries are unconditionally linked to libiconv on Darwin (see https://github.com/rust-lang/libc/issues/2870). We already add it as a dependency in `buildRustPackage`, so let's go a step further and propagate it.
2022-09-06 23:17:56 -04:00
zowoq
9c26b06a5d rustc: add passthru.tests
we expect these to be built as part of rust version bumps
2022-08-29 08:12:23 +10:00
Yureka
202524ddf7 rustc: remove broken flag for musl
It builds!
2022-08-13 15:23:06 +02:00
Yureka
0a9c3640d3 rustc: set crt-static flag
The crt-static option selects if the C runtime is linked dynamically or
statically into the resulting binaries.

There is a default value of this setting for each platform, but it is
not always what we want. For example, musl targets are assumed to always
have the C runtime linked statically, but we support both.

In practise, this fixes an error in the pkgsMusl.rustc build:
> cannot produce dylib for `rustc_driver v0.0.0 (/build/rustc-1.63.0-src/compiler/rustc_driver)` as the target `x86_64-unknown-linux-musl` does not support these crate types
2022-08-13 15:19:22 +02:00
Alyssa Ross
6f9359a504 rustc: mark broken for dynamic Musl target 2022-07-02 09:04:37 +00:00
Nick Cao
be29f4575e
rustc: expose correct llvmPackages for cross compile 2022-05-13 06:40:43 +08:00
misuzu
2a699029f4 rustc: build with jemalloc
This change should fix intermittent crashes on macOS Monterey.

Co-authored-by: Pavol Rusnak <pavol@rusnak.io>
2021-12-30 17:45:08 +02:00
Martin Weinelt
c28e3f9d00
rustc: Expose llvmPackages set used to build rustc
Reusing the same llvmPackages version used for building rustc is
required for LTO in Firefox.
2021-11-02 17:34:05 +01:00
Alyssa Ross
181f012824 rustc: don't install uninstall.sh 2021-06-18 13:58:16 +00:00
Pavol Rusnak
252bf94a74 rust: 1.51.0 -> 1.52.0 2021-05-08 11:42:10 -07:00
John Ericson
50b6631929 rustc: Fix build
Thanks @jonringer for catching, and sorry I didn't myself!
2021-04-30 23:09:15 -07:00
volth
bc0d605cf1 treewide: fix double quoted strings in meta.description
Signed-off-by: Ben Siraphob <bensiraphob@gmail.com>
2021-01-24 19:56:59 +07:00
Ben Siraphob
acc5f7b18a pkgs/development/compilers: stdenv.lib -> lib 2021-01-23 08:57:37 +07:00
Jonathan Ringer
9bb3fccb5b treewide: pkgs.pkgconfig -> pkgs.pkg-config, move pkgconfig to alias.nix
continuation of #109595

pkgconfig was aliased in 2018, however, it remained in
all-packages.nix due to its wide usage. This cleans
up the remaining references to pkgs.pkgsconfig and
moves the entry to aliases.nix.

python3Packages.pkgconfig remained unchanged because
it's the canonical name of the upstream package
on pypi.
2021-01-19 01:16:25 -08:00
Luka Blaskovic
c73d96f776 rustc: cleanup, use correct llvm version 2020-12-14 15:14:03 +00:00
github-actions[bot]
11d68e6adb
Merge staging-next into staging 2020-12-13 00:42:45 +00:00
Ben Wolsieffer
5a923e552c rustc: add host platform to --target when building cross-compiler
As of 1.48, std is only built for platforms in --target. If the host platform is
not included, the resulting rustc can't compile build.rs scripts.
2020-12-12 15:24:55 -05:00
Jörg Thalheim
650db4a0db
Merge pull request #106284 from raboof/rustc-deterministic-manifest 2020-12-08 09:47:33 +00:00
Arnout Engelen
b909a333ad
rustc: generate deterministic manifest
The order of the entries in the manifest generated while installing
rustc depends on the (parallel) build, so let's sort it to make it
deterministic. Also remove install.log from the output.

Co-Authored-By: Jörg Thalheim <joerg@thalheim.io>
2020-12-07 23:02:09 +01:00
John Ericson
47b99769f9 rustc: Improve musl support
There was a slight error in the target logic I didn't notice before, and
also should do the same thing for the other platforms.
2020-12-02 15:30:51 +00:00
John Ericson
5d75fe4ed0
Merge pull request #105314 from lopsided98/rustc-musl-target
rustc: allow building for musl targets
2020-11-29 00:39:36 -05:00
Ben Wolsieffer
2857455b03 rustc: allow building for musl targets 2020-11-28 22:15:35 -05:00