Comment by mgaunard

16 hours ago

The dynamic linker can clearly tell you where it looks for files and in which order, and where it finds them if it does.

You can also very easily harden this if you somehow don't want to capture libraries from outside certain paths.

You can even build the compiler in such a way that every binary it produces has a built-in RPATH if you want to force certain locations.

That is what I'm doing so I can get distributed builds working. It sucks and has taken me days of work.

  • It's pretty simple and works reliably as specified.

    I can only infer that your lack of familiarity was what made it take so long.

    Rebuilding GCC with specs does take forever, and building GCC is in general quite painful, but you could also use patchelf to modify the binary after the fact (which is what a lot of build systems do).

    • > I can only infer that your lack of familiarity was what made it take so long

      Pretty much.

      Trying to convert an existing build that doesn't explicitly declare object dependencies is painful. Rust does it properly by default.

      For example, I'm discovering our clang toolchain has a transitive dependency on a gcc toolchain.