Skip to content

emscripten: 2.0.1 -> 2.0.25#130706

Closed
khovansky-al wants to merge 1 commit intoNixOS:masterfrom
khovansky-al:emscripten-2.0.25
Closed

emscripten: 2.0.1 -> 2.0.25#130706
khovansky-al wants to merge 1 commit intoNixOS:masterfrom
khovansky-al:emscripten-2.0.25

Conversation

@khovansky-al
Copy link
Contributor

Motivation for this change

Taking advantage of latest SIMD spec in WASM requires a much newer version of emscripten as well as (yet unreleased) clang 13 and a newer binaryen.

This PR updates emscripten to v2.0.25 (latest tag release). Binaryen and llvm were updated to revisions specified in emscripten releases repo DEPS file. See emscripten-releases-tags for the mapping of tags in emscripten-releases to emscripten versions.
I imagine llvm_git could be updated any moment which could at some point break emscripten. Not sure what would be the best course of action, as llvm_git doesn't seem to allow overrides.

Starting with clang 12, one of LLVM's modules is miscompiled under gcc resulting in random segfaults when precompiling emscripten libraries cache. I added a workaround taken from the bug's page: https://bugs.llvm.org/show_bug.cgi?id=50611

As for testing, out of emscriptenPackages on current master only zlib appears to be building. libxml2, xmlmirror and json_c are already broken.
I made adjustments that keep zlib building as well as fix libxml2 and json_c. xmlmirror appears to be more deeply broken and I don't have time to fix it.

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS linux)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • 21.11 Release Notes (or backporting 21.05 Relase notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
  • Fits CONTRIBUTING.md.

Updated required dependencies:
- llvm_git 1605fce6c3074f8d1dff5a917a1840ffa66abd86 -> 3644726a78e37823b1687a7aa8d186e91570ffe2
Added a workaround for https://bugs.llvm.org/show_bug.cgi?id=50611 to llvm_git
- binaryen: v96 -> v101

Added a workaround patch for incorrect linker invocation in updated emscripten
Fixed building emscriptenPackages.zlib and emscriptenPackages.json_c under updated emscripten
@khovansky-al
Copy link
Contributor Author

Just realized llvmPackages_git is not supposed to be used for nixpkgs. Well, guess this is not going to work.


patches = [
# Adds --minimize-wasm-changes option required by emscripten 2.0.1
(fetchpatch {
Copy link
Member

Choose a reason for hiding this comment

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

Please remove the unused fetchpatch from inputs.

nativeBuildInputs = [ makeWrapper ];
buildInputs = [ nodejs python3 ];

resourceDir = "${llvmEnv}/lib/clang/13.0.0/";
Copy link
Member

Choose a reason for hiding this comment

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

Please substitute the version number.

Comment on lines +50 to +53
substituteInPlace emcc.py \
--replace \
"['--sysroot=' + shared.Cache.get_sysroot(absolute=True)]" \
"['--sysroot=' + shared.Cache.get_sysroot(absolute=True), '-resource-dir=${resourceDir}', '-idirafter' + shared.Cache.get_sysroot(absolute=True) + os.path.join('/include'), '-iwithsysroot' + os.path.join('/include','c++','v1')]"
Copy link
Member

Choose a reason for hiding this comment

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

Maybe we should use a patch instead.

@yu-re-ka
Copy link
Contributor

yu-re-ka commented Aug 4, 2021

LLVM 13.0.0rc1 is now in master

@yu-re-ka
Copy link
Contributor

yu-re-ka commented Aug 7, 2021

I have a seemingly working emscripten 2.0.26 on my local branch, should I push it to this PR or create a new one @khovansky-al ?

@khovansky-al
Copy link
Contributor Author

@yu-re-ka thanks for taking on this. Feel free to open a new PR, I'll close this one in favor of yours. A bit busy with other things these days and probably won't have time to sit down and properly finish this for another week or two.

P.S. appreciate the attribution in your branch's commits. For Github to pick it up though I think the trailer should be Co-authored-by: ....

@yu-re-ka
Copy link
Contributor

yu-re-ka commented Aug 9, 2021

https://github.com/NixOS/nixpkgs/pull/133217/commits

@yu-re-ka yu-re-ka mentioned this pull request Aug 9, 2021
11 tasks
@Janik-Haag Janik-Haag added the 12.first-time contribution This PR is the author's first one; please be gentle! label Jun 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

12.first-time contribution This PR is the author's first one; please be gentle!

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants