rustowl crashes when another Rust toolchain version is used
On my setup, running cargo-owl immediately crashes with the following error, while the normal cargo check command runs successfully:
❯ rustup run stable cargo owl
error: process didn't exit successfully: `/Users/siketyan/.cargo/bin/rustowlc /Users/siketyan/.rustup/toolchains/stable-aarch64-apple-darwin/bin/rustc -vV` (signal: 6, SIGABRT: process abort signal)
--- stderr
dyld[43086]: Library not loaded: @rpath/librustc_driver-c18e4301379fb818.dylib
Referenced from: <788115DD-9822-34DB-9A24-896C6AA2016E> /Users/siketyan/.cargo/bin/rustowlc
Reason: tried: '/Users/siketyan/.rustup/toolchains/stable-aarch64-apple-darwin/lib/librustc_driver-c18e4301379fb818.dylib' (no such file), '/Users/siketyan/lib/librustc_driver-c18e4301379fb818.dylib' (no such file), '/usr/local/lib/librustc_driver-c18e4301379fb818.dylib' (no such file), '/usr/lib/librustc_driver-c18e4301379fb818.dylib' (no such file, not in dyld cache)
Also I tried running cargo check with the rustowlc wrapper directly, but got the same error:
❯ RUSTC_WORKSPACE_WRAPPER=(which rustowlc) cargo check
error: process didn't exit successfully: `/Users/siketyan/.cargo/bin/rustowlc /Users/siketyan/.rustup/toolchains/stable-aarch64-apple-darwin/bin/rustc -vV` (signal: 6, SIGABRT: process abort signal)
--- stderr
dyld[43086]: Library not loaded: @rpath/librustc_driver-c18e4301379fb818.dylib
Referenced from: <788115DD-9822-34DB-9A24-896C6AA2016E> /Users/siketyan/.cargo/bin/rustowlc
Reason: tried: '/Users/siketyan/.rustup/toolchains/stable-aarch64-apple-darwin/lib/librustc_driver-c18e4301379fb818.dylib' (no such file), '/Users/siketyan/lib/librustc_driver-c18e4301379fb818.dylib' (no such file), '/usr/local/lib/librustc_driver-c18e4301379fb818.dylib' (no such file), '/usr/lib/librustc_driver-c18e4301379fb818.dylib' (no such file, not in dyld cache)
I believe rustowl is built on the nightly-2024-10-31 toolchain, so I tried also running rustowlc on the same toolchain and it works:
❯ RUSTC_WORKSPACE_WRAPPER=(which rustowlc) cargo +nightly-2024-10-31 check
...
Finished `dev` profile [unoptimized + debuginfo] target(s) in 44.89s
Although there is a limitation that the running toolchain version must match the building toolchain, the current behaviour is a bit confusing. It will be great if the cargo-owl wrapper checks the toolchain version, or to be documented in README at least.
My Environment:
- macOS 15.3 24D60 arm64
- cargo 1.84.1 (66221abde 2024-11-19)
@siketyan Thank you for trying RustOwl!
RustOwl utilizes private functions of the Rust compiler rustc.
As a result, rustowlc first attempts to link a dynamic library.
This requires the rustc_driver library for nightly-2024-10-31 and cannot proceed until the linkage is complete.
Due to limitations in using the rustc API, RustOwl requires a specific nightly and fixed toolchain version.
Therefore, rustowlc cannot provide a prompt.
Additionally, users must set up cargo with rustup to switch toolchains automatically.
This is already documented in the README.
We will display a prompt when running cargo owl and document this behavior accordingly.
Thank you!
I was going to open another issue to suggest adding a check to know whether rustup / rust is already installed.
https://github.com/cordx56/rustowl/blob/main/rustowl/install.sh#L6
Because I use another tool to install it, and this could end up installing again in a different path or maybe even conflict with it.
Also, I installed the tool only by using these two commands, instead of the script.
rustup toolchain install nightly-2024-10-31 --component rust-src rustc-dev llvm-tools-preview
cargo +nightly-2024-10-31 install --locked --git https://github.com/cordx56/rustowl
❯ cargo install --list | grep owl
rustowl v0.1.1 (https://github.com/cordx56/rustowl#37f63146):
cargo-owl
cargo-owlsp
rustowlc
Does rustowl require the artifacts that were built in ./target/ to be produced by the same compiler version?
At least on Nix, it should be relatively easy to bundle rustowl binary with exactly same toolchain version it requires, so I wonder if spending time attempting it is worth it.
Also, I installed the tool only by using these two commands, instead of the script.
rustup toolchain install nightly-2024-10-31 --component rust-src rustc-dev llvm-tools-preview cargo +nightly-2024-10-31 install --locked --git https://github.com/cordx56/rustowl
Thank you for your opinion!
I feel that the toolchain should be specified in a single place, which is currently rustowl/rust-toolchain.toml.
Currently, it doesnt seem to be possible to read from toolchain.toml when installing through cargo install. If that were possible, it would help in not need the additional comand or many others.
https://github.com/rust-lang/rustup/issues/2696
I think so that. this related to #19
I'm a Rust beginner. Did I make any configuration errors?
$ git clone [email protected]:cordx56/rustowl.git
$ cd rustowl/rustowl
➜ rustowl git:(main)$ cargo install --path . --locked
info: syncing channel updates for 'nightly-2024-10-31-x86_64-apple-darwin'
error: no release found for 'nightly-2024-10-31'
➜ rustowl git:(main)$ rustup toolchain list
stable-x86_64-apple-darwin
nightly-x86_64-apple-darwin (default)
➜ rustowl git:(main)$ rustc --version
rustc 1.86.0-nightly (a567209da 2025-02-13)
hmm, it seems to be right.
Are you installed rustup via official script?
I'm also getting this error
Had same error one I installed via official script. The toolchain was downloaded, and I can see it on the list, but maybe it wasn't used to actually compile rustowl?
> rustup toolchain list
stable-aarch64-apple-darwin
nightly-2024-10-31-aarch64-apple-darwin
nightly-aarch64-apple-darwin (default)
because when I later manually compiled it:
> git clone https://github.com/cordx56/rustowl.git
> cd rustowl/rustowl
> rustup default nightly-2024-10-31-aarch64-apple-darwin
> cargo install --path . --locked
like hzbd said above, everything works now.
the only fail here is that the 2024-10-31 version does not have edition2024 which I started using (for no specific reason, but why use nightly if not for staying on the bleeding edge:) and now I had to remove it from Cargo.toml
The rustc_private feature, which RustOwl heavily relies on, requires a nightly toolchain.
If you set up rustup using the official Rust script, the toolchain will be selected automatically.
I am unable to debug it further, but I see that toolchain was installed when running install.sh script, BUT I suspect it was not used to compile rustowl and instead the one I had as default was -- which happened to be nightly too, just latest.
However it happened, after installing via script cargo-owl was crashing, after manually setting up nightly-2024-10-31-aarch64-apple-darwin as default, and recompiling, it works.
🤖 Bot: Issue has not seen activity in 30 days and will therefore be marked as stale. It will be closed in 7 days if no further response is found.
Maybe this problem is already fixed in the process of other enhancements. We made so many changes since this issue was created.
Can we close this issue?