Browse Source

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

Baptiste Augrain 4 days ago
parent
commit
dc302f89af

+ 5 - 5
.github/workflows/insider-linux.yml

@@ -104,7 +104,7 @@ jobs:
       - name: Setup Node.js environment
         uses: actions/setup-node@v4
         with:
-          node-version: '22.15.1'
+          node-version-file: '.nvmrc'
         if: env.SHOULD_BUILD == 'yes'
 
       - name: Setup Python 3
@@ -206,7 +206,7 @@ jobs:
         if: env.DISABLED != 'yes' && env.SHOULD_BUILD == 'yes'
 
       - name: Install GH
-        run: ./install_gh.sh
+        run: ./build/linux/install_gh.sh
         if: env.DISABLED != 'yes' && env.SHOULD_BUILD == 'yes' && env.SHOULD_DEPLOY == 'yes'
 
       - name: Check existing VSCodium tags/releases
@@ -330,7 +330,7 @@ jobs:
       - name: Setup Node.js environment
         uses: actions/setup-node@v4
         with:
-          node-version: '22.15.1'
+          node-version-file: '.nvmrc'
         if: env.DISABLED != 'yes'
 
       - name: Setup Python 3
@@ -344,7 +344,7 @@ jobs:
         if: env.DISABLED != 'yes'
 
       - name: Install GH
-        run: ./install_gh.sh
+        run: ./build/linux/install_gh.sh
         if: env.DISABLED != 'yes' && env.SHOULD_DEPLOY == 'yes'
 
       - name: Check existing VSCodium tags/releases
@@ -426,7 +426,7 @@ jobs:
           platform: x64
 
       - name: Install GH
-        run: ./install_gh.sh
+        run: ./build/linux/install_gh.sh
         if: env.SHOULD_DEPLOY == 'yes'
 
       - name: Check existing VSCodium tags/releases

+ 1 - 1
.github/workflows/insider-macos.yml

@@ -62,7 +62,7 @@ jobs:
       - name: Setup Node.js environment
         uses: actions/setup-node@v4
         with:
-          node-version: '22.15.1'
+          node-version-file: '.nvmrc'
 
       - name: Setup Python 3
         uses: actions/setup-python@v5

+ 1 - 1
.github/workflows/insider-spearhead.yml

@@ -41,7 +41,7 @@ jobs:
       - name: Setup Node.js environment
         uses: actions/setup-node@v4
         with:
-          node-version: '22.15.1'
+          node-version-file: '.nvmrc'
 
       - name: Clone VSCode repo
         run: . get_repo.sh

+ 2 - 2
.github/workflows/insider-windows.yml

@@ -102,7 +102,7 @@ jobs:
       - name: Setup Node.js environment
         uses: actions/setup-node@v4
         with:
-          node-version: '22.15.1'
+          node-version-file: '.nvmrc'
         if: env.SHOULD_BUILD == 'yes'
 
       - name: Setup Python 3
@@ -183,7 +183,7 @@ jobs:
       - name: Setup Node.js environment
         uses: actions/setup-node@v4
         with:
-          node-version: '22.15.1'
+          node-version-file: '.nvmrc'
         if: env.SHOULD_BUILD == 'yes'
 
       - name: Setup Python 3

+ 5 - 5
.github/workflows/stable-linux.yml

@@ -105,7 +105,7 @@ jobs:
       - name: Setup Node.js environment
         uses: actions/setup-node@v4
         with:
-          node-version: '22.15.1'
+          node-version-file: '.nvmrc'
         if: env.SHOULD_BUILD == 'yes'
 
       - name: Setup Python 3
@@ -207,7 +207,7 @@ jobs:
         if: env.DISABLED != 'yes'
 
       - name: Install GH
-        run: ./install_gh.sh
+        run: ./build/linux/install_gh.sh
         if: env.DISABLED != 'yes' && env.SHOULD_BUILD == 'yes' && env.SHOULD_DEPLOY == 'yes'
 
       - name: Check existing VSCodium tags/releases
@@ -331,7 +331,7 @@ jobs:
       - name: Setup Node.js environment
         uses: actions/setup-node@v4
         with:
-          node-version: '22.15.1'
+          node-version-file: '.nvmrc'
         if: env.DISABLED != 'yes'
 
       - name: Setup Python 3
@@ -345,7 +345,7 @@ jobs:
         if: env.DISABLED != 'yes'
 
       - name: Install GH
-        run: ./install_gh.sh
+        run: ./build/linux/install_gh.sh
         if: env.DISABLED != 'yes' && env.SHOULD_DEPLOY == 'yes'
 
       - name: Check existing VSCodium tags/releases
@@ -427,7 +427,7 @@ jobs:
           platform: x64
 
       - name: Install GH
-        run: ./install_gh.sh
+        run: ./build/linux/install_gh.sh
         if: env.SHOULD_DEPLOY == 'yes'
 
       - name: Check existing VSCodium tags/releases

+ 1 - 1
.github/workflows/stable-macos.yml

@@ -61,7 +61,7 @@ jobs:
       - name: Setup Node.js environment
         uses: actions/setup-node@v4
         with:
-          node-version: '22.15.1'
+          node-version-file: '.nvmrc'
 
       - name: Setup Python 3
         uses: actions/setup-python@v5

+ 1 - 1
.github/workflows/stable-spearhead.yml

@@ -36,7 +36,7 @@ jobs:
       - name: Setup Node.js environment
         uses: actions/setup-node@v4
         with:
-          node-version: '22.15.1'
+          node-version-file: '.nvmrc'
 
       - name: Clone VSCode repo
         run: . get_repo.sh

+ 2 - 2
.github/workflows/stable-windows.yml

@@ -101,7 +101,7 @@ jobs:
       - name: Setup Node.js environment
         uses: actions/setup-node@v4
         with:
-          node-version: '22.15.1'
+          node-version-file: '.nvmrc'
         if: env.SHOULD_BUILD == 'yes'
 
       - name: Setup Python 3
@@ -182,7 +182,7 @@ jobs:
       - name: Setup Node.js environment
         uses: actions/setup-node@v4
         with:
-          node-version: '22.15.1'
+          node-version-file: '.nvmrc'
         if: env.SHOULD_BUILD == 'yes'
 
       - name: Setup Python 3

+ 1 - 1
.nvmrc

@@ -1 +1 @@
-22.15.1
+22.17.0

+ 6 - 0
build.sh

@@ -23,6 +23,9 @@ if [[ "${SHOULD_BUILD}" == "yes" ]]; then
   npm run gulp minify-vscode
 
   if [[ "${OS_NAME}" == "osx" ]]; then
+    # remove win32 node modules
+    rm -f .build/extensions/ms-vscode.js-debug/src/win32-app-container-tokens.*.node
+
     # generate Group Policy definitions
     node build/lib/policies darwin
 
@@ -53,6 +56,9 @@ if [[ "${SHOULD_BUILD}" == "yes" ]]; then
 
     VSCODE_PLATFORM="win32"
   else # linux
+    # remove win32 node modules
+    rm -f .build/extensions/ms-vscode.js-debug/src/win32-app-container-tokens.*.node
+
     # in CI, packaging will be done by a different job
     if [[ "${CI_BUILD}" == "no" ]]; then
       npm run gulp "vscode-linux-${VSCODE_ARCH}-min-ci"

+ 1 - 1
build/alpine/package_reh.sh

@@ -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

+ 3 - 1
install_gh.sh → build/linux/install_gh.sh

@@ -11,12 +11,14 @@ for i in {1..5}; do
     break
   fi
 
-  if [[ $i == 3 ]]; then
+  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}"

+ 13 - 0
build/linux/install_nodejs.sh

@@ -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

+ 2 - 2
build/linux/package_bin.sh

@@ -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

+ 35 - 2
build/linux/package_reh.sh

@@ -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

+ 29 - 0
build/linux/verify_abi_requirements.sh

@@ -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

+ 14 - 0
build/linux/verify_cxx11_requirements.sh

@@ -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

+ 1 - 1
build/windows/package.sh

@@ -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

+ 11 - 11
patches/linux/arch-0-support.patch

@@ -1,5 +1,5 @@
 diff --git a/build/azure-pipelines/linux/setup-env.sh b/build/azure-pipelines/linux/setup-env.sh
-index a148d51..fb2f8ff 100755
+index 6805633..9d4b59f 100755
 --- a/build/azure-pipelines/linux/setup-env.sh
 +++ b/build/azure-pipelines/linux/setup-env.sh
 @@ -2,3 +2,3 @@
@@ -13,10 +13,10 @@ index a148d51..fb2f8ff 100755
 +  SYSROOT_ARCH="$SYSROOT_ARCH" VSCODE_SYSROOT_DIR="$VSCODE_REMOTE_SYSROOT_DIR" node -e '(async () => { const { getVSCodeSysroot } = require("./build/linux/debian/install-sysroot.js"); await getVSCodeSysroot(process.env["SYSROOT_ARCH"]); })()'
  fi
 diff --git a/build/gulpfile.reh.js b/build/gulpfile.reh.js
-index c1d64c0..5ac9f95 100644
+index 10b7b44..0ad7550 100644
 --- a/build/gulpfile.reh.js
 +++ b/build/gulpfile.reh.js
-@@ -232,9 +232,23 @@ function nodejs(platform, arch) {
+@@ -233,9 +233,23 @@ function nodejs(platform, arch) {
  		case 'linux':
 -			return (product.nodejsRepository !== 'https://nodejs.org' ?
 -				fetchGithub(product.nodejsRepository, { version: `${nodeVersion}-${internalNodeVersion}`, name: expectedName, checksumSha256 }) :
@@ -48,7 +48,7 @@ index c1d64c0..5ac9f95 100644
 +			}
  		case 'alpine':
 diff --git a/build/gulpfile.vscode.js b/build/gulpfile.vscode.js
-index 26a6287..004417f 100644
+index 25d8916..250ba7c 100644
 --- a/build/gulpfile.vscode.js
 +++ b/build/gulpfile.vscode.js
 @@ -366,2 +366,12 @@ function packageTask(platform, arch, sourceFolderName, destinationFolderName, op
@@ -70,7 +70,7 @@ index 26a6287..004417f 100644
 +			.pipe(electron({ ...config, ...electronOverride, platform, arch: arch === 'armhf' ? 'arm' : arch, ffmpegChromium: false }))
  			.pipe(filter(['**', '!LICENSE', '!version'], { dot: true }));
 diff --git a/build/linux/debian/dep-lists.js b/build/linux/debian/dep-lists.js
-index 4ef448d..057961c 100644
+index f58d0f8..4edb371 100644
 --- a/build/linux/debian/dep-lists.js
 +++ b/build/linux/debian/dep-lists.js
 @@ -140,3 +140,3 @@ exports.referenceGeneratedDepsByArch = {
@@ -88,33 +88,33 @@ index 5b7ccd5..707129f 100644
 +	],
  };
 diff --git a/build/linux/debian/install-sysroot.js b/build/linux/debian/install-sysroot.js
-index 612d0a3..8fbdf3d 100644
+index d16e13b..18e409a 100644
 --- a/build/linux/debian/install-sysroot.js
 +++ b/build/linux/debian/install-sysroot.js
-@@ -74,3 +74,5 @@ async function fetchUrl(options, retries = 10, retryDelay = 1000) {
+@@ -73,3 +73,5 @@ async function fetchUrl(options, retries = 10, retryDelay = 1000) {
          try {
 -            const response = await fetch(`https://api.github.com/repos/Microsoft/vscode-linux-build-agent/releases/tags/v${version}`, {
 +            const repository = process.env['VSCODE_SYSROOT_REPOSITORY'] ?? 'Microsoft/vscode-linux-build-agent';
 +            const actualVersion = process.env['VSCODE_SYSROOT_VERSION'] ?? version;
 +            const response = await fetch(`https://api.github.com/repos/${repository}/releases/tags/v${actualVersion}`, {
                  headers: ghApiHeaders,
-@@ -83,3 +85,3 @@ async function fetchUrl(options, retries = 10, retryDelay = 1000) {
+@@ -82,3 +84,3 @@ async function fetchUrl(options, retries = 10, retryDelay = 1000) {
                  if (!asset) {
 -                    throw new Error(`Could not find asset in release of Microsoft/vscode-linux-build-agent @ ${version}`);
 +                    throw new Error(`Could not find asset in release of ${repository} @ ${actualVersion}`);
                  }
 diff --git a/build/linux/debian/install-sysroot.ts b/build/linux/debian/install-sysroot.ts
-index 8a61159..9f3fd15 100644
+index 670fb68..092fc68 100644
 --- a/build/linux/debian/install-sysroot.ts
 +++ b/build/linux/debian/install-sysroot.ts
-@@ -83,3 +83,5 @@ async function fetchUrl(options: IFetchOptions, retries = 10, retryDelay = 1000)
+@@ -82,3 +82,5 @@ async function fetchUrl(options: IFetchOptions, retries = 10, retryDelay = 1000)
  		try {
 -			const response = await fetch(`https://api.github.com/repos/Microsoft/vscode-linux-build-agent/releases/tags/v${version}`, {
 +			const repository = process.env['VSCODE_SYSROOT_REPOSITORY'] ?? 'Microsoft/vscode-linux-build-agent';
 +			const actualVersion = process.env['VSCODE_SYSROOT_VERSION'] ?? version;
 +			const response = await fetch(`https://api.github.com/repos/${repository}/releases/tags/v${actualVersion}`, {
  				headers: ghApiHeaders,
-@@ -92,3 +94,3 @@ async function fetchUrl(options: IFetchOptions, retries = 10, retryDelay = 1000)
+@@ -91,3 +93,3 @@ async function fetchUrl(options: IFetchOptions, retries = 10, retryDelay = 1000)
  				if (!asset) {
 -					throw new Error(`Could not find asset in release of Microsoft/vscode-linux-build-agent @ ${version}`);
 +					throw new Error(`Could not find asset in release of ${repository} @ ${actualVersion}`);

+ 1 - 1
prepare_vscode.sh

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