[FFmpeg-devel] Building with all threading disabled still results in avutil-55.dll dependency on pthreadGC-3.dll

Gregory J Wolfe gregory.wolfe at kodakalaris.com
Fri Nov 18 00:28:01 EET 2016


> > -----Original Message-----
> > From: ffmpeg-devel [mailto:ffmpeg-devel-bounces at ffmpeg.org]
> On
> > Behalf Of Gregory J Wolfe
> > Sent: Thursday, November 17, 2016 2:10 PM
> > To: ffmpeg-devel at ffmpeg.org
> > Subject: [FFmpeg-devel] Building with all threading disabled still
> results
> > in avutil-55.dll dependency on pthreadGC-3.dll
> >
> > I am building FFmpeg using msys/MinGW on Windows 7 for use on
> > Windows systems.  I **want** the resulting DLLs to have threading
> > enabled, but no matter what I do the avutil DLL has a dependency on
> > MinGW library pthreadGC-3.dll.  For deployment purposes we do not
> > want the destination system to have to have any MinGW
> components
> > installed.  Even the following configuration does not eliminate this
> > dependency (config.log attached):
> >
> > ../configure --enable-shared --disable-static --enable-memalign-hack
> -
> > -enable-libmp3lame --enable-libopenh264 --extra-ldflags=-static-
> libgcc
> > --disable-iconv --enable-nvenc --disable-w32threads --disable-
> > pthreads
> >
> > Even though all threading support has been (theoretically) disabled,
> > the dependency walker shows that the avutil DLL depends on the
> > following symbols:
> >
> > _sched_affinitycpucount
> > _sched_affinitycpuzero
> > sched_getaffinity
> >
> > I tried using -static as an additional CFLAG/LDFLAG, but then
> configure
> > command does not find the libopenh264 DLL.  So I think what I need
> to
> > do is to modify the compile/link commands for the avutil DLL ONLY
> > such that it statically links in threading support.  Is this possible
> through
> > the configure command?  Any other suggestions out there?
> 
> Found the answer to the easy question.  In libavutil/cpu.c, all of the
> thread
> related code should be surrounded by #if HAVE_THREADS, so that if all
> thread support is disabled the code will not attempt to query how may
> processors there are, etc.
> 
> On to the more difficult question of removing the dependency when
> threading is desired ...
> 

Found the solution to the hard question, again in libavutil/cpu.c.  When both
configuration macros HAVE_SCHED_GETAFFINITY (GNU) and
HAVE_GETPROCESSAFFINITYMASK (Windows) are set to 1, AND
HAVE_W32THREADS is set to 1, then the number of CPUs should be obtained
using the Windows system call, not the GNU system call.  Otherwise you get
dependencies on both the Windows and the GNU threading libraries, which
is clearly not what is wanted.

Will send patch within the next day or two.

> >
> > Greg Wolfe
> > Kodak Alaris


More information about the ffmpeg-devel mailing list