_scripts: handle not installed CommandLineTools (#2914)

Signed-off-by: Koichi Shiraishi <zchee.io@gmail.com>
This commit is contained in:
Koichi Shiraishi
2022-03-01 02:32:39 +09:00
committed by GitHub
parent 4c5b111abb
commit 23612165e7

View File

@ -271,7 +271,8 @@ func canMacnative() bool {
typesHeader := "/usr/include/sys/types.h"
if major >= 11 || (major == 10 && minor >= 15) {
typesHeader = "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/types.h"
sdkpath := strings.TrimSpace(getoutput("xcrun", "--sdk", "macosx", "--show-sdk-path"))
typesHeader = filepath.Join(sdkpath, "usr", "include", "sys", "types.h")
}
_, err = os.Stat(typesHeader)
if err != nil {