mozilla/rust — Issue #1806: running cargo from build dir can't find rustc
Author: erickt
Created: 2012-02-10 17:48:31+00:00
State: open

cargo is relying on the `$PATH` to find rustc, but if one runs cargo with `x86_64-apple-darwin/stage2/lib/rustc/x86_64-apple-darwin/bin/cargo install tnetstring`, cargo will error out with the unhelpful:

info: Installing with git from https://github.com/erickt/rust-tnetstring...
Cloning into '/Users/etryzelaar/Projects/rust/rust/.cargo/work/0UNNtyDTAsQQT2J1'...
remote: Counting objects: 36, done.
remote: Compressing objects: 100% (25/25), done.
remote: Total 36 (delta 14), reused 30 (delta 8)
Unpacking objects: 100% (36/36), done.
error: rustc failed: 1

cargo should detect this and return a proper error message for this. A proper workaround for this is to make sure that `$PATH` has an absolute path to the binaries set, as in:

export PATH=x86_64-apple-darwin/stage2/lib/rustc/x86_64-apple-darwin/bin:$PATH

It needs to be absolute because cargo does a chdir to the build directory, which would break a relative path.