Skip to content

Commit 85fbd80

Browse files
committed
build(web): Build the wasm FFmpeg with -pthread so it links into the threaded module
1 parent 036b40d commit 85fbd80

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

scripts/build/web/build-ffmpeg-wasm.sh

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,10 @@ cd "${src}"
5151

5252
# Same shape as the Linux script: --disable-everything, then re-enable only the
5353
# file protocol and the demuxers/decoders the game actually plays. Static, since
54-
# a wasm module links everything in, and without threads or assembly.
54+
# a wasm module links everything in, and without FFmpeg's own threading or assembly.
55+
# -pthread is still required: the game module is built with threads, and wasm-ld
56+
# refuses to put objects lacking the atomics/bulk-memory features into a
57+
# shared-memory module.
5558
emconfigure ./configure \
5659
--prefix="${prefix}" \
5760
--enable-static --disable-shared \
@@ -65,7 +68,8 @@ emconfigure ./configure \
6568
--enable-parser=h264,hevc,mpeg4video,mpegvideo,vp8,vp9,vorbis,aac,ac3 \
6669
--enable-cross-compile --target-os=none --arch=x86_32 \
6770
--disable-asm --disable-inline-asm --disable-pthreads --disable-autodetect \
68-
--nm=llvm-nm --ar=emar --ranlib=emranlib --cc=emcc --cxx=em++
71+
--nm=llvm-nm --ar=emar --ranlib=emranlib --cc=emcc --cxx=em++ \
72+
--extra-cflags="-pthread" --extra-ldflags="-pthread"
6973

7074
emmake make -j"$(nproc)"
7175
emmake make install

0 commit comments

Comments
 (0)