Skip to content

Firefox WASM stuff does not build with LLVM 19 #352724

@emilazy

Description

@emilazy

After applying the following diff (the wasilibc bump is required for LLVM 19 compatibility):

diff --git a/pkgs/development/libraries/wasilibc/default.nix b/pkgs/development/libraries/wasilibc/default.nix
index c0714a7855..82df25395f 100644
--- a/pkgs/development/libraries/wasilibc/default.nix
+++ b/pkgs/development/libraries/wasilibc/default.nix
@@ -8,7 +8,7 @@
 
 let
   pname = "wasilibc";
-  version = "21";
+  version = "22-unstable-2024-10-16";
 in
 stdenv.mkDerivation {
   inherit pname version;
@@ -16,8 +16,8 @@
   src = buildPackages.fetchFromGitHub {
     owner = "WebAssembly";
     repo = "wasi-libc";
-    rev = "refs/tags/wasi-sdk-${version}";
-    hash = "sha256-1LsMpO29y79twVrUsuM/JvC7hK8O6Yey4Ard/S3Mvvc=";
+    rev = "98897e29fcfc81e2b12e487e4154ac99188330c4";
+    hash = "sha256-NFKhMJj/quvN3mR7lmxzA9w46KhX92iG0rQA9qDeS8I=";
     fetchSubmodules = true;
   };
 
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index e15dae715d..5c17cad75b 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -15160,18 +15160,7 @@
   libllvm = llvmPackages.libllvm;
   llvm-manpages = llvmPackages.llvm-manpages;
 
-  # Please remove all this logic when bumping to LLVM 19 and make this
-  # a simple alias.
-  llvmPackages = let
-    # This returns the minimum supported version for the platform. The
-    # assumption is that or any later version is good.
-    choose = platform: if platform.isDarwin then 16 else 18;
-    # We take the "max of the mins". Why? Since those are lower bounds of the
-    # supported version set, this is like intersecting those sets and then
-    # taking the min bound of that.
-    minSupported = toString (lib.trivial.max (choose stdenv.hostPlatform) (choose
-      stdenv.targetPlatform));
-  in pkgs.${"llvmPackages_${minSupported}"};
+  llvmPackages = llvmPackages_19;
 
   llvmPackages_12 = recurseIntoAttrs (callPackage ../development/compilers/llvm/12 {
     inherit (stdenvAdapters) overrideCC;

Firefox fails to build like this (on aarch64-linux, but I suspect the platform doesn’t matter given that we’re talking about WASM here):

firefox-unwrapped> /nix/store/g8ch7m48ag0ykyb9v4q0zzng8p084nj1-wasm32-unknown-wasi-clang-wrapper-19.1.1/bin/wasm32-unknown-wasi-c++ --sysroot=/nix/store/4ckh79sljl9cdkg04hf30d9qym87cxj2-wasi-sysroot -o rlbox.wasm -Wl,--export-all -Wl,--stack-first -Wl,-z,stack-size=262144 -Wl,--no-entry -Wl,--import-memory -Wl,--import-table ogg_alloc.wasm ogg_bitwise.wasm ogg_framing.wasm xmlparse.wasm xmlrole.wasm xmltok.wasm wasm2c_sandbox_wrapper.wasm mozHunspellRLBoxSandbox.wasm affentry.wasm affixmgr.wasm csutil.wasm hashmgr.wasm hunspell.wasm phonet.wasm replist.wasm suggestmgr.wasm GraphiteExtra.wasm CmapCache.wasm Code.wasm Collider.wasm Decompressor.wasm Face.wasm FeatureMap.wasm Font.wasm GlyphCache.wasm GlyphFace.wasm Intervals.wasm Justifier.wasm NameTable.wasm Pass.wasm Position.wasm Segment.wasm Silf.wasm Slot.wasm Sparse.wasm TtfUtil.wasm UtfCodec.wasm call_machine.wasm gr_char_info.wasm gr_face.wasm gr_features.wasm gr_font.wasm gr_segment.wasm gr_slot.wasm mozalloc.wasm RLBoxWOFF2Sandbox.wasm table_tags.wasm variable_length.wasm woff2_common.wasm woff2_dec.wasm woff2_out.wasm -lwasi-emulated-process-clocks
firefox-unwrapped> wasm-ld: error: /nix/store/qji2vfkskjvc51xh25hv4lx1sf3j76jd-wasilibc-static-wasm32-unknown-wasi-22-unstable-2024-10-16/lib/crt1-command.o: undefined symbol: __indirect_function_table
firefox-unwrapped> wasm-ld: error: /nix/store/qji2vfkskjvc51xh25hv4lx1sf3j76jd-wasilibc-static-wasm32-unknown-wasi-22-unstable-2024-10-16/lib/crt1-command.o: undefined symbol: __indirect_function_table
firefox-unwrapped> wasm-ld: error: /nix/store/qji2vfkskjvc51xh25hv4lx1sf3j76jd-wasilibc-static-wasm32-unknown-wasi-22-unstable-2024-10-16/lib/crt1-command.o: undefined symbol: __indirect_function_table
firefox-unwrapped> wasm-ld: error: /nix/store/qji2vfkskjvc51xh25hv4lx1sf3j76jd-wasilibc-static-wasm32-unknown-wasi-22-unstable-2024-10-16/lib/crt1-command.o: undefined symbol: __indirect_function_table
firefox-unwrapped> wasm-ld: error: /nix/store/qji2vfkskjvc51xh25hv4lx1sf3j76jd-wasilibc-static-wasm32-unknown-wasi-22-unstable-2024-10-16/lib/crt1-command.o: undefined symbol: __indirect_function_table
firefox-unwrapped> wasm-ld: error: /nix/store/qji2vfkskjvc51xh25hv4lx1sf3j76jd-wasilibc-static-wasm32-unknown-wasi-22-unstable-2024-10-16/lib/crt1-command.o: undefined symbol: __indirect_function_table
firefox-unwrapped> wasm-ld: error: /nix/store/qji2vfkskjvc51xh25hv4lx1sf3j76jd-wasilibc-static-wasm32-unknown-wasi-22-unstable-2024-10-16/lib/crt1-command.o: undefined symbol: __indirect_function_table
firefox-unwrapped> wasm-ld: error: /nix/store/qji2vfkskjvc51xh25hv4lx1sf3j76jd-wasilibc-static-wasm32-unknown-wasi-22-unstable-2024-10-16/lib/crt1-command.o: undefined symbol: __indirect_function_table
firefox-unwrapped> wasm-ld: error: /nix/store/qji2vfkskjvc51xh25hv4lx1sf3j76jd-wasilibc-static-wasm32-unknown-wasi-22-unstable-2024-10-16/lib/crt1-command.o: undefined symbol: __indirect_function_table
firefox-unwrapped> wasm-ld: error: /nix/store/qji2vfkskjvc51xh25hv4lx1sf3j76jd-wasilibc-static-wasm32-unknown-wasi-22-unstable-2024-10-16/lib/crt1-command.o: undefined symbol: __indirect_function_table
firefox-unwrapped> wasm-ld: error: /nix/store/qji2vfkskjvc51xh25hv4lx1sf3j76jd-wasilibc-static-wasm32-unknown-wasi-22-unstable-2024-10-16/lib/crt1-command.o: undefined symbol: __indirect_function_table
firefox-unwrapped> wasm-ld: error: /nix/store/qji2vfkskjvc51xh25hv4lx1sf3j76jd-wasilibc-static-wasm32-unknown-wasi-22-unstable-2024-10-16/lib/crt1-command.o: undefined symbol: __indirect_function_table
firefox-unwrapped> wasm-ld: error: /nix/store/qji2vfkskjvc51xh25hv4lx1sf3j76jd-wasilibc-static-wasm32-unknown-wasi-22-unstable-2024-10-16/lib/crt1-command.o: undefined symbol: __indirect_function_table
firefox-unwrapped> wasm-ld: error: /nix/store/qji2vfkskjvc51xh25hv4lx1sf3j76jd-wasilibc-static-wasm32-unknown-wasi-22-unstable-2024-10-16/lib/crt1-command.o: undefined symbol: __indirect_function_table
firefox-unwrapped> wasm-ld: error: /nix/store/qji2vfkskjvc51xh25hv4lx1sf3j76jd-wasilibc-static-wasm32-unknown-wasi-22-unstable-2024-10-16/lib/crt1-command.o: undefined symbol: __indirect_function_table
firefox-unwrapped> wasm-ld: error: /nix/store/qji2vfkskjvc51xh25hv4lx1sf3j76jd-wasilibc-static-wasm32-unknown-wasi-22-unstable-2024-10-16/lib/crt1-command.o: undefined symbol: __indirect_function_table
firefox-unwrapped> wasm-ld: error: /nix/store/qji2vfkskjvc51xh25hv4lx1sf3j76jd-wasilibc-static-wasm32-unknown-wasi-22-unstable-2024-10-16/lib/crt1-command.o: undefined symbol: __indirect_function_table
firefox-unwrapped> wasm-ld: error: /nix/store/qji2vfkskjvc51xh25hv4lx1sf3j76jd-wasilibc-static-wasm32-unknown-wasi-22-unstable-2024-10-16/lib/crt1-command.o: undefined symbol: __indirect_function_table
firefox-unwrapped> wasm-ld: error: /nix/store/qji2vfkskjvc51xh25hv4lx1sf3j76jd-wasilibc-static-wasm32-unknown-wasi-22-unstable-2024-10-16/lib/crt1-command.o: undefined symbol: __indirect_function_table
firefox-unwrapped> wasm-ld: error: /nix/store/qji2vfkskjvc51xh25hv4lx1sf3j76jd-wasilibc-static-wasm32-unknown-wasi-22-unstable-2024-10-16/lib/crt1-command.o: undefined symbol: __indirect_function_table
firefox-unwrapped> wasm-ld: error: too many errors emitted, stopping now (use -error-limit=0 to see all errors)
firefox-unwrapped> clang++: error: linker command failed with exit code 1 (use -v to see invocation)

I have no idea why and this seems suboptimal. It will cause problems with the upcoming LLVM 19 bump unless we pin the version used for Firefox’s WASM stuff, which would be unfortunate.

cc @NixOS/llvm

Metadata

Metadata

Assignees

No one assigned

    Labels

    0.kind: bugSomething is broken6.topic: llvm/clangIssues related to llvmPackages, clangStdenv and related

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions