Skip to content

Commit 965cf18

Browse files
authored
Add CI check for glibc version
1 parent e7b513c commit 965cf18

File tree

3 files changed

+66
-2
lines changed

3 files changed

+66
-2
lines changed

.github/workflows/ci.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,14 @@ jobs:
3636
- name: Install dependencies and build
3737
run: npm ci
3838

39+
- name: Verify GLIBC requirements
40+
if: runner.os == 'Linux'
41+
run: |
42+
EXPECTED_GLIBC_VERSION="2.28" \
43+
EXPECTED_GLIBCXX_VERSION="3.4.25" \
44+
SEARCH_PATH="build" \
45+
./scripts/linux/verify-glibc-requirements.sh
46+
3947
- name: Test
4048
run: npm test
4149

package-lock.json

Lines changed: 22 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
#!/usr/bin/env bash
2+
3+
set -e
4+
5+
# Get all files with .node extension from given folder
6+
files=$(find $SEARCH_PATH -name "*.node")
7+
8+
echo "Verifying requirements for files: $files"
9+
10+
for file in $files; do
11+
glibc_version="$EXPECTED_GLIBC_VERSION"
12+
glibcxx_version="$EXPECTED_GLIBCXX_VERSION"
13+
while IFS= read -r line; do
14+
if [[ $line == *"GLIBC_"* ]]; then
15+
version=$(echo "$line" | awk '{if ($5 ~ /^[0-9a-fA-F]+$/) print $6; else print $5}' | tr -d '()')
16+
version=${version#*_}
17+
if [[ $(printf "%s\n%s" "$version" "$glibc_version" | sort -V | tail -n1) == "$version" ]]; then
18+
glibc_version=$version
19+
fi
20+
elif [[ $line == *"GLIBCXX_"* ]]; then
21+
version=$(echo "$line" | awk '{if ($5 ~ /^[0-9a-fA-F]+$/) print $6; else print $5}' | tr -d '()')
22+
version=${version#*_}
23+
if [[ $(printf "%s\n%s" "$version" "$glibcxx_version" | sort -V | tail -n1) == "$version" ]]; then
24+
glibcxx_version=$version
25+
fi
26+
fi
27+
done < <("$SYSROOT_PATH/../bin/objdump" -T "$file")
28+
29+
if [[ "$glibc_version" != "$EXPECTED_GLIBC_VERSION" ]]; then
30+
echo "Error: File $file has dependency on GLIBC > $EXPECTED_GLIBC_VERSION, found $glibc_version"
31+
exit 1
32+
fi
33+
if [[ "$glibcxx_version" != "$EXPECTED_GLIBCXX_VERSION" ]]; then
34+
echo "Error: File $file has dependency on GLIBCXX > $EXPECTED_GLIBCXX_VERSION, found $glibcxx_version"
35+
fi
36+
done

0 commit comments

Comments
 (0)