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

[wasm] Use rsp file for emcc default flags, and a props file instead of txt #52941

Merged
merged 9 commits into from
May 28, 2021

Conversation

radical
Copy link
Member

@radical radical commented May 18, 2021

emcc-default.rsp:

  • this replaces emcc-flags.txt which was generated at wasm build time
    as the default set of flags.

Emcc.props:

  • this replaces emcc-version.txt which was generated at wasm build
    time, and contained the output of emcc --version, eg:

    emcc (Emscripten gcc/clang-like replacement + linker emulating GNU ld) 2.0.12 (d0e647bf266caad50943e78c9841e05e9c499a5d)

  • Instead of this, we now generate Emcc.props, which has:

    $(RuntimeEmccVersionRaw) - full version string (emcc (Emscripten gcc/clang-like replacement + linker emulating GNU ld) 2.0.12 (d0e647bf266caad50943e78c9841e05e9c499a5d))
    $(RuntimeEmccVersion) - parsed version (2.0.12)
    $(RuntimeEmccVersionHash) - parsed hash (d0e647bf266caad50943e78c9841e05e9c499a5d)

  • these might be useful for nugets with native libraries for use with
    wasm, for example

  • Also, extracted WasmApp.Native.targets from WasmApp.targets

@dotnet-issue-labeler
Copy link

I couldn't figure out the best area label to add to this PR. If you have write-permissions please help me learn by adding exactly one area label.

@radical radical added the arch-wasm WebAssembly architecture label May 18, 2021
@ghost
Copy link

ghost commented May 18, 2021

Tagging subscribers to 'arch-wasm': @lewing
See info in area-owners.md if you want to be subscribed.

Issue Details

WIP!

Author: radical
Assignees: -
Labels:

arch-wasm

Milestone: -

`emcc-default.rsp`:
- this replaces `emcc-flags.txt` which was generated at wasm build time
  as the default set of flags.

`Emcc.props`:
- this replaces `emcc-version.txt` which was generated at wasm build
  time, and contained the output of `emcc --version`, eg:

  `emcc (Emscripten gcc/clang-like replacement + linker emulating GNU ld) 2.0.12 (d0e647bf266caad50943e78c9841e05e9c499a5d)`

- Instead of this, we now generate `Emcc.props`, which has:

    `$(RuntimeEmccVersionRaw)`  - full version string (`emcc (Emscripten gcc/clang-like replacement + linker emulating GNU ld) 2.0.12 (d0e647bf266caad50943e78c9841e05e9c499a5d)`)
    `$(RuntimeEmccVersion)`     - parsed version (`2.0.12`)
    `$(RuntimeEmccVersionHash)` - parsed hash (`d0e647bf266caad50943e78c9841e05e9c499a5d`)

- these might be useful for nugets with native libraries for use with
  wasm, for example

- The default options being used in the `Makefile` have been moved to
  `wasm.proj`, and used to populate the new files

- this tries to retain the same flags as are being used currently, on
  various platforms (eg. for windows the optimization flags differ)
- this is being done mainly to aid readability, and clarity
- a new target `WasmBuildNativeOnly` has been added, which should
  (eventually) be usable before `publish`.
  - this commit makes the changes for it, but it hasn't been tested in
    it's final form
@radical radical marked this pull request as ready for review May 19, 2021 21:35
@radical radical requested a review from marek-safar as a code owner May 19, 2021 21:35
@radical
Copy link
Member Author

radical commented May 19, 2021

Maybe RuntimeEmccVersion should be EmccVersion?

src/mono/wasm/Makefile Outdated Show resolved Hide resolved
@radical radical requested a review from radekdoulik May 21, 2021 02:47
Copy link
Member

@radekdoulik radekdoulik left a comment

Choose a reason for hiding this comment

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

lewing
lewing previously requested changes May 21, 2021
Copy link
Member

@lewing lewing left a comment

Choose a reason for hiding this comment

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

Doesn't WasmApp.Native.targets need to be added to the pkgproj?

@radical
Copy link
Member Author

radical commented May 22, 2021

Doesn't WasmApp.Native.targets need to be added to the pkgproj?

Good catch! thanks, updated.

@radical radical requested a review from lewing May 22, 2021 05:15
@lewing
Copy link
Member

lewing commented May 23, 2021

I'm a little worried this was green before adding the files. We keep having problems like this.

@radical
Copy link
Member Author

radical commented May 23, 2021

I'm a little worried this was green before adding the files. We keep having problems like this.

I agree. I was thinking of using the nugets with the wasm.build tests, to start with. It won't be a real workload based test though, since the sdk used is older, so probably wouldn't be prudent to depend on that for workload.

@lewing
Copy link
Member

lewing commented May 23, 2021

We should strive to find problems as close to the source as practical, that doesn't mean catching everything but it does mean checking for patterns we've seen before.

src/mono/wasm/wasm.proj Outdated Show resolved Hide resolved
Co-authored-by: Larry Ewing <lewing@microsoft.com>
<PlatformManifestFileEntry Include="emcc-flags.txt" IsNative="true" />
<PlatformManifestFileEntry Include="emcc-version.txt" IsNative="true" />
<PlatformManifestFileEntry Include="emcc-default.rsp" IsNative="true" />
<PlatformManifestFileEntry Include="Emcc.props" IsNative="true" />
Copy link
Member

Choose a reason for hiding this comment

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

Can runtime packs include a props file that will be automatically loaded?

</Target>


<Target Name="_SetupEmscripten">
Copy link
Member

Choose a reason for hiding this comment

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

Should we move the base emscripten detection to the WorkloadManifest.targets where it will always be available (and knows how to require the workload when appropriate)?

<!-- Adding optimization flag at the top, so it gets precedence -->
<_EmccLDFlags Include="$(EmccLinkOptimizationFlag)" />
<_EmccLDFlags Include="@(_EmccCommonFlags)" />
<_EmccLDFlags Include="-s TOTAL_MEMORY=536870912" />
Copy link
Member

Choose a reason for hiding this comment

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

should the value here be a property?

@lewing lewing dismissed their stale review May 27, 2021 21:38

Blocking issues have been resolved

@radical radical mentioned this pull request May 28, 2021
3 tasks
@radical
Copy link
Member Author

radical commented May 28, 2021

Suggestions being tracked in #53394 .

@radical radical merged commit 6722c0b into dotnet:main May 28, 2021
@radical radical deleted the wasm-emcc-rsp branch May 28, 2021 00:21
@ghost ghost locked as resolved and limited conversation to collaborators Jun 27, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
arch-wasm WebAssembly architecture area-Build-mono
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants