The `--pathmap` option just serves to normalize file paths that are emitted to the EXE / DLL or PDB by the C# compiler. There are a number of cases where file paths are emitted like the PDB document table, [CallerFileInfo] parameters, etc ... Using `--pathmap` allows these paths to be normalized when building in different directories. If you're using the .NET SDK in many cases you can just pass -p:DeterministicSourcePaths and this will be done for you (that option should really have been called ReproducibleSourcePaths).
The original question was more about MSVC though, believe they have a similar option but unsure what the name is. On Tue, Dec 3, 2024 at 3:05 AM Andrew Leonard <[email protected]> wrote: > For reproducible Windows builds of OpenJDK, we found the build PATH "hash" > was an issue, > i'm not totally sure if all those deterministic options can avoid it. We > work around the issue > by always using "relative" build paths for compilation. > Have you tried also using the --pathmap: option to map source paths > generated by the compiler? > Not sure but it may make the "hashes" deterministic maybe... > ref: > https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/compiler-options/advanced > > > > On Mon, Dec 2, 2024 at 11:25 AM Chris Lamb <[email protected]> > wrote: > >> Danilo wrote: >> >> > https://try.diffoscope.org/hxsyehbrkftf.html (link valid for 30 days). >> > There are no paths embedded in the binary. To me, this looks like some >> > kind of optimization, but I don't know where it's coming from. >> >> I've come across more than one file format that _hashes_ the build >> path and then uses that value as a debug/interface/build identifier. >> Crucially, as the build path is hashed, it does not appear as a >> literal string in the binary, so not seeing the build path in >> diffoscope is not conclusive. >> >> Whilst I've seen this used as part of the Link-Time Optimisation >> puzzle, the switch to disable stuff like that might be in the linker >> or debug area of your compiler docs — not the optimisation part. >> >> That would be my guess anyway... Am throwing it over the wall given >> you seem to be working on this as we type. :) No doubt someone much >> more informed about this file format will chime in and correct me. >> >> >> Best wishes, >> >> -- >> o >> ⬋ ⬊ Chris Lamb >> o o reproducible-builds.org 💠 >> ⬊ ⬋ >> o >> >> -- Jared Parsons http://blog.paranoidcoding.com/ http://twitter.com/jaredpar
