From 748c8c7e09ce225df22ae82a4f3d189ec1d091c4 Mon Sep 17 00:00:00 2001 From: Colin Cross Date: Fri, 10 Sep 2021 09:55:54 -0700 Subject: [PATCH] Make rust builds hermetic Rust builds were picking up the crt objects and system libraries like libc.so from /usr/lib/x86_64-linux-gnu/Scrt1.o and /lib/x86_64-linux-gnu/libc.so.6. Pass --sysroot to the linker to point it to the glibc prebuilts. Test: manual Change-Id: I6540df8aef0e5c2258de77456d18a6052db627d4 --- rust/config/x86_linux_host.go | 1 + 1 file changed, 1 insertion(+) diff --git a/rust/config/x86_linux_host.go b/rust/config/x86_linux_host.go index 0aa534f87..c10afd86f 100644 --- a/rust/config/x86_linux_host.go +++ b/rust/config/x86_linux_host.go @@ -26,6 +26,7 @@ var ( "-B${cc_config.ClangBin}", "-fuse-ld=lld", "-Wl,--undefined-version", + "--sysroot ${cc_config.LinuxGccRoot}/sysroot", } linuxX86Rustflags = []string{} linuxX86Linkflags = []string{}