From f1b291ed62a8eab35b1d7870f3f49a18319d1cc0 Mon Sep 17 00:00:00 2001 From: Harold Brenes Date: Thu, 16 May 2024 17:53:41 -0400 Subject: [PATCH] Attempt to automatically resolve the sysroot on build_odin.sh on macOS --- build_odin.sh | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/build_odin.sh b/build_odin.sh index 7e0d0e585..c27ad119d 100755 --- a/build_odin.sh +++ b/build_odin.sh @@ -64,7 +64,16 @@ Darwin) fi fi - CXXFLAGS="$CXXFLAGS $($LLVM_CONFIG --cxxflags --ldflags)" + darwin_sysroot= + if [ $(which xcode-select) ]; then + darwin_sysroot="--sysroot $(xcode-select -p)/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk" + elif [[ -e "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk" ]]; then + darwin_sysroot="--sysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk" + else + echo "Warning: MacOSX.sdk not found." + fi + + CXXFLAGS="$CXXFLAGS $($LLVM_CONFIG --cxxflags --ldflags) ${darwin_sysroot}" LDFLAGS="$LDFLAGS -liconv -ldl -framework System -lLLVM" ;; FreeBSD)