commit: 2c9812b9969dea501dc889593e9bacd572bb01f4 Author: Fabian Groffen <grobian <AT> gentoo <DOT> org> AuthorDate: Mon Jan 29 18:52:57 2024 +0000 Commit: Fabian Groffen <grobian <AT> gentoo <DOT> org> CommitDate: Mon Jan 29 18:52:57 2024 +0000 URL: https://gitweb.gentoo.org/repo/proj/prefix.git/commit/?id=2c9812b9
scripts/bootstrap-prefix: find OS matching SDK on Darwin For some reason Apple installs SDKs for the next versions of the OS automatically, and then enables those SDKs. Doing so, however results in mismatches between the running system and the SDK, such as finding definitions of symbols, but not being able to resolve them during runtime. Try and find an SDK that matches the running OS, in the hope that things match better. Bug: https://bugs.gentoo.org/910720 Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org> scripts/bootstrap-prefix.sh | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/scripts/bootstrap-prefix.sh b/scripts/bootstrap-prefix.sh index 9e2c9ca8ce..91463681fe 100755 --- a/scripts/bootstrap-prefix.sh +++ b/scripts/bootstrap-prefix.sh @@ -443,6 +443,19 @@ bootstrap_profile() { SDKPATH=/ else SDKPATH=$(xcrun --show-sdk-path --sdk macosx) + if [[ -L ${SDKPATH} ]] ; then + # try and find a matching OS SDK + local fsdk=$(readlink -f "${SDKPATH}") + local osvers=$(sw_vers -productVersion) + if [[ ${osvers%%.*} -le 10 ]] ; then + osvers=$(echo ${osvers} | cut -d'.' -f1-2) + else + osvers=${osvers%%.*} + fi + fsdk=${fsdk%/MacOSX*.sdk} + fsdk=${fsdk}/MacOSX${osvers}.sdk + [[ -e ${fsdk} ]] && SDKPATH=${fsdk} + fi if [[ ! -e ${SDKPATH} ]] ; then SDKPATH=$(xcodebuild -showsdks | sort -nr \ | grep -o "macosx.*" | head -n1)
