Some thoughts and problems with rpath and reproducible builds
As far as I can see, CMake will (by default) setup absolute paths, add them to binaries via the linker commandline. This means that the output will change dependent on path and length of path (can affect further elf sections).
When installing, CMake will "binary patch" the final RPATH, but there are multiple differences to compiling with this path:
- the elf layout will depend on the length of the path
- the unique build-id depends on the dynamic section AFAIK.
Now, I know about CMAKE_BUILD_WITH_INSTALL_RPATH
and BUILD_RPATH_USE_ORIGIN
but the basic issue remains.
Would it be feasible to change the behavior, so that CMake always uses the install rpath, then patches in the build rpath and somehow remembers to undo the change when installing? (easiest would be to just keep the original around) Having identical results to just using the "final" linker arguments, while being able to use the tools after build would be nice.