builder: update Clang header location

We have long since moved towards a different location for these headers
in the git checkout, so update where getClangHeaderPath looks for these
headers.

Also add an extra check to make sure a path has been detected.
This commit is contained in:
Ayke van Laethem
2019-12-23 19:28:45 +01:00
committed by Ron Evans
parent 46325910c5
commit 9644edcd5a
2 changed files with 6 additions and 2 deletions
+5 -1
View File
@@ -26,7 +26,11 @@ func runCCompiler(command string, flags ...string) error {
switch command {
case "clang":
// Compile this with the internal Clang compiler.
flags = append(flags, "-I"+getClangHeaderPath(goenv.Get("TINYGOROOT")))
headerPath := getClangHeaderPath(goenv.Get("TINYGOROOT"))
if headerPath == "" {
return errors.New("could not locate Clang headers")
}
flags = append(flags, "-I"+headerPath)
flags = append([]string{"tinygo:" + command}, flags...)
var cflag *C.char
buf := C.calloc(C.size_t(len(flags)), C.size_t(unsafe.Sizeof(cflag)))