Skip to content

Commit 2c9812b

Browse files
committed
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 <[email protected]>
1 parent 9f3aa79 commit 2c9812b

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

scripts/bootstrap-prefix.sh

+13
Original file line numberDiff line numberDiff line change
@@ -443,6 +443,19 @@ bootstrap_profile() {
443443
SDKPATH=/
444444
else
445445
SDKPATH=$(xcrun --show-sdk-path --sdk macosx)
446+
if [[ -L ${SDKPATH} ]] ; then
447+
# try and find a matching OS SDK
448+
local fsdk=$(readlink -f "${SDKPATH}")
449+
local osvers=$(sw_vers -productVersion)
450+
if [[ ${osvers%%.*} -le 10 ]] ; then
451+
osvers=$(echo ${osvers} | cut -d'.' -f1-2)
452+
else
453+
osvers=${osvers%%.*}
454+
fi
455+
fsdk=${fsdk%/MacOSX*.sdk}
456+
fsdk=${fsdk}/MacOSX${osvers}.sdk
457+
[[ -e ${fsdk} ]] && SDKPATH=${fsdk}
458+
fi
446459
if [[ ! -e ${SDKPATH} ]] ; then
447460
SDKPATH=$(xcodebuild -showsdks | sort -nr \
448461
| grep -o "macosx.*" | head -n1)

0 commit comments

Comments
 (0)