-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Description
TL;DR: I spent multiple hours trying to figure out why I couldn't cargo install some tools. It turned out that the reason I couldn't was because, unbeknownst to me, cargo install was trying to build the tools for the wrong target due to .cargo/config in my project directory!
Full explanation
- My project has a
.cargo/configfile to build for a wasm target triple since my project is wasm only:
[build]
target = "wasm32-unknown-emscripten"
-
I ran
cargo install cargo-webfrom my project's working directory. It failed due to a bunch of obscure errors about dependencies being unable to compile. This made me think the dependencies had been really broken, which gave me a really sour taste in my mouth for Rust. -
After cloning the dependencies and trying to fix them, I finally realized:
cargo install cargo-webis for some reason building forwasm32-unknown-emscriptenon my system! 😢
As it turned out, cargo install is respecting my project's .cargo/config target triple.
What I expected
I think that cargo install should ignore the target triple specified in a project directory.
I imagine that at some point or another, most users developing projects primarily targeting wasm/asmjs will run into this issue, and it is incredibly annoying to debug.
I'm using:
$ cargo --version
cargo 1.27.0-nightly (0a1add2d8 2018-04-20)