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

Add option to prevent including metadata in target name #6899

Closed
wickerwaka opened this issue May 2, 2019 · 3 comments
Closed

Add option to prevent including metadata in target name #6899

wickerwaka opened this issue May 2, 2019 · 3 comments
Labels
C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted`

Comments

@wickerwaka
Copy link
Contributor

Problem
When cargo builds a target is passes -C extra-filename=-... to rustc which produces an output file with a metadata suffix in the name. For windows targets this will produce foo-metadata.exe and foo-metadata.pdb files. It then copies and renames these files so the final result is foo.exe and foo.pdb.

However the debug data in a PE executable files stores the original name of the PDB file and this name is used when debuggers (Visual Studio, WinDbg or anything using dbghelp.dll) are searching for PDB files on symbol servers. So when looking for the PDB file for foo.exe, it will actually search for foo-metadata.pdb which has likely not been uploaded.

Possible Solution(s)
Ideally it would be possible to specify in the Cargo.toml that extra-filename should not be used for certain profiles, e.g.:

[profile.release]
add-extra-filename = false

Notes
Output of cargo version: cargo 1.33.0 (f099fe9 2019-02-12)

@wickerwaka wickerwaka added the C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted` label May 2, 2019
@arve0
Copy link

arve0 commented Jun 21, 2019

Adding: Specifying cargo rustc -- -o filename does not ignore -C extra-filename. Nor does -C extra-filename="". Also, rustc warns that -C extra-filename is ignored, but it is not:

$ mkdir output-filename
$ cd output-filename/
$ cargo init
    Created binary (application) package
$ cargo rustc -v --release -- -o filename
  Compiling output-filename v0.1.0 (/private/tmp/output-filename)
    Running `rustc --edition=2018 --crate-name output_filename src/main.rs --color always --crate-type bin --emit=dep-info,link -C opt-level=3 -o filename -C metadata=c961d75f8bcf3c48 -C extra-filename=-c961d75f8bcf3c48 --out-dir /private/tmp/output-filename/target/release/deps -L dependency=/private/tmp/output-filename/target/release/deps`
warning: due to multiple output types requested, the explicitly specified output file name will be adapted for each output type

warning: ignoring --out-dir flag due to -o flag

warning: ignoring -C extra-filename flag due to -o flag

    Finished release [optimized] target(s) in 0.39s
$ ls
Cargo.lock          filename-c961d75f8bcf3c48   src
Cargo.toml          filename-c961d75f8bcf3c48.d target

This may be a rustc issue?

@ehuss
Copy link
Contributor

ehuss commented Jun 25, 2019

@arve0 I submitted a quick PR (rust-lang/rust#62128) for the extraneous warning.

@ehuss
Copy link
Contributor

ehuss commented Apr 6, 2020

I think the root issue here is fixed (windows executables no longer have a hash in the filename) via #7400.

@ehuss ehuss closed this as completed Apr 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted`
Projects
None yet
Development

No branches or pull requests

3 participants