Skip to content

Add Snap ARM64 support#298237

Draft
dmitrivMS wants to merge 1 commit intomainfrom
dev/dmitriv/build-snap-arm64
Draft

Add Snap ARM64 support#298237
dmitrivMS wants to merge 1 commit intomainfrom
dev/dmitriv/build-snap-arm64

Conversation

@dmitrivMS
Copy link
Contributor

Fixes #125120
Fixes #269552

@dmitrivMS dmitrivMS added this to the March 2026 milestone Feb 27, 2026
@dmitrivMS dmitrivMS self-assigned this Feb 27, 2026
@dmitrivMS dmitrivMS added the snap Issues related to the snap package label Feb 27, 2026
Copilot AI review requested due to automatic review settings February 27, 2026 12:14
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds ARM64 support to VS Code Snap packages by updating the build infrastructure, snapcraft configuration, and Azure CI/CD pipelines. The changes address long-standing feature requests (#125120, #269552) for ARM64 snap packages on Linux systems.

Changes:

  • Updated snapcraft.yaml to support multi-architecture builds (x64 and arm64) and upgraded from Ubuntu 20.04 (core20) to 24.04 (core24) base
  • Modified build scripts to generate architecture-specific snapcraft configurations with appropriate multiarch library paths
  • Extended Azure pipeline to build and publish ARM64 snap packages alongside existing x64 packages

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
resources/linux/snap/snapcraft.yaml Added architecture template variables, upgraded to core24 base, updated dependencies and library paths for multiarch support
build/gulpfile.vscode.linux.ts Added BUILD_ARCHITECTURE and DEB_ARCHITECTURE template variable replacements for architecture-specific snap builds
build/azure-pipelines/product-build.yml Propagated VSCODE_BUILD_LINUX_SNAP parameter to arm64 build job
build/azure-pipelines/linux/steps/product-build-linux-compile.yml Extended snap build condition to include arm64 architecture and updated docker image reference to be architecture-specific

// Possible run-on/build-on values https://snapcraft.io/docs/architectures
.pipe(replace('@@ARCHITECTURE@@', arch === 'x64' ? 'amd64' : arch))
.pipe(replace('@@BUILD_ARCHITECTURE@@', arch === 'x64' ? 'amd64' : arch))
.pipe(replace('@@DEB_ARCHITECTURE@@', arch === 'x64' ? 'x86_64' : 'aarch64'))
Copy link

Copilot AI Feb 27, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The DEB_ARCHITECTURE mapping logic is incorrect because it only handles x64 and arm64 architectures. When arch is 'armhf', this ternary expression will incorrectly map it to 'aarch64' instead of the correct 'arm-linux-gnueabihf'.

This will cause the patchelf command in snapcraft.yaml to use the wrong library path for armhf builds, potentially breaking the snap package.

The mapping should handle all three architectures (x64, arm64, armhf) correctly. Looking at the rest of the codebase (e.g., build/linux/debian/calculate-deps.ts:51-54), armhf should map to 'arm-linux-gnueabihf', arm64 to 'aarch64-linux-gnu', and x64 to 'x86_64-linux-gnu'.

See below for a potential fix:

		const debArchitecture =
			arch === 'x64' ? 'x86_64-linux-gnu' :
			arch === 'arm64' ? 'aarch64-linux-gnu' :
			arch === 'armhf' ? 'arm-linux-gnueabihf' :
			arch;

		const snapcraft = gulp.src('resources/linux/snap/snapcraft.yaml', { base: '.' })
			.pipe(replace('@@NAME@@', product.applicationName))
			.pipe(replace('@@VERSION@@', commit!.substr(0, 8)))
			// Possible run-on/build-on values https://snapcraft.io/docs/architectures
			.pipe(replace('@@ARCHITECTURE@@', arch === 'x64' ? 'amd64' : arch))
			.pipe(replace('@@BUILD_ARCHITECTURE@@', arch === 'x64' ? 'amd64' : arch))
			.pipe(replace('@@DEB_ARCHITECTURE@@', debArchitecture))

Copilot uses AI. Check for mistakes.
snapcraftctl build
patchelf --force-rpath --set-rpath '$ORIGIN/../../lib/x86_64-linux-gnu:$ORIGIN:/snap/core20/current/lib/x86_64-linux-gnu' $SNAPCRAFT_PART_INSTALL/usr/share/@@NAME@@/chrome_crashpad_handler
craftctl default
patchelf --force-rpath --set-rpath '$ORIGIN/../../lib/@@DEB_ARCHITECTURE@@-linux-gnu:$ORIGIN:/snap/core24/current/lib/@@DEB_ARCHITECTURE@@-linux-gnu' $SNAPCRAFT_PART_INSTALL/usr/share/@@NAME@@/chrome_crashpad_handler
Copy link

Copilot AI Feb 27, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The patchelf path construction in snapcraft.yaml assumes a uniform multiarch triplet format by hardcoding '-linux-gnu' after the DEB_ARCHITECTURE variable. However, this doesn't work for all architectures:

  • x64: x86_64-linux-gnu ✓
  • arm64: aarch64-linux-gnu ✓
  • armhf: arm-linux-gnueabihf ✗ (would become arm-linux-gnu, which is incorrect)

For armhf, the correct multiarch triplet is 'arm-linux-gnueabihf', not 'arm-linux-gnu'. This means either:

  1. The DEB_ARCHITECTURE variable should contain the full triplet (x86_64-linux-gnu, aarch64-linux-gnu, arm-linux-gnueabihf), OR
  2. A separate template variable should be used for the full multiarch triplet

The same issue exists in the gulpfile.vscode.linux.ts mapping on line 268, which would need to be updated accordingly.

Suggested change
patchelf --force-rpath --set-rpath '$ORIGIN/../../lib/@@DEB_ARCHITECTURE@@-linux-gnu:$ORIGIN:/snap/core24/current/lib/@@DEB_ARCHITECTURE@@-linux-gnu' $SNAPCRAFT_PART_INSTALL/usr/share/@@NAME@@/chrome_crashpad_handler
patchelf --force-rpath --set-rpath '$ORIGIN/../../lib/@@DEB_MULTIARCH@@:$ORIGIN:/snap/core24/current/lib/@@DEB_MULTIARCH@@' $SNAPCRAFT_PART_INSTALL/usr/share/@@NAME@@/chrome_crashpad_handler

Copilot uses AI. Check for mistakes.
Copy link

@tharthar1010 tharthar1010 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi
Help
Good 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

snap Issues related to the snap package

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Enhancement]: Add arm64 support on the Snap package VS Code snap for arm64 Linux

3 participants