fix(linux-reh-x64): rebuild node modules due to glibc2.17 node runtime (#2473)

This commit is contained in:
Baptiste Augrain
2025-08-18 21:11:59 +02:00
committed by GitHub
parent 9b20ef5f08
commit dc302f89af
20 changed files with 135 additions and 38 deletions

View File

@@ -34,7 +34,7 @@ fi
for i in {1..5}; do # try 5 times
npm ci && break
if [[ $i == 3 ]]; then
if [[ $i == 5 ]]; then
echo "Npm install failed too many times" >&2
exit 1
fi

32
build/linux/install_gh.sh Executable file
View File

@@ -0,0 +1,32 @@
#!/usr/bin/env bash
set -ex
GH_ARCH="amd64"
for i in {1..5}; do
TAG=$( curl --retry 12 --retry-delay 30 "https://api.github.com/repos/cli/cli/releases/latest" 2>/dev/null | jq --raw-output '.tag_name' )
if [[ $? == 0 && "${TAG}" != "null" ]]; then
break
fi
if [[ $i == 5 ]]; then
echo "GH install failed too many times" >&2
exit 1
fi
echo "GH install failed $i, trying again..."
sleep $(( 15 * (i + 1)))
done
VERSION="${TAG#v}"
curl --retry 12 --retry-delay 120 -sSL "https://github.com/cli/cli/releases/download/${TAG}/gh_${VERSION}_linux_${GH_ARCH}.tar.gz" -o "gh_${VERSION}_linux_${GH_ARCH}.tar.gz"
tar xf "gh_${VERSION}_linux_${GH_ARCH}.tar.gz"
cp "gh_${VERSION}_linux_${GH_ARCH}/bin/gh" /usr/local/bin/
gh --version

13
build/linux/install_nodejs.sh Executable file
View File

@@ -0,0 +1,13 @@
#!/usr/bin/env bash
set -ex
NODEJS_VERSION=$( cat .nvmrc )
curl -fsSL "${NODEJS_SITE}${NODEJS_URLROOT}/v${NODEJS_VERSION}/node-v${NODEJS_VERSION}-linux-${NODEJS_ARCH}${NODEJS_URLSUFFIX}.tar.xz" -o node.tar.xz
tar -xf node.tar.xz
sudo mv "node-v${NODEJS_VERSION}-linux-${NODEJS_ARCH}${NODEJS_URLSUFFIX}" /usr/local/node
echo "/usr/local/node/bin" >> $GITHUB_PATH

View File

@@ -101,7 +101,7 @@ fi
for i in {1..5}; do # try 5 times
npm ci --prefix build && break
if [[ $i == 3 ]]; then
if [[ $i == 5 ]]; then
echo "Npm install failed too many times" >&2
exit 1
fi
@@ -118,7 +118,7 @@ fi
for i in {1..5}; do # try 5 times
npm ci && break
if [[ $i == 3 ]]; then
if [[ $i == 5 ]]; then
echo "Npm install failed too many times" >&2
exit 1
fi

View File

@@ -135,7 +135,7 @@ cp ../npmrc .npmrc
for i in {1..5}; do # try 5 times
npm ci --prefix build && break
if [[ $i == 3 ]]; then
if [[ $i == 5 ]]; then
echo "Npm install failed too many times" >&2
exit 1
fi
@@ -148,11 +148,19 @@ if [[ -z "${VSCODE_SKIP_SETUPENV}" ]]; then
else
source ./build/azure-pipelines/linux/setup-env.sh
fi
export VSCODE_SYSROOT_DIR="${VSCODE_REMOTE_SYSROOT_DIR}"
else
mkdir -p .build/x86_64-linux-gnu/x86_64-linux-gnu/bin
ln -s $( which objdump ) .build/x86_64-linux-gnu/x86_64-linux-gnu/bin/objdump
export VSCODE_SYSROOT_DIR=".build"
fi
for i in {1..5}; do # try 5 times
npm ci && break
if [[ $i == 3 ]]; then
if [[ $i == 5 ]]; then
echo "Npm install failed too many times" >&2
exit 1
fi
@@ -162,6 +170,23 @@ for i in {1..5}; do # try 5 times
rm -rf node_modules/@vscode node_modules/node-pty
done
if [[ "${VSCODE_ARCH}" == "x64" ]]; then
pushd "remote"
for LIB in @parcel/watcher @vscode/spdlog kerberos node-pty
do
pushd "node_modules/${LIB}"
CXXFLAGS="-D_GLIBCXX_USE_CXX11_ABI=0" npx node-gyp rebuild
popd
done
popd
VERIFY_CXX11=1
fi
mv .npmrc.bak .npmrc
node build/azure-pipelines/distro/mixin-npm
@@ -175,6 +200,10 @@ if [[ "${SHOULD_BUILD_REH}" != "no" ]]; then
EXPECTED_GLIBC_VERSION="${EXPECTED_GLIBC_VERSION}" EXPECTED_GLIBCXX_VERSION="${GLIBCXX_VERSION}" SEARCH_PATH="../vscode-reh-${VSCODE_PLATFORM}-${VSCODE_ARCH}" ./build/azure-pipelines/linux/verify-glibc-requirements.sh
if [[ -n "${VERIFY_CXX11}" ]]; then
SEARCH_PATH="../vscode-reh-${VSCODE_PLATFORM}-${VSCODE_ARCH}" ../build/linux/verify_cxx11_requirements.sh
fi
pushd "../vscode-reh-${VSCODE_PLATFORM}-${VSCODE_ARCH}"
if [[ -f "../build/linux/${VSCODE_ARCH}/ripgrep.sh" ]]; then
@@ -194,6 +223,10 @@ if [[ "${SHOULD_BUILD_REH_WEB}" != "no" ]]; then
EXPECTED_GLIBC_VERSION="${EXPECTED_GLIBC_VERSION}" EXPECTED_GLIBCXX_VERSION="${GLIBCXX_VERSION}" SEARCH_PATH="../vscode-reh-web-${VSCODE_PLATFORM}-${VSCODE_ARCH}" ./build/azure-pipelines/linux/verify-glibc-requirements.sh
if [[ -n "${VERIFY_CXX11}" ]]; then
SEARCH_PATH="../vscode-reh-${VSCODE_PLATFORM}-${VSCODE_ARCH}" ../build/linux/verify_cxx11_requirements.sh
fi
pushd "../vscode-reh-web-${VSCODE_PLATFORM}-${VSCODE_ARCH}"
if [[ -f "../build/linux/${VSCODE_ARCH}/ripgrep.sh" ]]; then

View File

@@ -0,0 +1,29 @@
#!/usr/bin/env bash
set -e
FILES=$(
find "${SEARCH_PATH}" -type f -executable -name "node"
find "${SEARCH_PATH}" -name "*.node" -not -path "*prebuilds*" -not -path "*extensions/node_modules/@parcel/watcher*"
)
echo "Verifying requirements for files: ${FILES}"
for FILE in ${FILES}; do
CXXABI_VERSION="0.0.0"
while IFS= read -r LINE; do
VERSION=${LINE#*_}
if [[ $( printf "%s\n%s" "${VERSION}" "${CXXABI_VERSION}" | sort -V | tail -n1 ) == "${VERSION}" ]]; then
CXXABI_VERSION="${VERSION}"
fi
done < <( strings "${FILE}" | grep -i ^CXXABI )
if [[ $( printf "%s\n%s" "${EXPECTED_CXXABI_VERSION}" "${CXXABI_VERSION}" | sort -V | tail -n1 ) == "${EXPECTED_CXXABI_VERSION}" ]]; then
echo "File ${FILE} has dependency on ABI ${CXXABI_VERSION} <= ${EXPECTED_CXXABI_VERSION}"
else
echo "Error: File ${FILE} has dependency on ABI ${CXXABI_VERSION} > ${EXPECTED_CXXABI_VERSION}"
exit 1
fi
done

View File

@@ -0,0 +1,14 @@
#!/usr/bin/env bash
set -e
FILES=$( find "${SEARCH_PATH}" -name "*.node" -not -path "*prebuilds*" -not -path "*extensions/node_modules/@parcel/watcher*" )
echo "Verifying requirements for files: ${FILES}"
for FILE in ${FILES}; do
if [[ -n "$( strings "${FILE}" | grep cxx11 | tail -n1 )" ]]; then
echo "Error: File ${FILE} has dependency on CXX11"
exit 1
fi
done

View File

@@ -13,7 +13,7 @@ cd vscode || { echo "'vscode' dir not found"; exit 1; }
for i in {1..5}; do # try 5 times
npm ci && break
if [[ $i == 3 ]]; then
if [[ $i == 5 ]]; then
echo "Npm install failed too many times" >&2
exit 1
fi