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 for trimming prefix path #9399

Closed
Morganamilo opened this issue Apr 23, 2021 · 3 comments
Closed

Add option for trimming prefix path #9399

Morganamilo opened this issue Apr 23, 2021 · 3 comments
Labels
C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted`

Comments

@Morganamilo
Copy link
Contributor

Describe the problem you are trying to solve

Currently there's no easy way to trim the path prefix when compiling.

rustc has --remap-path-prefix but this requires you to know the prefix. This is hard to know when using build systems and you can't expect users to have this set when distributing source.

Describe the solution you'd like

I believe we should copy Go:

The new go build flag -trimpath removes all file system paths from the compiled executable, to improve build reproducibility.

With a trimpath option in cargo.toml. This would pass --remap-path-prefix=$CARGO_MANIFEST_DIR=/ to rustc.

This could also perhaps be enabled by default on release builds.

Notes

@Morganamilo Morganamilo added the C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted` label Apr 23, 2021
@Morganamilo
Copy link
Contributor Author

Morganamilo commented Apr 23, 2021

I would be interested in implementing this myself. Some guidance would be appreciated on how to get this accepted, if I need to write an RFC, etc.

@Morganamilo
Copy link
Contributor Author

I've just found #5505, which is basically the problem i'm trying to solve here.

@Eh2406
Copy link
Contributor

Eh2406 commented Apr 27, 2021

I will close for now and guide the conversations to continue in #5505 and #9407.

@ehuss ehuss closed this as completed Jun 2, 2021
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