From 96be613410bdd3c8f0a763bf9b6f57ca281d4679 Mon Sep 17 00:00:00 2001 From: Justin Santa Barbara Date: Thu, 28 Jun 2018 20:58:35 -0400 Subject: [PATCH] Experimental fix for CGO_CFLAGS --- go/tools/builders/stdlib.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/go/tools/builders/stdlib.go b/go/tools/builders/stdlib.go index a4ff7f99d1..3a78055638 100644 --- a/go/tools/builders/stdlib.go +++ b/go/tools/builders/stdlib.go @@ -107,6 +107,15 @@ func run(args []string) error { return fmt.Errorf("error modifying cgo environment to absolute path: %v", err) } + { + cgoFlags := os.Getenv("CGO_CFLAGS") + cgoFlags += " -g -O2" + cgoFlags += " -fdebug-prefix-map=" + abs(".") + "=." + if err := os.Setenv("CGO_CFLAGS", cgoFlags); err != nil { + return err + } + } + for _, target := range []string{"std", "runtime/cgo"} { if err := goenv.runCommand(append(installArgs, target)); err != nil { return err