WebAssembly / WebAssembly/wasi-libc

wasi-libc fails to link --target=wasm32-wasip1 with undefined symbol: __muloti4

Open
#733 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C
Stars
1k
Forks
251
Avg merge
7h 15m
Merged PRs (30d)
3

Description

hello everyone,

I used to bootstrap a wasm32-wasi toolchain for llvm-18, llvm-19, llvm-20 and llvm-21 without any issues. llvm-22 started to ask for wasm32-wasip1, but this fails:

llvm-ar --format=gnu crs build/wasm32-wasip1/libc.so.a build/wasm32-wasip1/libc-top-half/musl/src/time/wcsftime.pic.o build/wasm32-wasip1/libc-top-half/musl/src/unistd/gethostname.pic.o build/wasm32-wasip1/libc-top-half/musl/src/unistd/posix_close.pic.o build/wasm32-wasip1/libc-top-half/sources/arc4random.pic.o build/wasm32-wasip1/thread-stub/pthread_barrier_destroy.pic.o build/wasm32-wasip1/thread-stub/pthread_barrier_init.pic.o build/wasm32-wasip1/thread-stub/pthread_barrier_wait.pic.o build/wasm32-wasip1/thread-stub/pthread_cond_broadcast.pic.o build/wasm32-wasip1/thread-stub/pthread_cond_destroy.pic.o build/wasm32-wasip1/thread-stub/pthread_cond_init.pic.o build/wasm32-wasip1/thread-stub/pthread_cond_signal.pic.o build/wasm32-wasip1/thread-stub/pthread_cond_timedwait.pic.o build/wasm32-wasip1/thread-stub/pthread_cond_wait.pic.o build/wasm32-wasip1/thread-stub/pthread_create.pic.o build/wasm32-wasip1/thread-stub/pthread_detach.pic.o build/wasm32-wasip1/thread-stub/pthread_join.pic.o build/wasm32-wasip1/thread-stub/pthread_mutex_consistent.pic.o build/wasm32-wasip1/thread-stub/pthread_mutex_getprioceiling.pic.o build/wasm32-wasip1/thread-stub/pthread_mutex_lock.pic.o build/wasm32-wasip1/thread-stub/pthread_mutex_timedlock.pic.o build/wasm32-wasip1/thread-stub/pthread_mutex_trylock.pic.o build/wasm32-wasip1/thread-stub/pthread_mutex_unlock.pic.o build/wasm32-wasip1/thread-stub/pthread_once.pic.o build/wasm32-wasip1/thread-stub/pthread_rwlock_rdlock.pic.o build/wasm32-wasip1/thread-stub/pthread_rwlock_timedrdlock.pic.o build/wasm32-wasip1/thread-stub/pthread_rwlock_timedwrlock.pic.o build/wasm32-wasip1/thread-stub/pthread_rwlock_tryrdlock.pic.o build/wasm32-wasip1/thread-stub/pthread_rwlock_trywrlock.pic.o build/wasm32-wasip1/thread-stub/pthread_rwlock_unlock.pic.o build/wasm32-wasip1/thread-stub/pthread_rwlock_wrlock.pic.o build/wasm32-wasip1/thread-stub/pthread_spin_lock.pic.o build/wasm32-wasip1/thread-stub/pthread_spin_trylock.pic.o build/wasm32-wasip1/thread-stub/pthread_spin_unlock.pic.o
clang --target=wasm32-wasip1 -nodefaultlibs \
-shared --sysroot=/var/tmp/portage/cross_llvm-wasm32-wasip1/wasi-libc-0_pre20251218/work/wasi-libc-0_pre20251218/sysroot \
-o /var/tmp/portage/cross_llvm-wasm32-wasip1/wasi-libc-0_pre20251218/work/wasi-libc-0_pre20251218/sysroot/lib/wasm32-wasip1/libc.so -Wl,--whole-archive build/wasm32-wasip1/libc.so.a -Wl,--no-whole-archive \
-Wl,--allow-undefined-file=linker-provided-symbols.txt \
build/wasm32-wasip1/resource-dir//lib/wasm32-unknown-wasip1/libclang_rt.builtins.a \
-O2 -DNDEBUG 
wasm-ld: warning: creating shared libraries, with -shared, is not yet stable
wasm-ld: error: build/wasm32-wasip1/libc.so.a(pselect.pic.o): undefined symbol: __muloti4
wasm-ld: error: build/wasm32-wasip1/libc.so.a(futimens.pic.o): undefined symbol: __muloti4
wasm-ld: error: build/wasm32-wasip1/libc.so.a(futimens.pic.o): undefined symbol: __muloti4
wasm-ld: error: build/wasm32-wasip1/libc.so.a(utimensat.pic.o): undefined symbol: __muloti4
wasm-ld: error: build/wasm32-wasip1/libc.so.a(utimensat.pic.o): undefined symbol: __muloti4
wasm-ld: error: build/wasm32-wasip1/libc.so.a(clock_nanosleep.pic.o): undefined symbol: __muloti4
wasm-ld: error: build/wasm32-wasip1/libc.so.a(cacosl.pic.o): undefined symbol: __subtf3
wasm-ld: error: build/wasm32-wasip1/libc.so.a(casinl.pic.o): undefined symbol: __subtf3
wasm-ld: error: build/wasm32-wasip1/libc.so.a(casinl.pic.o): undefined symbol: __addtf3
wasm-ld: error: build/wasm32-wasip1/libc.so.a(casinl.pic.o): undefined symbol: __multf3
wasm-ld: error: build/wasm32-wasip1/libc.so.a(casinl.pic.o): undefined symbol: __subtf3
wasm-ld: error: build/wasm32-wasip1/libc.so.a(casinl.pic.o): undefined symbol: __multf3
wasm-ld: error: build/wasm32-wasip1/libc.so.a(casinl.pic.o): undefined symbol: __multf3
wasm-ld: error: build/wasm32-wasip1/libc.so.a(casinl.pic.o): undefined symbol: __subtf3
wasm-ld: error: build/wasm32-wasip1/libc.so.a(casinl.pic.o): undefined symbol: __addtf3
wasm-ld: error: build/wasm32-wasip1/libc.so.a(catanl.pic.o): undefined symbol: __multf3
wasm-ld: error: build/wasm32-wasip1/libc.so.a(catanl.pic.o): undefined symbol: __subtf3
wasm-ld: error: build/wasm32-wasip1/libc.so.a(catanl.pic.o): undefined symbol: __multf3
wasm-ld: error: build/wasm32-wasip1/libc.so.a(catanl.pic.o): undefined symbol: __subtf3
wasm-ld: error: build/wasm32-wasip1/libc.so.a(catanl.pic.o): undefined symbol: __addtf3
wasm-ld: 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)

the full build log: build.log.gz

this is an amd64 machine, gcc-14.3.0, clang-22.1.0_rc1

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the reported clang --target=wasm32-wasip1 link command using the objects in build/wasm32-wasip1 and the referenced libclang_rt.builtins.a. Inspect build.log.gz and linker-provided-symbols.txt to trace the missing runtime symbols. Done means the libc.so link completes without the reported undefined symbols.

Written by the indexing model from the issue text.

Assessment

Tech stack
c, wasm
Domain
compilers, operating-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.