[FFmpeg-trac] #10009(ffmpeg:new): FFmpeg not buildable without pthreads?

FFmpeg trac at avcodec.org
Fri Nov 4 10:35:38 EET 2022


#10009: FFmpeg not buildable without pthreads?
--------------------------------------+----------------------------------
             Reporter:  Jozef Chutka  |                    Owner:  (none)
                 Type:  defect        |                   Status:  new
             Priority:  normal        |                Component:  ffmpeg
              Version:  unspecified   |               Resolution:
             Keywords:  pthreads      |               Blocked By:
             Blocking:                |  Reproduced by developer:  0
Analyzed by developer:  0             |
--------------------------------------+----------------------------------
Description changed by Jozef Chutka:

Old description:

> When configuring ffmpeg (2 days old master version 5661c87) with
> emscripten with flags `--disable-pthreads --disable-w32threads --disable-
> os2threads`:
>
> {{{
> emconfigure ./configure --target-os=none --arch=x86_32 --enable-cross-
> compile --enable-version3
>   --enable-zlib --enable-libopenh264...
>   --disable-x86asm --disable-inline-asm --disable-stripping
>   --disable-programs --disable-doc --disable-debug --disable-runtime-
> cpudetect
>   --disable-autodetect
>   --extra-cflags="-O3 -msimd128"
>   --extra-cxxflags="-O3 -msimd128"
>   --extra-ldflags="-O3 -msimd128"
>   --pkg-config-flags="--static"
>   --nm="llvm-nm" --ar=emar --ranlib=emranlib --cc=emcc --cxx=em++
> --objcc=emcc --dep-cc=emcc
>   --disable-pthreads --disable-w32threads --disable-os2threads
>
> emmake make -j
>
> emcc -O3 -msimd128 -I. -I./fftools -I$BUILD_DIR/include
>   -Llibavcodec -Llibavdevice ... -L$BUILD_DIR/lib
>   -Wno-deprecated-declarations -Wno-pointer-sign -Wno-implicit-int-float-
> conversion -Wno-switch -Wno-parentheses -Qunused-arguments
>   -lavdevice -lavfilter -lavformat -lavcodec -lswresample -lswscale
> -lavutil -lm ...
>   fftools/cmdutils.c fftools/ffmpeg.c fftools/ffmpeg_demux.c
> fftools/ffmpeg_filter.c fftools/ffmpeg_hw.c fftools/ffmpeg_mux.c
> fftools/ffmpeg_mux_init.c fftools/ffmpeg_opt.c fftools/objpool.c
> fftools/opt_common.c fftools/sync_queue.c fftools/thread_queue.c
>   -lworkerfs.js -s USE_SDL=2 -s INVOKE_RUN=0 -s EXIT_RUNTIME=1 -s
> MODULARIZE=1
>   -s EXPORT_NAME="createFFmpeg" -s EXPORTED_FUNCTIONS="[_main]" -s
> EXPORTED_RUNTIME_METHODS="[callMain, FS, WORKERFS]" -s
> INITIAL_MEMORY=128mb -s ENVIRONMENT=worker -o ffmpeg.js
> }}}
>
> Configure runs ok, however the following command fails with some phtread
> related errors:
>
> {{{
> fftools/ffmpeg_demux.c:358:5: error: call to undeclared function
> 'pthread_join'; ISO C99 and later do not support implicit function
> declarations [-Wimplicit-function-declaration]
>     pthread_join(d->thread, NULL);
>     ^
> fftools/ffmpeg_demux.c:358:5: note: did you mean 'pthread_kill'?
> /ffmpeg/modules/emsdk/upstream/emscripten/cache/sysroot/include/signal.h:226:5:
> note: 'pthread_kill' declared here
> int pthread_kill(pthread_t, int);
>     ^
> fftools/ffmpeg_demux.c:397:16: error: call to undeclared function
> 'pthread_create'; ISO C99 and later do not support implicit function
> declarations [-Wimplicit-function-declaration]
>     if ((ret = pthread_create(&d->thread, NULL, input_thread, d))) {
>                ^
> 2 errors generated.
> emcc: error: '/ffmpeg/modules/emsdk/upstream/bin/clang -target wasm32
> -unknown-emscripten -fignore-exceptions -fvisibility=default -mllvm
> -combiner-global-alias-analysis=false -mllvm -enable-emscripten-sjlj
> -mllvm -disable-lsr -DEMSCRIPTEN -Werror=implicit-function-declaration
> -I/ffmpeg/modules/emsdk/upstream/emscripten/cache/sysroot/include/SDL2
> --sysroot=/ffmpeg/modules/emsdk/upstream/emscripten/cache/sysroot -Xclang
> -iwithsysroot/include/compat -O3 -I/ffmpeg/build/include -msimd128 -I.
> -I./fftools -I/ffmpeg/build/include -Wno-deprecated-declarations -Wno-
> pointer-sign -Wno-implicit-int-float-conversion -Wno-switch -Wno-
> parentheses -Qunused-arguments fftools/ffmpeg_demux.c -c -o
> /tmp/emscripten_temp_0b3ma1cz/ffmpeg_demux_2.o' failed (returned 1)
> root at cs-1036883351707-default:/ffmpeg#
> }}}
>
> I can build a version with pthreads by removing `--disable-*threads`
> flags from emconfigure and adding `-pthread -s PROXY_TO_PTHREAD=1 -s -s
> USE_PTHREADS=1` into emcc.
>
> I tried various flags but could not get building single thread version.
> As I only have setup for emscripten build, I can not confirm if some more
> standard single thread build works or not. But having references to
> `pthread_create()` or `pthread_join()` seems suspicious.
>
> Can you please verify if single thread ffmpeg version is still buildable,
> and if so, do you have any idea what I am doing wrong?

New description:

 When configuring ffmpeg (2 days old master version 5661c87) with
 emscripten with flags `--disable-pthreads --disable-w32threads --disable-
 os2threads`:

 {{{
 emconfigure ./configure --target-os=none --arch=x86_32 --enable-cross-
 compile --enable-version3
   --enable-zlib --enable-libopenh264...
   --disable-x86asm --disable-inline-asm --disable-stripping
   --disable-programs --disable-doc --disable-debug --disable-runtime-
 cpudetect
   --disable-autodetect
   --extra-cflags="-O3 -msimd128"
   --extra-cxxflags="-O3 -msimd128"
   --extra-ldflags="-O3 -msimd128"
   --pkg-config-flags="--static"
   --nm="llvm-nm" --ar=emar --ranlib=emranlib --cc=emcc --cxx=em++
 --objcc=emcc --dep-cc=emcc
   --disable-pthreads --disable-w32threads --disable-os2threads

 emmake make -j

 emcc -O3 -msimd128 -I. -I./fftools -I$BUILD_DIR/include
   -Llibavcodec -Llibavdevice ... -L$BUILD_DIR/lib
   -Wno-deprecated-declarations -Wno-pointer-sign -Wno-implicit-int-float-
 conversion -Wno-switch -Wno-parentheses -Qunused-arguments
   -lavdevice -lavfilter -lavformat -lavcodec -lswresample -lswscale
 -lavutil -lm ...
   fftools/cmdutils.c fftools/ffmpeg.c fftools/ffmpeg_demux.c
 fftools/ffmpeg_filter.c fftools/ffmpeg_hw.c fftools/ffmpeg_mux.c
 fftools/ffmpeg_mux_init.c fftools/ffmpeg_opt.c fftools/objpool.c
 fftools/opt_common.c fftools/sync_queue.c fftools/thread_queue.c
   -lworkerfs.js -s USE_SDL=2 -s INVOKE_RUN=0 -s EXIT_RUNTIME=1 -s
 MODULARIZE=1
   -s EXPORT_NAME="createFFmpeg" -s EXPORTED_FUNCTIONS="[_main]" -s
 EXPORTED_RUNTIME_METHODS="[callMain, FS, WORKERFS]" -s
 INITIAL_MEMORY=128mb -s ENVIRONMENT=worker -o ffmpeg.js
 }}}

 Configure runs ok, however the following command fails with some phtread
 related errors:

 {{{
 fftools/ffmpeg_demux.c:358:5: error: call to undeclared function
 'pthread_join'; ISO C99 and later do not support implicit function
 declarations [-Wimplicit-function-declaration]
     pthread_join(d->thread, NULL);
     ^
 fftools/ffmpeg_demux.c:358:5: note: did you mean 'pthread_kill'?
 /ffmpeg/modules/emsdk/upstream/emscripten/cache/sysroot/include/signal.h:226:5:
 note: 'pthread_kill' declared here
 int pthread_kill(pthread_t, int);
     ^
 fftools/ffmpeg_demux.c:397:16: error: call to undeclared function
 'pthread_create'; ISO C99 and later do not support implicit function
 declarations [-Wimplicit-function-declaration]
     if ((ret = pthread_create(&d->thread, NULL, input_thread, d))) {
                ^
 2 errors generated.
 emcc: error: '/ffmpeg/modules/emsdk/upstream/bin/clang -target wasm32
 -unknown-emscripten -fignore-exceptions -fvisibility=default -mllvm
 -combiner-global-alias-analysis=false -mllvm -enable-emscripten-sjlj
 -mllvm -disable-lsr -DEMSCRIPTEN -Werror=implicit-function-declaration
 -I/ffmpeg/modules/emsdk/upstream/emscripten/cache/sysroot/include/SDL2
 --sysroot=/ffmpeg/modules/emsdk/upstream/emscripten/cache/sysroot -Xclang
 -iwithsysroot/include/compat -O3 -I/ffmpeg/build/include -msimd128 -I.
 -I./fftools -I/ffmpeg/build/include -Wno-deprecated-declarations -Wno-
 pointer-sign -Wno-implicit-int-float-conversion -Wno-switch -Wno-
 parentheses -Qunused-arguments fftools/ffmpeg_demux.c -c -o
 /tmp/emscripten_temp_0b3ma1cz/ffmpeg_demux_2.o' failed (returned 1)
 root at cs-1036883351707-default:/ffmpeg#
 }}}

 I can build a version with pthreads by removing `--disable-*threads` flags
 from emconfigure and adding `-pthread -s PROXY_TO_PTHREAD=1 -s
 USE_PTHREADS=1` into emcc.

 I tried various flags but could not get building single thread version. As
 I only have setup for emscripten build, I can not confirm if some more
 standard single thread build works or not. But having references to
 `pthread_create()` or `pthread_join()` in ffmpeg_demux.c seems suspicious.

 Can you please verify if single thread ffmpeg version is still buildable,
 and if so, do you have any idea what I am doing wrong?

--
-- 
Ticket URL: <https://trac.ffmpeg.org/ticket/10009#comment:1>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker


More information about the FFmpeg-trac mailing list