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

Install creusot-rustc in a toolchain-dependent location #1314

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Lysxia
Copy link
Collaborator

@Lysxia Lysxia commented Jan 14, 2025

Fixes #671.

Problem: creusot-rustc is dynamically linked with rustc_driver, so it can't be run
directly from the command line because it can't find its dependencies alone.

Solution: Putting it in a special directory controlled by Creusot:

  1. removes it from $PATH, suppressing the temptation to run it from the command line
  2. allows cargo-creusot to detect incomplete upgrades (this prevents
    an obscure dynlink error if one updates the toolchain that creusot depends
    on and only reinstalls one of cargo-creusot or creusot-rustc).

The installation of creusot-rustc is now handled by cargo creusot setup install.

@Lysxia Lysxia force-pushed the install-creusot-rustc branch from e290461 to 5982b9d Compare January 14, 2025 15:14
@arnaudgolfouse
Copy link
Collaborator

So I see that the rust toolchain version is now fully built-in inside cargo-creusot, does that mean that creusot will work even if the user does not explicitly set a version with a rust-toolchain file? I'm on the fence on whether this is desirable or not, since this mean you could do the following:

  • build with creusot, everything works
  • try to build with rustc, things break because of nightly features

Also I can see this confusing rust-analyzer, although this is probably ok now that creusot has its own target directory.

@Lysxia
Copy link
Collaborator Author

Lysxia commented Jan 17, 2025

I was hoping that things would "just work" in simple cases, but now that you mention it, we can't even build creusot-contracts on a stable toolchain. I'm going to open an issue about it.

Problem: creusot-rustc is dynamically linked with rustc_driver, so it can't be run
directly from the command line because it can't find its dependencies alone.

Solution: Putting it in a special directory controlled by Creusot:
1. removes it from $PATH, suppressing the temptation to run it from the command line
2. allows cargo-creusot to detect incomplete upgrades (this prevents
   an obscure dynlink error if one updates the toolchain that creusot depends
   on and only reinstalls one of cargo-creusot or creusot-rustc).

The installation of creusot-rustc is now handled by `cargo creusot setup install`.
@Lysxia Lysxia force-pushed the install-creusot-rustc branch from 5982b9d to 5f5a799 Compare January 20, 2025 09:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Investigate reporting a nicer error when failing to dynamically link rustc_driver
2 participants