Skip to content

Commit 2ef4d1e

Browse files
committed
Add fix-toolchain.sh to workaround Linux toolchain issue
1 parent 83b0999 commit 2ef4d1e

File tree

2 files changed

+37
-0
lines changed

2 files changed

+37
-0
lines changed

.github/scripts/fix-toolchain.sh

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
#!/bin/bash
2+
set -e
3+
4+
# Find the path to swift binary
5+
SWIFT_PATH=$(which swift)
6+
echo "Swift binary found at: $SWIFT_PATH"
7+
8+
# Extract the toolchain path from swift binary path
9+
# Remove /usr/bin/swift from the path to get the toolchain root
10+
TOOLCHAIN_ROOT=$(dirname $(dirname "$SWIFT_PATH"))
11+
echo "Toolchain root: $TOOLCHAIN_ROOT"
12+
13+
# Construct the path to CFBase.h
14+
CFBASE_PATH="$TOOLCHAIN_ROOT/lib/swift/CoreFoundation/CFBase.h"
15+
echo "Looking for CFBase.h at: $CFBASE_PATH"
16+
17+
# Check if the file exists
18+
if [ -f "$CFBASE_PATH" ]; then
19+
echo "Found CFBase.h, applying patch..."
20+
21+
# Create a backup of the original file
22+
cp "$CFBASE_PATH" "$CFBASE_PATH.bak"
23+
24+
# Replace the include line
25+
sed -i 's/#include <ptrauth.h>/\/\/ #include <ptrauth.h>/g' "$CFBASE_PATH"
26+
27+
echo "Patch applied successfully."
28+
echo "Original file backed up at $CFBASE_PATH.bak"
29+
else
30+
echo "ERROR: Could not find CFBase.h in expected location."
31+
echo "Toolchain structure may be different than expected."
32+
exit 1
33+
fi

.github/workflows/ubuntu.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@ jobs:
2323
container: swift:${{ matrix.swift_version }}-jammy
2424
steps:
2525
- uses: actions/checkout@v4
26+
- name: Toolchain fix patch
27+
run: |
28+
# Fix swift-corelibs-foundation#5211
29+
.github/scripts/fix-toolchain.sh
2630
- name: Building and running tests in debug mode with coverage
2731
run: |
2832
swift test \

0 commit comments

Comments
 (0)