Unable to use `profile-generate` when cross-compiling for `x86_64-pc-windows-gnu` on Linux.
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 119k
- Forks
- 16.1k
- PR merge metrics
- PR metrics pending
Description
When using either of the x86_64-unknown-linux-gnu toolchains (from rustup) with the x86_64-pc-windows-gnu target added, cross-compiling for x86_64-pc-windows-gnu with profile-generate enabled fails:
$ rustc --target x86_64-pc-windows-gnu -C profile-generate=pgo main.rs
error[E0463]: can't find crate for `profiler_builtins`
|
= note: the compiler may have been built without the profiler runtime
If the compiler used is built with the following in bootstrap.toml:
[build]
profiler = true
target = ["x86_64-pc-windows-gnu"]
Then the build succeeds, but (after running the instrumented binary in wine) the generated profile data is malformed, and attempting to merge it with llvm-profdata fails:
$ llvm-profdata merge -o pgo/merged.profdata pgo
warning: pgo/default_13971159156524030339_0.profraw: malformed instrumentation profile data: symbol name is empty
error: no profile can be merged
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the failure with the x86_64-unknown-linux-gnu toolchain, the x86_64-pc-windows-gnu target, and -C profile-generate=pgo; compare this with a compiler built using profiler = true and that target in bootstrap.toml. Run the instrumented binary under Wine and llvm-profdata merge; done means cross-compilation succeeds and the resulting profile data merges without malformed-profile errors.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100