Always use the standard OSX SDK tools
Instead of whatever happens to be in PATH.
Test: port install gcc5; attempt to build host binaries
Change-Id: If4af32596edd6fd3e459c3d574ab0ff495f236ff
diff --git a/cc/config/x86_darwin_host.go b/cc/config/x86_darwin_host.go
index 18acef8..b6b08fe 100644
--- a/cc/config/x86_darwin_host.go
+++ b/cc/config/x86_darwin_host.go
@@ -17,6 +17,7 @@
import (
"fmt"
"os/exec"
+ "path/filepath"
"strings"
"android/soong/android"
@@ -131,6 +132,11 @@
return strings.TrimSpace(string(bytes)), err
})
+ pctx.VariableFunc("MacToolPath", func(config interface{}) (string, error) {
+ bytes, err := exec.Command("xcrun", "--find", "ld").Output()
+ return filepath.Dir(strings.TrimSpace(string(bytes))), err
+ })
+
pctx.StaticVariable("DarwinGccVersion", darwinGccVersion)
pctx.SourcePathVariable("DarwinGccRoot",
"prebuilts/gcc/${HostPrebuiltTag}/host/i686-apple-darwin-${DarwinGccVersion}")
@@ -276,6 +282,10 @@
return false
}
+func (t *toolchainDarwin) ToolPath() string {
+ return "${config.MacToolPath}"
+}
+
var toolchainDarwinX86Singleton Toolchain = &toolchainDarwinX86{}
var toolchainDarwinX8664Singleton Toolchain = &toolchainDarwinX8664{}