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

RUSTFLAGS undefine action #15300

Closed
starlitxiling opened this issue Mar 12, 2025 · 2 comments
Closed

RUSTFLAGS undefine action #15300

starlitxiling opened this issue Mar 12, 2025 · 2 comments
Labels
C-bug Category: bug S-triage Status: This issue is waiting on initial triage.

Comments

@starlitxiling
Copy link

Problem

I write .cargo/config.toml for my repo:

[target.aarch64-apple-darwin]
rustflags = [
    "-C", "link-arg=-mmacosx-version-min=${DEPLOYMENT_TARGET}",
    "-C", "link-arg=-isysroot",
    "-C", "link-arg=$(xcrun --sdk macosx --show-sdk-path)",
]

when i use cargo build {binary file name} --release,the compiled is failed.But when i use RUSTFLAGS="-v" cargo build {binary file name} --release,the compile is success.
I thought RUSTFLAGS="-v" is used to enable verbose output and does not change the variables during compilation, but why does the above line appear?

Steps

No response

Possible Solution(s)

No response

Notes

No response

Version

cargo 1.85.0
release: 1.85.0
host: aarch64-apple-darwin
libgit2: 1.8.4 (sys:0.19.0 system)
libcurl: 8.7.1 (sys:0.4.74+curl-8.9.0 system ssl:(SecureTransport) LibreSSL/3.3.6)
os: Mac OS 15.2.0 [64-bit]
@starlitxiling starlitxiling added C-bug Category: bug S-triage Status: This issue is waiting on initial triage. labels Mar 12, 2025
@weihanglo
Copy link
Member

RUSTFLAGS overrides the configuration from build.rustflags. See

And for "-C", "link-arg=$(xcrun --sdk macosx --show-sdk-path)", this won't work because rustflags will be passed to rustc directly. It won't get parsed by any shell program. See also

@weihanglo
Copy link
Member

Going to close this as the behavior is expected, and shell expansion support is discussed in #10789. If there is any reason this issue should keep open separately, let us know. Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: bug S-triage Status: This issue is waiting on initial triage.
Projects
None yet
Development

No branches or pull requests

2 participants