Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rustowl crashes when another Rust toolchain version is used #10

Open
siketyan opened this issue Feb 9, 2025 · 13 comments
Open

rustowl crashes when another Rust toolchain version is used #10

siketyan opened this issue Feb 9, 2025 · 13 comments
Labels
documentation Improvements or additions to documentation enhancement New feature or request

Comments

@siketyan
Copy link

siketyan commented Feb 9, 2025

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)
@cordx56
Copy link
Owner

cordx56 commented Feb 9, 2025

@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!

@dougg0k
Copy link

dougg0k commented Feb 13, 2025

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.

@dougg0k
Copy link

dougg0k commented Feb 13, 2025

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

@dpc
Copy link

dpc commented Feb 13, 2025

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.

@cordx56 cordx56 added documentation Improvements or additions to documentation enhancement New feature or request labels Feb 14, 2025
@cordx56
Copy link
Owner

cordx56 commented Feb 14, 2025

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.

@dougg0k
Copy link

dougg0k commented Feb 14, 2025

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.

rust-lang/rustup#2696

@cordx56
Copy link
Owner

cordx56 commented Feb 14, 2025

I think so that. this related to #19

@hzbd
Copy link

hzbd commented Feb 16, 2025

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)

@cordx56
Copy link
Owner

cordx56 commented Feb 16, 2025

hmm, it seems to be right.
Are you installed rustup via official script?

@kaplanelad
Copy link

I'm also getting this error

@alichnerowicz-splunk
Copy link

alichnerowicz-splunk commented Feb 18, 2025

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

@cordx56
Copy link
Owner

cordx56 commented Feb 18, 2025

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.

@alichnerowicz-splunk
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

7 participants