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.
Этот коммит содержится в:
родитель
46325910c5
коммит
9644edcd5a
2 изменённых файлов: 6 добавлений и 2 удалений
|
@ -26,7 +26,11 @@ func runCCompiler(command string, flags ...string) error {
|
||||||
switch command {
|
switch command {
|
||||||
case "clang":
|
case "clang":
|
||||||
// Compile this with the internal Clang compiler.
|
// 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...)
|
flags = append([]string{"tinygo:" + command}, flags...)
|
||||||
var cflag *C.char
|
var cflag *C.char
|
||||||
buf := C.calloc(C.size_t(len(flags)), C.size_t(unsafe.Sizeof(cflag)))
|
buf := C.calloc(C.size_t(len(flags)), C.size_t(unsafe.Sizeof(cflag)))
|
||||||
|
|
|
@ -71,7 +71,7 @@ func GorootVersionString(goroot string) (string, error) {
|
||||||
// various ways.
|
// various ways.
|
||||||
func getClangHeaderPath(TINYGOROOT string) string {
|
func getClangHeaderPath(TINYGOROOT string) string {
|
||||||
// Check whether we're running from the source directory.
|
// Check whether we're running from the source directory.
|
||||||
path := filepath.Join(TINYGOROOT, "llvm", "tools", "clang", "lib", "Headers")
|
path := filepath.Join(TINYGOROOT, "llvm-project", "clang", "lib", "Headers")
|
||||||
if _, err := os.Stat(path); !os.IsNotExist(err) {
|
if _, err := os.Stat(path); !os.IsNotExist(err) {
|
||||||
return path
|
return path
|
||||||
}
|
}
|
||||||
|
|
Загрузка…
Создание таблицы
Сослаться в новой задаче