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
This commit is contained in:
Cole Faust
2024-08-22 14:27:03 -07:00
parent 079871cd55
commit 4e58bba1fc
3 changed files with 8 additions and 2 deletions

View File

@@ -1617,6 +1617,12 @@ func (c *configImpl) NinjaBin() string {
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) {

View File

@@ -57,7 +57,7 @@ func runNinjaForBuild(ctx Context, config Config) {
"--frontend_file", fifo,
}
if config.useN2 {
executable = config.PrebuiltBuildTool("n2")
executable = config.N2Bin()
args = []string{
"-d", "trace",
// TODO: implement these features, or remove them.

View File

@@ -663,7 +663,7 @@ func runSoong(ctx Context, config Config) {
ninjaArgs = append(ninjaArgs, targets...)
ninjaCmd := config.NinjaBin()
if config.useN2 {
ninjaCmd = config.PrebuiltBuildTool("n2")
ninjaCmd = config.N2Bin()
}
cmd := Command(ctx, config, "soong bootstrap",