Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build emsdk from source #343

Merged
merged 66 commits into from
Jul 12, 2023
Merged

Build emsdk from source #343

merged 66 commits into from
Jul 12, 2023

Conversation

directhex
Copy link
Member

@directhex directhex commented May 9, 2023

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

<PropertyGroup>

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

Choose a reason for hiding this comment

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

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

<BaseIntermediateOutputPath>$(RootRepoDir)artifacts\obj\$(PlatformConfigPathPart)\</BaseIntermediateOutputPath>
Copy link
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
Copy link
Member

radical commented Jul 7, 2023

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
Copy link
Member Author

directhex commented Jul 7, 2023 via email

@radical
Copy link
Member

radical commented Jul 7, 2023

Btw I meant adding a CI job here.

NuGet.config Outdated Show resolved Hide resolved
@directhex
Copy link
Member Author

hopefully https://github.com/dotnet/runtime/pull/88687/checks runs and does something meaningful

@directhex
Copy link
Member 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
Copy link
Member

radical commented Jul 12, 2023

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
Copy link
Member

radical commented Jul 12, 2023

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

@radical
Copy link
Member

radical commented Jul 12, 2023

@directhex
Copy link
Member 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?

Copy link
Member

@radical radical left a comment

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
10 checks passed
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