-
Notifications
You must be signed in to change notification settings - Fork 12
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
Smir demo #74
Smir demo #74
Conversation
@oli-obk let me know if it would make sense to add this demo here. I was thinking we could use it as the base to a little "Get Started" document. If we decide to move ahead, I will probably change the workflow to also run nightly against the newest rustc version like the other workflows. |
// Add rustup to the rpath in order to properly link with the correct rustc version. | ||
let rustup_home = env::var("RUSTUP_HOME").unwrap(); | ||
let toolchain = env::var("RUSTUP_TOOLCHAIN").unwrap(); | ||
let rustc_lib: PathBuf = [&rustup_home, "toolchains", &toolchain, "lib"] | ||
.iter() | ||
.collect(); | ||
println!( | ||
"cargo:rustc-link-arg-bin=smir-demo=-Wl,-rpath,{}", | ||
rustc_lib.display() | ||
); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this something all users need to do? Can we do anything on the rustc side to make this simpler?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think users have to do this if they want to be able to invoke their binaries directly. If you run the program under cargo or rustup run, it should configure the environment correctly for you.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I.e.: if you remove this build file, the following still works:
$ cargo run -- --help
But if you run the binary directly:
$ ./target/debug/smir-demo --help
./target/debug/smir-demo: error while loading shared libraries: librustc_driver-a03ea465d8e03db1.so: cannot open shared object file: No such file or directory
Add a little demo that I've been preparing for the Rust Verification Workshop that could be a good example on how to start using StableMIR.