Skip to content

Build emsdk from source - #343

Merged
directhex merged 66 commits into
dotnet:mainfrom
directhex:msft-built-only
Jul 12, 2023
Merged

directhex merged 66 commits into
dotnet:mainfrom
directhex:msft-built-only

Conversation

@directhex

@directhex directhex commented May 9, 2023 •

Copy link
Copy Markdown

Previously, our emsdk packages have effectively just wrapped the emsdk binaries downloaded by the emsdk.py script in the repository, built by upstream at some time and shipped out to users. This PR replaces all those pieces with files built on Microsoft infrastructure and shipped in via transport packages from those repositories. As part of this, we are no longer constrained by the architecture limitations of upstream and can ship native ARM64 builds for Mac, Linux and Windows.

By uncoupling ourselves from upstream, it enables us to diverge from them on how we build things, which versions are included, etc. As of now, the headline differences are:

  • Download size reduced by ~40% (linux-x64 result, may vary by platform)
  • Binaryen tools built with dynamic linking instead of static (this is a major source of space savings)
  • Native osx-arm64 and win-arm64 builds replace the previous redirects to x64 emulation, and a new linux-arm64 build has been added to the workload

Note that downloaded components are not 101% eliminated - Python is built using binary versions of OpenSSL which we are not building ourselves. This can be resolved later.

Closes: dotnet/runtime#75613

Comment thread Directory.Build.props
<PropertyGroup>

<__ProjectDir Condition="'$(__ProjectDir)'==''">$(MSBuildThisFileDirectory)</__ProjectDir>
<ProjectDir>$(__ProjectDir)\</ProjectDir>

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Comment thread Directory.Build.props
<RootRepoDir>$(ProjectDir)</RootRepoDir>
<ProjectDir Condition="'$(__ProjectDir)'==''">$(MSBuildThisFileDirectory)</ProjectDir>

<BaseIntermediateOutputPath>$(RootRepoDir)artifacts\obj\$(PlatformConfigPathPart)\</BaseIntermediateOutputPath>

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Just for future reference really: $([MSBuild]::NormalizeDirectory(..)) - this will use the correct slash, and ensure the trailing slash.

@radical

radical commented Jul 7, 2023

Copy link
Copy Markdown
Member

As a potential follow up, it would be useful to run WBT from dotnet/runtime on PRs here.

  1. get the emsdk packages from here
  2. build runtime with /p:MicrosoftNETRuntimeEmscriptenVersion=<version from step 1>
  3. and run wasm.build.tests (see eng/pipelines/common/templates/wasm-build-tests.yml in dotnet/runtime)

I think this should be enough.

@directhex

directhex commented Jul 7, 2023 via email •

Copy link
Copy Markdown
Author

@radical

radical commented Jul 7, 2023

Copy link
Copy Markdown
Member

Btw I meant adding a CI job here.

Comment thread NuGet.config Resolved
Comment thread eng/SourceBuildPrebuiltBaseline.xml Resolved
Comment thread eng/SourceBuildPrebuiltBaseline.xml Resolved
@directhex

Copy link
Copy Markdown
Author

@directhex

Copy link
Copy Markdown
Author

FFS, the required test branch was skipped. What do I have to do to get wasm-build-tests.yml to run in CI?

@radical

radical commented Jul 12, 2023

Copy link
Copy Markdown
Member

FFS, the required test branch was skipped. What do I have to do to get wasm-build-tests.yml to run in CI?

What do you need? Run just for testing? It is run based on path changes. but you can force it for testing if you want.

      - template: /eng/pipelines/common/templates/wasm-build-tests.yml
        parameters:
          platforms:
            - browser_wasm
            - browser_wasm_win
          alwaysRun: ${{ variables.isRollingBuild }}
          extraBuildArgs: /p:AotHostArchitecture=x64 /p:AotHostOS=$(_hostedOS)

.. in runtime.yml set alwaysRun: true.

@radical

radical commented Jul 12, 2023

Copy link
Copy Markdown
Member

Also, runtime-wasm pipeline will skip any jobs that would be running on runtime.

@radical

radical commented Jul 12, 2023

Copy link
Copy Markdown
Member

@directhex

Copy link
Copy Markdown
Author

Okay. Good. Great! Looks like https://dev.azure.com/dnceng-public/public/_build/results?buildId=336983&view=logs&j=1fa93050-f528-55d3-a351-f8bf9ce5adbf&t=d9dc6d3d-3442-5b70-1296-5b62e29ea209 is the one we're talking about. And it's explicitly installing my manifest from General Testing:

- Installing manifest: Microsoft.NET.Workload.Emscripten.Current/8.0.0-preview.7.23361.1

So the results on Helix on here: https://dev.azure.com/dnceng-public/public/_build/results?buildId=336983&view=logs&j=1fa93050-f528-55d3-a351-f8bf9ce5adbf&t=a9f1a437-3b59-5900-1137-ec6cae9a530c will be using my self-built emsdk? That'll be it?

@radical radical left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Awesome 🎆 🚀

@directhex
directhex merged commit 96c6e0d into dotnet:main Jul 12, 2023
steveisok pushed a commit to steveisok/runtime that referenced this pull request Jul 18, 2023
Since dotnet/emsdk#343, we are now able to support native linux-arm64 on wasm. This change adds linux-arm64 to wasm-tools and wasi-experimental workloads.
steveisok added a commit to dotnet/runtime that referenced this pull request Jul 18, 2023
Since dotnet/emsdk#343, we are now able to support native linux-arm64 on wasm. This change adds linux-arm64 to wasm-tools and wasi-experimental workloads.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

wasm-tools workload isn't supported on arm64 version of Docker

5 participants