Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cargo-zigbuild ignores the CARGO environment variable #163

Closed
dmitrii-ubskii opened this issue Aug 23, 2023 · 3 comments
Closed

cargo-zigbuild ignores the CARGO environment variable #163

dmitrii-ubskii opened this issue Aug 23, 2023 · 3 comments

Comments

@dmitrii-ubskii
Copy link

If cargo is not present in PATH, zigbuild (when run directly) fails with "Failed to run cargo build: No such file or directory (os error 2)", even if CARGO [1] is set correctly. This appears to be a bug in cargo-options [2], but since that is a tiny package, I'm also reporting it here. Cf. messense/cargo-options#8

[1] https://doc.rust-lang.org/cargo/reference/environment-variables.html
[2] https://github.com/messense/cargo-options/blob/main/src/common.rs#L167

@messense
Copy link
Member

See cross-rs/cross#864 (comment)

@dmitrii-ubskii
Copy link
Author

See cross-rs/cross#864 (comment)

Can't reproduce:

$ cargo run                                                                       
   Compiling env-test v0.1.0 (/Users/dmitriiubskii/workspace/misc/env-test)
    Finished dev [unoptimized + debuginfo] target(s) in 0.44s
     Running `target/debug/env-test`
env::var_os("CARGO")=Some("/Users/dmitriiubskii/.rustup/toolchains/stable-aarch64-apple-darwin/bin/cargo")
env::var("CARGO")=Ok("/Users/dmitriiubskii/.rustup/toolchains/stable-aarch64-apple-darwin/bin/cargo")

$ CARGO=~/Downloads/cargo cargo run                                               
   Compiling env-test v0.1.0 (/Users/dmitriiubskii/workspace/misc/env-test)
    Finished dev [unoptimized + debuginfo] target(s) in 0.50s
     Running `target/debug/env-test`
env::var_os("CARGO")=Some("/Users/dmitriiubskii/Downloads/cargo")
env::var("CARGO")=Ok("/Users/dmitriiubskii/Downloads/cargo")

$ CARGO=cargo cargo run 
    Finished dev [unoptimized + debuginfo] target(s) in 0.00s
     Running `target/debug/env-test`
env::var_os("CARGO")=Some("/Users/dmitriiubskii/workspace/misc/env-test/cargo")
env::var("CARGO")=Ok("/Users/dmitriiubskii/workspace/misc/env-test/cargo")

Granted, running CARGO=cross cargo run does print my ~/.rustup/... cargo path, but that's because cross isn't a valid path. The CARGO=cargo example uses the cargo file in the pwd.

@messense
Copy link
Member

messense commented Dec 3, 2023

Fixed in messense/cargo-options@e620e56.

@messense messense closed this as completed Dec 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants