Use musl build of n2
We're seeing bugs on the build server only, and previous similar bugs
were caused by issues in the older version of glibc the build server
uses, so try using the musl build of n2 to see if it resolves the
issues.
Bug: 318434287
Test: Presubmits
Change-Id: I416cd77f4dfb4ca04f6dd5b36fa73585a2904b55
diff --git a/ui/build/config.go b/ui/build/config.go
index b8fcb6b..64ac1a0 100644
--- a/ui/build/config.go
+++ b/ui/build/config.go
@@ -1617,6 +1617,12 @@
return c.PrebuiltBuildTool(binName)
}
+func (c *configImpl) N2Bin() string {
+ path := c.PrebuiltBuildTool("n2")
+ // Use musl instead of glibc because glibc on the build server is old and has bugs
+ return strings.ReplaceAll(path, "/linux-x86/", "/linux_musl-x86/")
+}
+
func (c *configImpl) PrebuiltBuildTool(name string) string {
if v, ok := c.environ.Get("SANITIZE_HOST"); ok {
if sanitize := strings.Fields(v); inList("address", sanitize) {
diff --git a/ui/build/ninja.go b/ui/build/ninja.go
index 8ca62d3..4e3e544 100644
--- a/ui/build/ninja.go
+++ b/ui/build/ninja.go
@@ -57,7 +57,7 @@
"--frontend_file", fifo,
}
if config.useN2 {
- executable = config.PrebuiltBuildTool("n2")
+ executable = config.N2Bin()
args = []string{
"-d", "trace",
// TODO: implement these features, or remove them.
diff --git a/ui/build/soong.go b/ui/build/soong.go
index 2ccdfec..a9c2cc7 100644
--- a/ui/build/soong.go
+++ b/ui/build/soong.go
@@ -663,7 +663,7 @@
ninjaArgs = append(ninjaArgs, targets...)
ninjaCmd := config.NinjaBin()
if config.useN2 {
- ninjaCmd = config.PrebuiltBuildTool("n2")
+ ninjaCmd = config.N2Bin()
}
cmd := Command(ctx, config, "soong bootstrap",