summary refs log tree commit diff
path: root/pkgs/development/compilers/tinygo/0002-Add-clang-header-path.patch
blob: 2c0bfba4f3b55a7110e9f97f7aa80899ee7fb28c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
diff --git a/builder/library.go b/builder/library.go
index 6517355b..b8de1894 100644
--- a/builder/library.go
+++ b/builder/library.go
@@ -142,7 +142,7 @@ func (l *Library) load(config *compileopts.Config, tmpdir string) (job *compileJ
 	// Note: -fdebug-prefix-map is necessary to make the output archive
 	// reproducible. Otherwise the temporary directory is stored in the archive
 	// itself, which varies each run.
-	args := append(l.cflags(target, headerPath), "-c", "-Oz", "-gdwarf-4", "-ffunction-sections", "-fdata-sections", "-Wno-macro-redefined", "--target="+target, "-fdebug-prefix-map="+dir+"="+remapDir)
+	args := append(l.cflags(target, headerPath), "-c", "-Oz", "-gdwarf-4", "-ffunction-sections", "-fdata-sections", "-Wno-macro-redefined", "--target="+target, "-fdebug-prefix-map="+dir+"="+remapDir, "-isystem", "@clang_include@")
 	cpu := config.CPU()
 	if cpu != "" {
 		// X86 has deprecated the -mcpu flag, so we need to use -march instead.
diff --git a/compileopts/config.go b/compileopts/config.go
index 39fc4f2a..8711b5a8 100644
--- a/compileopts/config.go
+++ b/compileopts/config.go
@@ -264,6 +264,7 @@ func (c *Config) CFlags() []string {
 	for _, flag := range c.Target.CFlags {
 		cflags = append(cflags, strings.ReplaceAll(flag, "{root}", goenv.Get("TINYGOROOT")))
 	}
+	cflags = append([]string{"-isystem", "@clang_include@"}, cflags...)
 	switch c.Target.Libc {
 	case "darwin-libSystem":
 		root := goenv.Get("TINYGOROOT")