From 331cfb65b772612ad65f69718400f1ee1fb07d63 Mon Sep 17 00:00:00 2001 From: Ayke van Laethem Date: Thu, 28 Mar 2024 12:25:58 +0100 Subject: [PATCH] nix: fix wasi-libc include headers Apparently Nix really doesn't like --sysroot, so we have to use `-nostdlibinc` and `-isystem` instead. --- compileopts/config.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/compileopts/config.go b/compileopts/config.go index 24da4e280..e3f67b11a 100644 --- a/compileopts/config.go +++ b/compileopts/config.go @@ -310,7 +310,9 @@ func (c *Config) CFlags(libclang bool) []string { ) case "wasi-libc": root := goenv.Get("TINYGOROOT") - cflags = append(cflags, "--sysroot="+root+"/lib/wasi-libc/sysroot") + cflags = append(cflags, + "-nostdlibinc", + "-isystem", root+"/lib/wasi-libc/sysroot/include") case "wasmbuiltins": // nothing to add (library is purely for builtins) case "mingw-w64":