Closed fneddy closed 6 years ago
As of today it is not possible to use a pre-compiled version of rustc.
I do not think the team behind rust would be willing to ship a custom rustc and I am not the right person to ask.
@fneddy , Would making a Nix expression to provide a proper environment solves your issue?
@nbp Since HolyJIT (at the moment) only needs a single patch to work (https://github.com/nbp/rust/commit/9e0d95e315ca44a2f75da8370b64b890db3b39e7), it doesn't seem like it would require too much maintenance effort if it were upstreamed - have to tried to talk to Rust people about that? Of course, if you know you'll need more rustc patches in the future, this might not be worth it just yet.
Unfortunately, even the patched rustc tree linked in the readme fails to compile (And issues on that repo are disabled, probably because it's a fork.)
I am on the patched commit, nbp/rust@9e0d95e315ca44a2f75da8370b64b890db3b39e7, however
Rust seems to fail when doing vendored builds, due to incorrectly detecting sudo. This is fixed by unsetting all environment variables containing ./x.py build
fails to update the Cargo registry.SUDO
in the name.
Unfortunately, the example fails to build due to differences in compiler internals regardless if I use rustc from commit 9e0d95, or if I apply that patch to the current rust master branch.
The way I am working today is using the binary which is in build/x86_64-unknown-linux-gnu/stage2/bin/
.
I am using the rustc nightly from 2017-05-30 to build it.
@mateon1 The correct way is to build the forked repo (nbp/rust).
Your dynasm build failure seems to happen because 5 days ago, @CensoredUsername released dynasm 0.1.3 on crates.io (but it seems that the repo wasn't updated, might want to fix that if you read this), which broke something. Since dynasm is itself a compiler plugin, it frequently needs to be updated to an up-to-date nightly. Fixing its version in the Cargo.toml might be required.
@mateon1 Try building #17 with the first rustc you've built (nbp/rust@9e0d95e)
@jonas-schievink Thanks for investigating this issue. I remove my Cargo.lock and was able to reproduce the compilation issues.
I just pushed a patch to downgrade dynasm to 0.1.1 and serde_derive to 1.0.12. You should be able to build against the old version of rustc now.
@jonas-schievink I discussed multiple times on the rustc irc channel, and the plugin approach is (was?) a no-go for the compiler team, as it exposes internals of the compiler which would never be stabilized.
I do not intent to add any additional patches to rustc at the moment, and I do not think this would be necessary.
This patch is a mutated version of a feature which used to be in the compiler, and got remove earlier this year by @nagisa and @nikomatsakis in https://github.com/rust-lang/rust/pull/40239 after I mentioned that I might rely on this interface for making this prototype. One of the reason of the removal of the feature, was to be able to break the API, and avoid stabilizing the MIR. Thus, unless the publication of this project can changed the whole story, I think I will have to find a different way of doing so.
I intent to discuss this topic in-person mid-December with @nikomatsakis and also some persons responsible of Rust integration in Firefox such as @bholley and @glandium.
Ah, that makes sense, I vaguely remember that PR.
@jonas-schievink whoops, thanks for the reminder. Dynasm 0.1.3 should be pushed now.
This issue is mostly fixed by https://github.com/nbp/holyjit/commit/bfb32d6cb7b7b57213270efa2bc6ef8e0a6e63b9 which converts HolyJit to a rustc-driver instead of a compiler plugin, which implies that we no longer depend on a patched version of rustc.
As of this commit, HolyJit is now based on a non-patched version of rustc (the nightly version from 2018-02-19), which should make this project more accessible for everybody.
The version of rustc on which HolyJit is based can be found in the release.nix file at the top-level. This script is using the rust overlay from nixpkgs-mozilla. I personally use it as follow:
$ nix-shell ~/rust/holyjit/release.nix -A holyjit
nix-shell$ cargo build --all
nix-shell$ cargo build --example brainfuck
nix-shell$ cargo run --example brainfuck
needing to recompile a custom version of rustc is very discouraging and inconvenient.
Is it possible to make this work on stable/beta/nightly? is it possible to install the custom rustc via rustup and switch to it only when working on this?