linux_wasm32 libleanrt.a seems to incorrectly refer to libuv symbols
Nobody has claimed this yet.
- Dominant language
- Lean
- Stars
- 9.2k
- Forks
- 990
- Avg merge
- 1d 17h
- Merged PRs (30d)
- 175
Description
Prerequisites
Please put an X between the brackets as you perform the following steps:
- Check that your issue is not already filed:
https://github.com/leanprover/lean4/issues - Reduce the issue to a minimal, self-contained, reproducible test case.
Avoid dependencies to Mathlib or Batteries. - Test your test case against the latest nightly release, for example on
https://live.lean-lang.org/#project=lean-nightly
(You can also use the settings there to switch to “Lean nightly”)
Description
linux_wasm32 libleanrt.a seems to incorrectly refer to libuv symbols
Context
I have a project based on Thea Brick's lean2wasm which I'm trying to upgrade to the latest Lean toolchain. I'm running into some errors during the final emscripten build step.
Steps to Reproduce
$ git clone git@github.com:ianh/lean2wasm.git lean2wasm
$ cd lean2wasm
$ lake build test
$ lake exe lean2wasm
Expected behavior:
The project builds as it did with the older version.
Actual behavior:
The project fails to build. There are various errors, but the relevant errors to this issue are:
error: undefined symbol: uv_fs_mkdtemp (referenced by root reference (e.g. compiled C/C++ code))
warning: _uv_fs_mkdtemp may need to be added to EXPORTED_FUNCTIONS if it arrives from a system library
error: undefined symbol: uv_fs_mkstemp (referenced by root reference (e.g. compiled C/C++ code))
warning: _uv_fs_mkstemp may need to be added to EXPORTED_FUNCTIONS if it arrives from a system library
error: undefined symbol: uv_os_tmpdir (referenced by root reference (e.g. compiled C/C++ code))
warning: _uv_os_tmpdir may need to be added to EXPORTED_FUNCTIONS if it arrives from a system library
error: undefined symbol: uv_strerror (referenced by root reference (e.g. compiled C/C++ code))
warning: _uv_strerror may need to be added to EXPORTED_FUNCTIONS if it arrives from a system library
The code tries to avoid using libuv if LEAN_EMSCRIPTEN is defined, so I'm assuming the WebAssembly libleanrt.a linking these symbols is not expected.
Versions
Lean 4.15.0
macOS 14.6.1
emcc (Emscripten gcc/clang-like replacement + linker emulating GNU ld) 3.1.57-git
Additional Information
The reason I think libleanrt.a is the one referencing these symbols is because I get the following output on my own project, which has different build settings:
wasm-ld: error: toolchains/lean-4.15.0-linux_wasm32/lib/lean/libleanrt.a(io.cpp.o): undefined symbol: uv_strerror
wasm-ld: error: toolchains/lean-4.15.0-linux_wasm32/lib/lean/libleanrt.a(io.cpp.o): undefined symbol: uv_os_tmpdir
wasm-ld: error: toolchains/lean-4.15.0-linux_wasm32/lib/lean/libleanrt.a(io.cpp.o): undefined symbol: uv_strerror
wasm-ld: error: toolchains/lean-4.15.0-linux_wasm32/lib/lean/libleanrt.a(io.cpp.o): undefined symbol: uv_fs_mkstemp
wasm-ld: error: toolchains/lean-4.15.0-linux_wasm32/lib/lean/libleanrt.a(io.cpp.o): undefined symbol: uv_os_tmpdir
wasm-ld: error: toolchains/lean-4.15.0-linux_wasm32/lib/lean/libleanrt.a(io.cpp.o): undefined symbol: uv_strerror
wasm-ld: error: toolchains/lean-4.15.0-linux_wasm32/lib/lean/libleanrt.a(io.cpp.o): undefined symbol: uv_fs_mkdtemp
Impact
Impact to anyone using the WebAssembly toolchain.
Add 👍 to issues you consider important. If others are impacted by this issue, please ask them to add 👍 to it.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the failure with the lean2wasm commands and inspect libleanrt.a, especially io.cpp.o, for references to libuv symbols when LEAN_EMSCRIPTEN is defined. The issue is done when the linux_wasm32 WebAssembly build completes without undefined uv_fs_mkdtemp, uv_fs_mkstemp, uv_os_tmpdir, or uv_strerror symbols.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- wasm
- Domain
- build-system, compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100