Skip to content
This repository has been archived by the owner on Jun 21, 2019. It is now read-only.

cargo install doesn't appear to respect .cargo/config #262

Closed
nipunn1313 opened this issue Apr 13, 2019 · 3 comments
Closed

cargo install doesn't appear to respect .cargo/config #262

nipunn1313 opened this issue Apr 13, 2019 · 3 comments

Comments

@nipunn1313
Copy link
Contributor

Seems slightly related to #62 - was looking into vendoring binaries recently
After running cargo vendor and updating the .cargo/config, I found that cargo build respects the config but cargo install --path . does not.

nipunn-mbp:cargo-vendor nipunn$ CARGO_HOME="" rustup run nightly cargo build --verbose
   Compiling proc-macro2 v0.4.27
     Running `rustc --crate-name build_script_build /Users/nipunn/src/cargo-vendor/vendor/proc-macro2-0.4.27/build.rs --color always --crate-type bin --emit=dep-info,link -C debuginfo=2 --cfg 'feature="default"' --cfg 'feature="proc-macro"' -C metadata=4e559f29eeacd560 -C extra-filename=-4e559f29eeacd560 --out-dir /Users/nipunn/src/cargo-vendor/target/debug/build/proc-macro2-4e559f29eeacd560 -L dependency=/Users/nipunn/src/cargo-vendor/target/debug/deps --cap-lints allow`

vs

nipunn-mbp:cargo-vendor nipunn$ CARGO_HOME="" rustup run nightly cargo install --path . --verbose --force
  Installing cargo-vendor v0.1.23 (/Users/nipunn/src/cargo-vendor)
   Compiling proc-macro2 v0.4.27
     Running `rustc --crate-name build_script_build /Users/nipunn/.cargo/registry/src/github.com-1ecc6299db9ec823/proc-macro2-0.4.27/build.rs --color always --crate-type bin --emit=dep-info,link -C opt-level=3 --cfg 'feature="default"' --cfg 'feature="proc-macro"' -C metadata=07d78daede35e699 -C extra-filename=-07d78daede35e699 --out-dir /Users/nipunn/src/cargo-vendor/target/release/build/proc-macro2-07d78daede35e699 -L dependency=/Users/nipunn/src/cargo-vendor/target/release/deps --cap-lints allow`

as a result, if we want to use a cargo installed binary, we have to do cargo build --release followed by copying the binary target over from target/release/{name} to a bin/ directory

According to comments on #62 - this is not how it used to work - though I don't remember exactly.

@nipunn1313
Copy link
Contributor Author

To repro the above example

https://github.com/alexcrichton/cargo-vendor
cd cargo-vendor
cargo vendor -x
# Update .cargo/config as requested

then compare these two

cargo build --verbose
cargo install --path . --verbose

@alexcrichton
Copy link
Owner

I think this may have recently been fixed in rust-lang/cargo#6804, can you try the latest nightly Cargo and see if it fixes the issue? (I think that change should have made its way to nightly by now)

@alexcrichton
Copy link
Owner

This crate is now included natively in Cargo as of rust-lang/cargo#6869 and today's nightly Rust. I'm closing all issues in this repository before I archive the repository, but if you're still interested in seeing this issue fixed then please feel free to file an issue with Cargo itself!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants