I want to strip references to the build directory and the general setup on the computer that build the binary. As I understand it, I'm supposed to use --remap-path-prefix for this. This only works partially:
That stripped references to the path of the source tree, however using the strings command on the binary reveals there are still references to /home/<username>/.cargo/registry/src/index.crates.io-[...] (these seem to be panic messages).
What is the proper way to deal with those?
And how do I do so in a cross platform way that will work in CI? As far as I know the path will be different on Windows, Linux and MacOS for example.
Is there some easy way to discover the path to the registry?
Thanks. I believe it is needlessly complicated to set this up (especially if you care about cross-platform), but with that information I see a solution.
I have run into another issue though with this, related to paths with spaces in them. It doesn't seem possible to properly quote the paths in RUSTFLAGS so when they contain spaces. This is rarely an issue on Linux, but on Windows such paths do come up in user names sometimes.
There is a cargo feature in the work to make this a lot easier.
You can use CARGO_ENCODED_RUSTFLAGS instead which uses ASCII Unit Separator (0x1f) instead of space as argument separator. You can also use the new --config option to set the build.rustflags config to an array formatted as toml.