Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
microsoft
GitHub Repository: microsoft/vscode
Path: blob/main/build/azure-pipelines/linux/verify-glibc-requirements.sh
3520 views
1
#!/usr/bin/env bash
2
3
set -e
4
5
TRIPLE="x86_64-linux-gnu"
6
if [ "$VSCODE_ARCH" == "arm64" ]; then
7
TRIPLE="aarch64-linux-gnu"
8
elif [ "$VSCODE_ARCH" == "armhf" ]; then
9
TRIPLE="arm-rpi-linux-gnueabihf"
10
fi
11
12
# Get all files with .node extension from server folder
13
files=$(find $SEARCH_PATH -name "*.node" -not -path "*prebuilds*" -not -path "*extensions/node_modules/@parcel/watcher*" -o -type f -executable -name "node")
14
15
echo "Verifying requirements for files: $files"
16
17
for file in $files; do
18
glibc_version="$EXPECTED_GLIBC_VERSION"
19
glibcxx_version="$EXPECTED_GLIBCXX_VERSION"
20
while IFS= read -r line; do
21
if [[ $line == *"GLIBC_"* ]]; then
22
version=$(echo "$line" | awk '{if ($5 ~ /^[0-9a-fA-F]+$/) print $6; else print $5}' | tr -d '()')
23
version=${version#*_}
24
if [[ $(printf "%s\n%s" "$version" "$glibc_version" | sort -V | tail -n1) == "$version" ]]; then
25
glibc_version=$version
26
fi
27
elif [[ $line == *"GLIBCXX_"* ]]; then
28
version=$(echo "$line" | awk '{if ($5 ~ /^[0-9a-fA-F]+$/) print $6; else print $5}' | tr -d '()')
29
version=${version#*_}
30
if [[ $(printf "%s\n%s" "$version" "$glibcxx_version" | sort -V | tail -n1) == "$version" ]]; then
31
glibcxx_version=$version
32
fi
33
fi
34
done < <("$VSCODE_SYSROOT_DIR/$TRIPLE/$TRIPLE/bin/objdump" -T "$file")
35
36
if [[ "$glibc_version" != "$EXPECTED_GLIBC_VERSION" ]]; then
37
echo "Error: File $file has dependency on GLIBC > $EXPECTED_GLIBC_VERSION, found $glibc_version"
38
exit 1
39
fi
40
if [[ "$glibcxx_version" != "$EXPECTED_GLIBCXX_VERSION" ]]; then
41
echo "Error: File $file has dependency on GLIBCXX > $EXPECTED_GLIBCXX_VERSION, found $glibcxx_version"
42
fi
43
done
44
45