Skip to content

Go Cgo: stdlib.h Not Found after Upgrading

After upgrading macOs, my go breaks as it cannot find the stdlib.h:

BUILD| runtime/cgo
     | _cgo_export.c:3:10: fatal error: 'stdlib.h' file not found

The problem is caused that the go tries to access the clang installed by llvm, which is used for pivot-lang. Technically, setting environment variables could solve it elegantly, but I don't want to explore more. Hence, I uninstalled the llvm to save my time.