Skip to content

-Cprofile-use cannot find file depending on RUSTFLAGS order #128476

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

Open
TheIronBorn opened this issue Aug 1, 2024 · 1 comment
Open

-Cprofile-use cannot find file depending on RUSTFLAGS order #128476

TheIronBorn opened this issue Aug 1, 2024 · 1 comment
Labels
A-PGO Area: Profile-guided optimizations (PGO) C-bug Category: This is a bug. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@TheIronBorn
Copy link

I tried this code:

RUSTFLAGS="-Cprofile-use=$ABS_PATH -Cllvm-args=-pgo-warn-missing-function -Ctarget-cpu=native -Ztune-cpu=native -Clink-arg=-fuse-ld=lld -Zthreads=4 -Ccodegen-units=1 -Cpanic=abort -Clto=fat"
cargo build --release --target=<target>

and I get

  process didn't exit successfully: `<path>\bin\rustc.exe - --crate-name 
___ --print=file-names -Cprofile-use=<abs_path>
-Cllvm-args=-pgo-warn-missing-function -Ctarget-cpu=native -Ztune-cpu=native -Clink-arg=-fuse-ld=lld -Zthreads=4 -Ccodegen-units=1 
-Cpanic=abort -Clto=fat --target <target> --crate-type bin --crate-type rlib --crate-type dylib --crate-type cdylib 
--crate-type staticlib --crate-type proc-macro --print=sysroot --print=split-debuginfo --print=crate-name --print=cfg` (exit code: 1)
<snip>
  --- stderr
  error: file `<abs_path>` passed to `-C profile-use` does not exist

If I instead change the order of RUSTFLAGS, putting the PGO stuff at the end:

RUSTFLAGS="-Ctarget-cpu=native -Ztune-cpu=native -Clink-arg=-fuse-ld=lld -Zthreads=4 -Ccodegen-units=1 -Cpanic=abort -Clto=fat -Cprofile-use=<abs_path> -Cllvm-args=-pgo-warn-missing-function"

compilation succeeds

I have verified that the file exists. Both the path I provided and the path reported by the error. I even verified with Path::new(abs_path).exists()

I apologize that I couldn't find a more minimal example.

Meta

rustc --version --verbose:

rustc 1.82.0-nightly (f8060d282 2024-07-30)
binary: rustc
commit-hash: f8060d282d42770fadd73905e3eefb85660d3278
commit-date: 2024-07-30
host: x86_64-pc-windows-msvc
release: 1.82.0-nightly
LLVM version: 18.1.7
@TheIronBorn TheIronBorn added the C-bug Category: This is a bug. label Aug 1, 2024
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Aug 1, 2024
@jieyouxu jieyouxu added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Aug 13, 2024
@jieyouxu
Copy link
Member

Possibly related: #63609

@jieyouxu jieyouxu added the A-PGO Area: Profile-guided optimizations (PGO) label Aug 13, 2024
@saethlin saethlin removed the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Sep 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-PGO Area: Profile-guided optimizations (PGO) C-bug Category: This is a bug. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

4 participants