Skip to content

Commit

Permalink
wasilibc: 19 -> 20
Browse files Browse the repository at this point in the history
pkgsCross.wasi32.llvmPackages: 12 -> 16

* It appears BULK_MEMORY_SOURCES no longer needs to be set to be empty
  to compile firefox. Without it, the build of wasilibc would fail if
  enableThreads is true.

* Include preliminary support for the experimental threads support in
  wasilibc which provides pthreads API. If wasilibc is built with
  support, is exposed via passthru and libcxx / libcxxabi are built with
  threads support accordingly.

  See also:
  - WebAssembly/wasi-sdk#274
  - WebAssembly/wasi-sdk#301
  - WebAssembly/wasi-sdk#314

  wasi-sdk ships it by default, but as a separate variant of libc which
  would be a hassle for us. Let's just make it optional for now.

  You can try it out using the following overlay:

      self: super: {
        wasilibc = super.wasilibc.override { enableThreads = true; };
      }

  Flags for libc++abi are copied from wasi-sdk.
  • Loading branch information
sternenseemann authored and dmjio committed Apr 27, 2024
1 parent 77759bd commit 4725da5
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions pkgs/development/libraries/wasilibc/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
, buildPackages
, fetchFromGitHub
, lib
# Enable experimental wasilibc pthread support
, enableThreads ? false
# For tests
, firefox-unwrapped
, firefox-esr-unwrapped
}:
Expand Down Expand Up @@ -38,8 +41,7 @@ stdenv.mkDerivation {
"SYSROOT_LIB:=$SYSROOT_LIB"
"SYSROOT_INC:=$SYSROOT_INC"
"SYSROOT_SHARE:=$SYSROOT_SHARE"
# https://bugzilla.mozilla.org/show_bug.cgi?id=1773200
"BULK_MEMORY_SOURCES:="
"THREAD_MODEL=${if enableThreads then "posix" else "single"}"
)
'';
Expand All @@ -53,8 +55,11 @@ stdenv.mkDerivation {
ln -s $share/share/undefined-symbols.txt $out/lib/wasi.imports
'';

passthru.tests = {
inherit firefox-unwrapped firefox-esr-unwrapped;
passthru = {
tests = {
inherit firefox-unwrapped firefox-esr-unwrapped;
};
hasThreads = enableThreads;
};

meta = with lib; {
Expand Down

0 comments on commit 4725da5

Please sign in to comment.