Path: blob/main/build/azure-pipelines/linux/verify-glibc-requirements.sh
3520 views
#!/usr/bin/env bash12set -e34TRIPLE="x86_64-linux-gnu"5if [ "$VSCODE_ARCH" == "arm64" ]; then6TRIPLE="aarch64-linux-gnu"7elif [ "$VSCODE_ARCH" == "armhf" ]; then8TRIPLE="arm-rpi-linux-gnueabihf"9fi1011# Get all files with .node extension from server folder12files=$(find $SEARCH_PATH -name "*.node" -not -path "*prebuilds*" -not -path "*extensions/node_modules/@parcel/watcher*" -o -type f -executable -name "node")1314echo "Verifying requirements for files: $files"1516for file in $files; do17glibc_version="$EXPECTED_GLIBC_VERSION"18glibcxx_version="$EXPECTED_GLIBCXX_VERSION"19while IFS= read -r line; do20if [[ $line == *"GLIBC_"* ]]; then21version=$(echo "$line" | awk '{if ($5 ~ /^[0-9a-fA-F]+$/) print $6; else print $5}' | tr -d '()')22version=${version#*_}23if [[ $(printf "%s\n%s" "$version" "$glibc_version" | sort -V | tail -n1) == "$version" ]]; then24glibc_version=$version25fi26elif [[ $line == *"GLIBCXX_"* ]]; then27version=$(echo "$line" | awk '{if ($5 ~ /^[0-9a-fA-F]+$/) print $6; else print $5}' | tr -d '()')28version=${version#*_}29if [[ $(printf "%s\n%s" "$version" "$glibcxx_version" | sort -V | tail -n1) == "$version" ]]; then30glibcxx_version=$version31fi32fi33done < <("$VSCODE_SYSROOT_DIR/$TRIPLE/$TRIPLE/bin/objdump" -T "$file")3435if [[ "$glibc_version" != "$EXPECTED_GLIBC_VERSION" ]]; then36echo "Error: File $file has dependency on GLIBC > $EXPECTED_GLIBC_VERSION, found $glibc_version"37exit 138fi39if [[ "$glibcxx_version" != "$EXPECTED_GLIBCXX_VERSION" ]]; then40echo "Error: File $file has dependency on GLIBCXX > $EXPECTED_GLIBCXX_VERSION, found $glibcxx_version"41fi42done434445