Skip to content

Commit 9fd9d9c

Browse files
committed
compileopts: add cflag '-isystem' for resource directory search since needed for Xtensa
Signed-off-by: deadprogram <ron@hybridgroup.com>
1 parent fd50227 commit 9fd9d9c

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

compileopts/config.go

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -265,11 +265,17 @@ func (c *Config) CFlags(libclang bool) []string {
265265
}
266266
resourceDir := goenv.ClangResourceDir(libclang)
267267
if resourceDir != "" {
268-
// The resoure directory contains the built-in clang headers like
268+
// The resource directory contains the built-in clang headers like
269269
// stdbool.h, stdint.h, float.h, etc.
270270
// It is left empty if we're using an external compiler (that already
271271
// knows these headers).
272-
cflags = append(cflags, "-resource-dir="+resourceDir)
272+
cflags = append(cflags,
273+
"-resource-dir="+resourceDir,
274+
)
275+
if strings.HasPrefix(c.Triple(), "xtensa") {
276+
// workaround needed in LLVM 16, see: https://github.com/espressif/llvm-project/issues/83
277+
cflags = append(cflags, "-isystem", filepath.Join(resourceDir, "include"))
278+
}
273279
}
274280
switch c.Target.Libc {
275281
case "darwin-libSystem":

0 commit comments

Comments
 (0)