--
You received this message because you are subscribed to the Google Groups "bazel-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bazel-discus...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/bazel-discuss/4a28ee71-bac9-4207-a804-eed4ff2d0c47n%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/bazel-discuss/CAHXf2PAo1ei_qhKYWUwG_Fp9a2aHPKu7Qf5iR9thDjN6oeP3Qw%40mail.gmail.com.
You received this message because you are subscribed to a topic in the Google Groups "bazel-discuss" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/bazel-discuss/kfWYRODXux4/unsubscribe.
To unsubscribe from this group and all its topics, send an email to bazel-discus...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/bazel-discuss/6067fa84-098a-40d4-b82f-ce89f465a5c5n%40googlegroups.com.
The way I’ve handled this internally is to create host packages for our compilers with matching compiler runtime packages that can be installed into a known-location. We build inside containers that have these compilers+runtimes pre-installed.
 This isn’t fully hermetic, but it allows for our custom toolchain to RPATH a known location and for our production machines to simply depend on our internal compiler runtime packages (installable via our yum repo since we’re on a Centos7 base). This is needed
 because our compiler and c++ stdlib are much newer than what the host defaults to.
We have plans to become fully hermetic by consuming our compiler+runtime packages directly from the toolchain via rpm2cpio+cpio to download/extract our rpms into a sysroot and then rpath against those relative to the binary using runfiles propagation, but our
 prototyping runs into issues with the runtime dynamic linker refusing to process relative RPATHs when the binary is run via root or has certain capabilities set. One alternative to this is to statically link (and possibly LTO) our libstdc++, but we haven’t
 tried it over our full codebase yet. We have some amount of dynamic code loading, so I suspect that we can’t fully go `-static-libstdc++`  and will need compromises still. Another possibility is hacking the runtime dynamic linker to ignore the security restrictions,
 but this seems like a last resort even if our production environments are tightly sealed off from the rest of the world.
I’m curious what others are doing. If you can accept the limitations in statically linking libstdc++ that seems obviously an easy path to a hermetic build. Maybe other people don’t need to set capabilities on their c++ binaries and can accept the relative rpath
 hack (with the corresponding runfiles copying that needs to occur). Has anyone hacked ld.so to be more friendly to capabilities (I’m well aware of the possible exploits in doing so)? Most companies I’ve talked to still rely on a container runtime environment
 to build their code under remote exec/CI scenarios. Is there something I missed?
To view this discussion on the web visit 
https://groups.google.com/d/msgid/bazel-discuss/CAEYdZDqAA%3D0r-RHmj7-8OOqXN9aN4ydr3xnQhPxTvGm76OCSJg%40mail.gmail.com.
