Giter Club home page Giter Club logo

Comments (16)

solson avatar solson commented on July 20, 2024 1

@canndrew I was worried that the RUST_SYSROOT issue would be affecting anyone who tried Miri, but I think it still just affects non-rustup users. Based on rust-lang/rust#39578 I gather you're yet another NixOS user who can't use rustup (like me)?

I should probably try the build.rs approach I mentioned since there are at least 4 NixOS users I can think of interested in building Miri now...

from miri.

oli-obk avatar oli-obk commented on July 20, 2024

@aochagavia: did you install rust via rustup? That should set those env vars automatically.

from miri.

aochagavia avatar aochagavia commented on July 20, 2024

I compiled it manually with cargo debug. Maybe we could document this under a "Contributing" subsection or something like that?

from miri.

oli-obk avatar oli-obk commented on July 20, 2024

We should actually remove those hacks and move to

let sysroot = std::process::Command::new("rustc")
        .arg("--print")
        .arg("sysroot")
        .output()
        .expect("rustc not found")
        .stdout;
let sysroot = std::str::from_utf8(&sysroot).expect("sysroot is not utf8").trim();
let sysroot = &Path::new(&sysroot);

from miri.

aochagavia avatar aochagavia commented on July 20, 2024

This doesn't work for me. Even trying to compile run the program below results in an error because it cannot find std.dll.

extern crate miri;
fn main() { }

from miri.

oli-obk avatar oli-obk commented on July 20, 2024

I played around on windows. Setting those env vars has zero effect for me. Instead the issue is

Are you sure you didn't misdiagnose this in the main post and accidentally set the PATH variable, too?

Even trying to compile the program below results in an error

I can compile this fine, but running also gives me the error about std.dll

from miri.

aochagavia avatar aochagavia commented on July 20, 2024

I can compile this fine, but running also gives me the error about std.dll

Oops... I meant run! It compiles fine.

from miri.

aochagavia avatar aochagavia commented on July 20, 2024

Setting those env vars has zero effect for me.

You are right. I just tested it again and it didn't work.

from miri.

canndrew avatar canndrew commented on July 20, 2024

I can't figure out the environment variables to run the tests either. I've installed rust master from git, rustc --print sysroot gives me /home/shum/.local. If I export RUST_SYSROOT=/home/shum/.local then cargo test still complains error[E0463]: can't find crate for `std` .

from miri.

solson avatar solson commented on July 20, 2024

I set RUST_SYSROOT to the result of rustc --print sysroot before compiling Miri. I'd like to make this simpler, but I'm confused by the whole sysroot situation and it hasn't been a priority.

from miri.

solson avatar solson commented on July 20, 2024

Maybe we could use a build.rs script to run rustc --print sysroot and save it somewhere the Miri build can include_str!() it from rather than using a build-time environment variable?

from miri.

canndrew avatar canndrew commented on July 20, 2024

I set RUST_SYSROOT to the result of rustc --print sysroot before compiling Miri.

Yep, that works.

from miri.

canndrew avatar canndrew commented on July 20, 2024

I gather you're yet another NixOS user who can't use rustup (like me)?

Yep :)

Maybe we could use a build.rs script to run rustc --print sysroot and save it somewhere the Miri build can include_str!() it from rather than using a build-time environment variable?

Seems unfortunate to have the path baked-in at compile time but I don't have a better suggestion.

from miri.

solson avatar solson commented on July 20, 2024

I suppose we could run rustc --print sysroot at runtime. The important thing, I think, is that it uses the sysroot of the rustc that miri was built with.

from miri.

RalfJung avatar RalfJung commented on July 20, 2024

Initialization has moved quite a bit, is this still a problem?

from miri.

RalfJung avatar RalfJung commented on July 20, 2024

This issue actually asks two questions:

  • How can miri find the necessary libraries it needs at run-time when not running in rustup? This is now taken care of by the ./miri script; a ./miri install will install a Miri that has the rpath set appropriately.
  • How does miri find its "default" sysroot if there is no rustup during build? The answer is to set RUST_SYSROOT.

So, also based on the fact that nobody responded to my question from almost a year agi, I am going to close this.

from miri.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.