Giter Club home page Giter Club logo

Comments (4)

mrivnak avatar mrivnak commented on June 17, 2024

Also, specifying a target in the rust-toolchain.toml file will automatically download the target when you run cargo build so perhaps cargo could do the same when specifying a target via the command line.

from cargo.

weihanglo avatar weihanglo commented on June 17, 2024

On a vacation so the reply may be quite shallow.

Also, specifying a target in the rust-toolchain.toml file will automatically download the target when you run cargo build so perhaps cargo could do the same when specifying a target via the command line.

In this case, the download is done by rustup. cargo being called is actually a wrapper (aka proxy) provided by rustup, and then rustup delegates to the real cargo binary. On this point, Cargo doesn't know whether a platform target is available or not.

Even if a target is installed and available, it can still fail during the compilation when some system tools are missing. For example, rustc can build wasm32-unknown-emscripten very well until it needs emcc to link to other C libs. Checking the availbility of a target is not sufficient to ensure a platform target to build.

I don't have a good idea for now, but always welcome any improvement in error messages.

from cargo.

epage avatar epage commented on June 17, 2024

When you add a target, that just means rust-std is installed. We still call into the same compiler. So this likely being discovered late in the build process when it sees you using features and can't find what to link against. I suspect that improving the error message would be something rustc would have to do, if it can even do it.

As for cargo vs rustup, something to add to the above is all of this needs to work without rustup as that is an optional package. Even if we made it required there are restrictions on what we could do within certain environments the Rust project targets that we would have to carefully evaluate.

from cargo.

mrivnak avatar mrivnak commented on June 17, 2024

Thank you for your responses. I think minimally it would be nice to have the rustup cargo proxy handle the --target option the same as it does for targets in rust-toolchain.toml. As for a warning in the build process yeah it seems like that would just be a rustc thing then, and a special case for rust-std.

from cargo.

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.