Repository navigation
[oryx] - Publish Oryx for the host architecture (arm64 support) - #1759
Open
Fairuzan Roslan (fairuzan) wants to merge 1 commit into
Open
Fairuzan Roslan (fairuzan) wants to merge 1 commit into
Fairuzan Roslan (fairuzan) wants to merge 1 commit into
Conversation
The install script always ran `dotnet publish -r linux-x64`, so on arm64
hosts the feature installed an x86-64 GenerateBuildScript binary that
fails to execute ("exec format error", or a Rosetta loader error under
Docker Desktop on Apple silicon).
Map the dpkg architecture to the matching .NET runtime identifier
(amd64 -> linux-x64, arm64 -> linux-arm64) and fail early on anything
else. Add a test that checks the ELF machine type of the published
binary, since emulation can otherwise hide a mismatch.
Author
|
@microsoft-github-policy-service agree |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
src/oryx/install.shalways publishes Oryx with-r linux-x64, so on arm64 hosts the feature installs successfully but leaves an x86-64 binary that cannot run:(On native arm64 Linux this shows up as
exec format errorinstead of the Rosetta error from Docker Desktop on Apple silicon.)This is currently one of the blockers for an arm64 build of
mcr.microsoft.com/devcontainers/universal. When I builtsrc/universalnatively on arm64, all 10 Oryx-related checks in itstest-project/test.shfailed for this reason. See also devcontainers/images#1604.Changes
dpkg --print-architectureto the matching .NET runtime identifier (amd64→linux-x64,arm64→linux-arm64) and use it for bothdotnet publishcalls. Unsupported architectures fail early with the same(!) Architecture ... unsupportedmessage the hugo/php/ruby features use.oryx-binary-matches-architecturetest that reads the ELFe_machinefield ofGenerateBuildScriptand compares it touname -m.oryx --versionalone can miss a mismatch when QEMU or Rosetta emulation is available.On amd64 the published runtime identifier is still
linux-x64, so the build output there doesn't change.Testing
devcontainer features test --features oryx --project-folder .run natively on arm64 (Apple silicon, Docker Desktop 29.9.2,aarch64Linux VM):including:
After the change:
I also swapped an arm64 build of Oryx into the
universalimage.oryx --version,oryx buildof the Python sample, andoryx prepall work there.I did not test on amd64 locally. CI on this PR covers that path.
Known limitation (out of scope)
This fixes the Oryx CLI itself. Separately, the SDKs that
oryx prep/ dynamic install download fromhttps://oryx-cdn.microsoft.ioare x86-64 builds regardless of host architecture. On arm64 the downloaded/opt/nodejs/20.11.0/bin/nodeand/opt/php/8.1.30/bin/phpare x86-64 and fail to execute. The existing*-installed-by-oryxchecks still pass because they only list/opt/<platform>and don't run the binaries. Fixing that needs arm64 SDK builds on the Oryx side (microsoft/Oryx), so it isn't part of this PR.