WSL2编译android12之You are building on a machine with 15GB of RAM解决

1.报错如下

15:55:08 ************************************************************
15:55:08 You are building on a machine with 15GB of RAM
15:55:08
15:55:08 The minimum required amount of free memory is around 16GB,
15:55:08 and even with that, some configurations may not work.
15:55:08
15:55:08 If you run into segfaults or other errors, try reducing your
15:55:08 -j value.
15:55:08 ************************************************************
15:55:08 ************************************************************
15:55:08 You are building on a case-insensitive filesystem.

2.解决

# emacs build/soong/ui/build/build.go

func checkRAM(ctx Context, config Config) {
	if totalRAM := config.TotalRAM(); totalRAM != 0 {
		ram := float32(totalRAM) / (1024 * 1024 * 1024)
		ctx.Verbosef("Total RAM: %.3vGB", ram)
        -if ram <= 16 {
		+if ram <= 10 {
			ctx.Println("************************************************************")
			ctx.Printf("You are building on a machine with %.3vGB of RAM\n", ram)
			ctx.Println("")
			ctx.Println("The minimum required amount of free memory is around 16GB,")
			ctx.Println("and even with that, some configurations may not work.")
			ctx.Println("")
			ctx.Println("If you run into segfaults or other errors, try reducing your")
			ctx.Println("-j value.")
			ctx.Println("************************************************************")
		} else if ram <= float32(config.Parallel()) {
			// Want at least 1GB of RAM per job.
			ctx.Printf("Warning: high -j%d count compared to %.3vGB of RAM", config.Parallel(), ram)
			ctx.Println("If you run into segfaults or other errors, try a lower -j value")
		}
	}
}


猜你喜欢

转载自blog.csdn.net/u010164190/article/details/125694857