Created
May 11, 2025 09:36
-
-
Save Kyle-Ye/4658b5651f93e198f2cef80c00e5a1bf to your computer and use it in GitHub Desktop.
A patch to workaround Swift 6.1 include CoreFoundation issue on Linux
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# A temporay workaround for https://github.com/swiftlang/swift-corelibs-foundation/issues/5211 | |
set -e | |
# Find the path to swift binary | |
SWIFT_PATH=$(which swift) | |
echo "Swift binary found at: $SWIFT_PATH" | |
# Extract the toolchain path from swift binary path | |
# Remove /usr/bin/swift from the path to get the toolchain root | |
TOOLCHAIN_ROOT=$(dirname $(dirname "$SWIFT_PATH")) | |
echo "Toolchain root: $TOOLCHAIN_ROOT" | |
# Construct the path to CFBase.h | |
CFBASE_PATH="$TOOLCHAIN_ROOT/lib/swift/CoreFoundation/CFBase.h" | |
echo "Looking for CFBase.h at: $CFBASE_PATH" | |
# Check if the file exists | |
if [ -f "$CFBASE_PATH" ]; then | |
echo "Found CFBase.h, applying patch..." | |
# Create a backup of the original file | |
cp "$CFBASE_PATH" "$CFBASE_PATH.bak" | |
# Replace the include line | |
sed -i 's/#include <ptrauth.h>/\/\/ #include <ptrauth.h>/g' "$CFBASE_PATH" | |
echo "Patch applied successfully." | |
echo "Original file backed up at $CFBASE_PATH.bak" | |
else | |
echo "ERROR: Could not find CFBase.h in expected location." | |
echo "Toolchain structure may be different than expected." | |
exit 1 | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Update: This is only needed for Swift 6.1
The fix has landed on main and will be released with Swift 6.2 toolchain.
swiftlang/swift-corelibs-foundation#5212