GirkovArpa
GirkovArpa

Reputation: 4912

Why does my release mode Rust executable contain strings with absolute path names?

I just built my first Rust hello world program followed by a websocket client, compiled with:

cargo build --release

Scouring the 216 KB executable inside hello_cargo\target\release with a hex editor I see:

C:\\Users\\GirkovArpa\\.cargo\\registry\\src\\github.com-1ecd2293db9ea513\\embedded-websocket-0.3.0\\src\\lib.rs
C:\\Users\\GirkovArpa\\.cargo\\registry\\src\\github.com-1ecd2293db9ea513\\heapless-0.5.5\\src\\string.rs
C:\\Users\\GirkovArpa\\.cargo\\registry\\src\\github.com-1ecd2293db9ea513\\rand-0.7.3\\src\\rngs\\thread.rs
C:\\Users\\GirkovArpa\\Documents\\GitHub\\hello_cargo\\target\\release\\deps\\hello_cargo.pdb

And a couple more strings like this. And this is after running strip hello_cargo.exe.

How do I avoid this?

Upvotes: 4

Views: 918

Answers (1)

Timmmm
Timmmm

Reputation: 96832

This is a big problem for distributed compilation / caching. I would suggest following this issue. They suggest using --remap-path-prefix. Docs here.

People are working on first class support for this.

Upvotes: 3

Related Questions