From 6745a8ef1d755b6d0ed61e42ac1d28201121a007 Mon Sep 17 00:00:00 2001 From: Colin Cross Date: Fri, 11 Feb 2022 13:43:21 -0800 Subject: [PATCH] Add --sysroot /dev/null to musl compiles Prevent linking against host glibc libraries by passing --sysroot /dev/null to compile and link rules targeting musl. Bug: 190084016 Test: m USE_HOST_MUSL=true host-native Change-Id: Ief2c9507af9ae7cf5376cb874fcef0f2cbaf9994 --- cc/config/x86_linux_host.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/cc/config/x86_linux_host.go b/cc/config/x86_linux_host.go index 60f03c2c9..ce6836ba5 100644 --- a/cc/config/x86_linux_host.go +++ b/cc/config/x86_linux_host.go @@ -47,6 +47,7 @@ var ( "-D_LIBCPP_HAS_MUSL_LIBC", "-DANDROID_HOST_MUSL", "-nostdlibinc", + "--sysroot /dev/null", } linuxLdflags = []string{ @@ -65,6 +66,7 @@ var ( linuxMuslLdflags = []string{ "-nostdlib", "-lgcc", "-lgcc_eh", + "--sysroot /dev/null", } // Extended cflags