[Bug 2033572] [NEW] WASI libc++ contains undefined exception-related symbols

Daniel Richard G. 2033572 at bugs.launchpad.net
Thu Aug 31 02:50:55 UTC 2023


Public bug reported:

This concerns libc++-16-dev-wasm32 1:16.0.6-10 in Ubuntu mantic, and
also applies to libc++-15-dev-wasm32 1:15.0.7-3ubuntu0.23.04.1 in Ubuntu
lunar. (Both are the default versions for each respective release.)

In the course of building Firefox, I encountered this error:

----begin build log excerpt----
    make[3]: Entering directory '/tmp/firefox-117.0/build-browser/security/rlbox'
    security/rlbox/rlbox.wasm
    rm -f rlbox.wasm
    /usr/bin/clang++ --target=wasm32-wasi -o rlbox.wasm -Wl,--export-all -Wl,--stack-first -Wl,-z,stack-size=262144 -Wl,--no-entry -Wl,--growable-table -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
    wasm-ld-16: error: /usr/lib/wasm32-wasi/libc++.a(stdlib_new_delete.cpp.o): undefined symbol: __cxa_allocate_exception
    wasm-ld-16: error: /usr/lib/wasm32-wasi/libc++.a(stdlib_new_delete.cpp.o): undefined symbol: __cxa_throw
    wasm-ld-16: error: /usr/lib/wasm32-wasi/libc++.a(stdlib_new_delete.cpp.o): undefined symbol: __cxa_allocate_exception
    wasm-ld-16: error: /usr/lib/wasm32-wasi/libc++.a(stdlib_new_delete.cpp.o): undefined symbol: __cxa_throw
    wasm-ld-16: error: /usr/lib/wasm32-wasi/libc++.a(stdlib_new_delete.cpp.o): undefined symbol: __cxa_allocate_exception
    wasm-ld-16: error: /usr/lib/wasm32-wasi/libc++.a(stdlib_new_delete.cpp.o): undefined symbol: __cxa_throw
    wasm-ld-16: error: /usr/lib/wasm32-wasi/libc++.a(stdlib_new_delete.cpp.o): undefined symbol: __cxa_allocate_exception
    wasm-ld-16: error: /usr/lib/wasm32-wasi/libc++.a(stdlib_new_delete.cpp.o): undefined symbol: __cxa_throw
    wasm-ld-16: error: /usr/lib/wasm32-wasi/libc++.a(stdlib_new_delete.cpp.o): undefined symbol: __cxa_allocate_exception
    wasm-ld-16: error: /usr/lib/wasm32-wasi/libc++.a(stdlib_new_delete.cpp.o): undefined symbol: __cxa_throw
    wasm-ld-16: error: /usr/lib/wasm32-wasi/libc++.a(stdlib_new_delete.cpp.o): undefined symbol: __cxa_allocate_exception
    wasm-ld-16: error: /usr/lib/wasm32-wasi/libc++.a(stdlib_new_delete.cpp.o): undefined symbol: __cxa_throw
    wasm-ld-16: error: /usr/lib/wasm32-wasi/libc++.a(stdlib_new_delete.cpp.o): undefined symbol: __cxa_allocate_exception
    wasm-ld-16: error: /usr/lib/wasm32-wasi/libc++.a(stdlib_new_delete.cpp.o): undefined symbol: __cxa_throw
    wasm-ld-16: error: /usr/lib/wasm32-wasi/libc++.a(stdlib_new_delete.cpp.o): undefined symbol: __cxa_allocate_exception
    wasm-ld-16: error: /usr/lib/wasm32-wasi/libc++.a(stdlib_new_delete.cpp.o): undefined symbol: __cxa_throw
    wasm-ld-16: error: /usr/lib/wasm32-wasi/libc++.a(stdlib_new_delete.cpp.o): undefined symbol: __cxa_allocate_exception
    wasm-ld-16: error: /usr/lib/wasm32-wasi/libc++.a(stdlib_new_delete.cpp.o): undefined symbol: __cxa_throw
    wasm-ld-16: error: /usr/lib/wasm32-wasi/libc++.a(ios.cpp.o): undefined symbol: __cxa_rethrow
    wasm-ld-16: error: /usr/lib/wasm32-wasi/libc++.a(ios.cpp.o): undefined symbol: __cxa_rethrow
    wasm-ld-16: error: too many errors emitted, stopping now (use -error-limit=0 to see all errors)
    clang: error: linker command failed with exit code 1 (use -v to see invocation)
    make[3]: *** [/tmp/firefox-117.0/config/rules.mk:496: rlbox.wasm] Error 1
    make[3]: Leaving directory '/tmp/firefox-117.0/build-browser/security/rlbox'
    make[2]: *** [/tmp/firefox-117.0/config/recurse.mk:72: security/rlbox/pre-compile] Error 2
    make[2]: Leaving directory '/tmp/firefox-117.0/build-browser'
    make[1]: *** [/tmp/firefox-117.0/config/recurse.mk:34: compile] Error 2
    make[1]: Leaving directory '/tmp/firefox-117.0/build-browser'
    make: *** [/tmp/firefox-117.0/config/rules.mk:361: default] Error 2
----begin build log excerpt----

If we look inside the WASI libc++ library for __cxa_allocate_exception
(as just one example), we see several references to it and no
definitions, just as the linker is complaining:

    $ llvm-nm -A /usr/lib/wasm32-wasi/libc++.a | grep __cxa_allocate_exception
    /usr/lib/wasm32-wasi/libc++.a:cxa_aux_runtime.cpp.o:          U __cxa_allocate_exception
    /usr/lib/wasm32-wasi/libc++.a:cxa_vector.cpp.o:          U __cxa_allocate_exception
    /usr/lib/wasm32-wasi/libc++.a:stdlib_new_delete.cpp.o:          U __cxa_allocate_exception
    /usr/lib/wasm32-wasi/libc++.a:atomic.cpp.o: no symbols
    /usr/lib/wasm32-wasi/libc++.a:barrier.cpp.o: no symbols
    /usr/lib/wasm32-wasi/libc++.a:condition_variable.cpp.o: no symbols
    /usr/lib/wasm32-wasi/libc++.a:condition_variable_destructor.cpp.o: no symbols
    /usr/lib/wasm32-wasi/libc++.a:future.cpp.o: no symbols
    /usr/lib/wasm32-wasi/libc++.a:hash.cpp.o:          U __cxa_allocate_exception
    /usr/lib/wasm32-wasi/libc++.a:mutex_destructor.cpp.o: no symbols
    /usr/lib/wasm32-wasi/libc++.a:new.cpp.o:          U __cxa_allocate_exception
    /usr/lib/wasm32-wasi/libc++.a:shared_mutex.cpp.o: no symbols
    /usr/lib/wasm32-wasi/libc++.a:string.cpp.o:          U __cxa_allocate_exception
    /usr/lib/wasm32-wasi/libc++.a:thread.cpp.o: no symbols
    /usr/lib/wasm32-wasi/libc++.a:typeinfo.cpp.o: no symbols
    /usr/lib/wasm32-wasi/libc++.a:system_error.cpp.o:          U __cxa_allocate_exception
    /usr/lib/wasm32-wasi/libc++.a:vector.cpp.o: no symbols
    /usr/lib/wasm32-wasi/libc++.a:valarray.cpp.o:          U __cxa_allocate_exception
    /usr/lib/wasm32-wasi/libc++.a:ios.cpp.o:          U __cxa_allocate_exception
    /usr/lib/wasm32-wasi/libc++.a:ios.instantiations.cpp.o:          U __cxa_allocate_exception
    /usr/lib/wasm32-wasi/libc++.a:locale.cpp.o:          U __cxa_allocate_exception

Here is that same command, run on Debian unstable:

    $ llvm-nm -A /usr/lib/wasm32-wasi/libc++.a | grep __cxa_allocate_exception
    /usr/lib/wasm32-wasi/libc++.a:atomic.cpp.o: no symbols
    /usr/lib/wasm32-wasi/libc++.a:barrier.cpp.o: no symbols
    /usr/lib/wasm32-wasi/libc++.a:condition_variable.cpp.o: no symbols
    /usr/lib/wasm32-wasi/libc++.a:condition_variable_destructor.cpp.o: no symbols
    /usr/lib/wasm32-wasi/libc++.a:future.cpp.o: no symbols
    /usr/lib/wasm32-wasi/libc++.a:mutex_destructor.cpp.o: no symbols
    /usr/lib/wasm32-wasi/libc++.a:shared_mutex.cpp.o: no symbols
    /usr/lib/wasm32-wasi/libc++.a:thread.cpp.o: no symbols
    /usr/lib/wasm32-wasi/libc++.a:typeinfo.cpp.o: no symbols
    /usr/lib/wasm32-wasi/libc++.a:vector.cpp.o: no symbols

I don't get the link error on Debian unstable. Something is wrong with
how the WASI C++ library is being built for Ubuntu.

** Affects: llvm-toolchain-15 (Ubuntu)
     Importance: Undecided
         Status: New

** Affects: llvm-toolchain-16 (Ubuntu)
     Importance: Undecided
         Status: New


** Tags: lunar mantic

** Also affects: llvm-toolchain-15 (Ubuntu)
   Importance: Undecided
       Status: New

-- 
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to llvm-toolchain-16 in Ubuntu.
https://bugs.launchpad.net/bugs/2033572

Title:
  WASI libc++ contains undefined exception-related symbols

Status in llvm-toolchain-15 package in Ubuntu:
  New
Status in llvm-toolchain-16 package in Ubuntu:
  New

Bug description:
  This concerns libc++-16-dev-wasm32 1:16.0.6-10 in Ubuntu mantic, and
  also applies to libc++-15-dev-wasm32 1:15.0.7-3ubuntu0.23.04.1 in
  Ubuntu lunar. (Both are the default versions for each respective
  release.)

  In the course of building Firefox, I encountered this error:

  ----begin build log excerpt----
      make[3]: Entering directory '/tmp/firefox-117.0/build-browser/security/rlbox'
      security/rlbox/rlbox.wasm
      rm -f rlbox.wasm
      /usr/bin/clang++ --target=wasm32-wasi -o rlbox.wasm -Wl,--export-all -Wl,--stack-first -Wl,-z,stack-size=262144 -Wl,--no-entry -Wl,--growable-table -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
      wasm-ld-16: error: /usr/lib/wasm32-wasi/libc++.a(stdlib_new_delete.cpp.o): undefined symbol: __cxa_allocate_exception
      wasm-ld-16: error: /usr/lib/wasm32-wasi/libc++.a(stdlib_new_delete.cpp.o): undefined symbol: __cxa_throw
      wasm-ld-16: error: /usr/lib/wasm32-wasi/libc++.a(stdlib_new_delete.cpp.o): undefined symbol: __cxa_allocate_exception
      wasm-ld-16: error: /usr/lib/wasm32-wasi/libc++.a(stdlib_new_delete.cpp.o): undefined symbol: __cxa_throw
      wasm-ld-16: error: /usr/lib/wasm32-wasi/libc++.a(stdlib_new_delete.cpp.o): undefined symbol: __cxa_allocate_exception
      wasm-ld-16: error: /usr/lib/wasm32-wasi/libc++.a(stdlib_new_delete.cpp.o): undefined symbol: __cxa_throw
      wasm-ld-16: error: /usr/lib/wasm32-wasi/libc++.a(stdlib_new_delete.cpp.o): undefined symbol: __cxa_allocate_exception
      wasm-ld-16: error: /usr/lib/wasm32-wasi/libc++.a(stdlib_new_delete.cpp.o): undefined symbol: __cxa_throw
      wasm-ld-16: error: /usr/lib/wasm32-wasi/libc++.a(stdlib_new_delete.cpp.o): undefined symbol: __cxa_allocate_exception
      wasm-ld-16: error: /usr/lib/wasm32-wasi/libc++.a(stdlib_new_delete.cpp.o): undefined symbol: __cxa_throw
      wasm-ld-16: error: /usr/lib/wasm32-wasi/libc++.a(stdlib_new_delete.cpp.o): undefined symbol: __cxa_allocate_exception
      wasm-ld-16: error: /usr/lib/wasm32-wasi/libc++.a(stdlib_new_delete.cpp.o): undefined symbol: __cxa_throw
      wasm-ld-16: error: /usr/lib/wasm32-wasi/libc++.a(stdlib_new_delete.cpp.o): undefined symbol: __cxa_allocate_exception
      wasm-ld-16: error: /usr/lib/wasm32-wasi/libc++.a(stdlib_new_delete.cpp.o): undefined symbol: __cxa_throw
      wasm-ld-16: error: /usr/lib/wasm32-wasi/libc++.a(stdlib_new_delete.cpp.o): undefined symbol: __cxa_allocate_exception
      wasm-ld-16: error: /usr/lib/wasm32-wasi/libc++.a(stdlib_new_delete.cpp.o): undefined symbol: __cxa_throw
      wasm-ld-16: error: /usr/lib/wasm32-wasi/libc++.a(stdlib_new_delete.cpp.o): undefined symbol: __cxa_allocate_exception
      wasm-ld-16: error: /usr/lib/wasm32-wasi/libc++.a(stdlib_new_delete.cpp.o): undefined symbol: __cxa_throw
      wasm-ld-16: error: /usr/lib/wasm32-wasi/libc++.a(ios.cpp.o): undefined symbol: __cxa_rethrow
      wasm-ld-16: error: /usr/lib/wasm32-wasi/libc++.a(ios.cpp.o): undefined symbol: __cxa_rethrow
      wasm-ld-16: error: too many errors emitted, stopping now (use -error-limit=0 to see all errors)
      clang: error: linker command failed with exit code 1 (use -v to see invocation)
      make[3]: *** [/tmp/firefox-117.0/config/rules.mk:496: rlbox.wasm] Error 1
      make[3]: Leaving directory '/tmp/firefox-117.0/build-browser/security/rlbox'
      make[2]: *** [/tmp/firefox-117.0/config/recurse.mk:72: security/rlbox/pre-compile] Error 2
      make[2]: Leaving directory '/tmp/firefox-117.0/build-browser'
      make[1]: *** [/tmp/firefox-117.0/config/recurse.mk:34: compile] Error 2
      make[1]: Leaving directory '/tmp/firefox-117.0/build-browser'
      make: *** [/tmp/firefox-117.0/config/rules.mk:361: default] Error 2
  ----begin build log excerpt----

  If we look inside the WASI libc++ library for __cxa_allocate_exception
  (as just one example), we see several references to it and no
  definitions, just as the linker is complaining:

      $ llvm-nm -A /usr/lib/wasm32-wasi/libc++.a | grep __cxa_allocate_exception
      /usr/lib/wasm32-wasi/libc++.a:cxa_aux_runtime.cpp.o:          U __cxa_allocate_exception
      /usr/lib/wasm32-wasi/libc++.a:cxa_vector.cpp.o:          U __cxa_allocate_exception
      /usr/lib/wasm32-wasi/libc++.a:stdlib_new_delete.cpp.o:          U __cxa_allocate_exception
      /usr/lib/wasm32-wasi/libc++.a:atomic.cpp.o: no symbols
      /usr/lib/wasm32-wasi/libc++.a:barrier.cpp.o: no symbols
      /usr/lib/wasm32-wasi/libc++.a:condition_variable.cpp.o: no symbols
      /usr/lib/wasm32-wasi/libc++.a:condition_variable_destructor.cpp.o: no symbols
      /usr/lib/wasm32-wasi/libc++.a:future.cpp.o: no symbols
      /usr/lib/wasm32-wasi/libc++.a:hash.cpp.o:          U __cxa_allocate_exception
      /usr/lib/wasm32-wasi/libc++.a:mutex_destructor.cpp.o: no symbols
      /usr/lib/wasm32-wasi/libc++.a:new.cpp.o:          U __cxa_allocate_exception
      /usr/lib/wasm32-wasi/libc++.a:shared_mutex.cpp.o: no symbols
      /usr/lib/wasm32-wasi/libc++.a:string.cpp.o:          U __cxa_allocate_exception
      /usr/lib/wasm32-wasi/libc++.a:thread.cpp.o: no symbols
      /usr/lib/wasm32-wasi/libc++.a:typeinfo.cpp.o: no symbols
      /usr/lib/wasm32-wasi/libc++.a:system_error.cpp.o:          U __cxa_allocate_exception
      /usr/lib/wasm32-wasi/libc++.a:vector.cpp.o: no symbols
      /usr/lib/wasm32-wasi/libc++.a:valarray.cpp.o:          U __cxa_allocate_exception
      /usr/lib/wasm32-wasi/libc++.a:ios.cpp.o:          U __cxa_allocate_exception
      /usr/lib/wasm32-wasi/libc++.a:ios.instantiations.cpp.o:          U __cxa_allocate_exception
      /usr/lib/wasm32-wasi/libc++.a:locale.cpp.o:          U __cxa_allocate_exception

  Here is that same command, run on Debian unstable:

      $ llvm-nm -A /usr/lib/wasm32-wasi/libc++.a | grep __cxa_allocate_exception
      /usr/lib/wasm32-wasi/libc++.a:atomic.cpp.o: no symbols
      /usr/lib/wasm32-wasi/libc++.a:barrier.cpp.o: no symbols
      /usr/lib/wasm32-wasi/libc++.a:condition_variable.cpp.o: no symbols
      /usr/lib/wasm32-wasi/libc++.a:condition_variable_destructor.cpp.o: no symbols
      /usr/lib/wasm32-wasi/libc++.a:future.cpp.o: no symbols
      /usr/lib/wasm32-wasi/libc++.a:mutex_destructor.cpp.o: no symbols
      /usr/lib/wasm32-wasi/libc++.a:shared_mutex.cpp.o: no symbols
      /usr/lib/wasm32-wasi/libc++.a:thread.cpp.o: no symbols
      /usr/lib/wasm32-wasi/libc++.a:typeinfo.cpp.o: no symbols
      /usr/lib/wasm32-wasi/libc++.a:vector.cpp.o: no symbols

  I don't get the link error on Debian unstable. Something is wrong with
  how the WASI C++ library is being built for Ubuntu.

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/llvm-toolchain-15/+bug/2033572/+subscriptions




More information about the foundations-bugs mailing list