[FFmpeg-devel] [PATCH] pthread detection on mingw + static pthread

Gianluigi Tiesi mplayer
Wed Apr 23 15:20:28 CEST 2008


On Wed, Apr 23, 2008 at 02:07:50PM +0100, M?ns Rullg?rd wrote:
> 
> Gianluigi Tiesi wrote:
> > On Tue, Apr 22, 2008 at 10:16:35PM +0100, M?ns Rullg?rd wrote:
> >> > +    elif check_func pthread_create -DPTW32_STATIC_LIB -lpthreadGC2 -lws2_32;
> >> then
> >>
> >> The -D flag in that line has no effect, and can thus be removed.
> >>
> >> > +        add_cflags -DPTW32_STATIC_LIB
> > hmm I've seen the compile options in config.err and it's used
> 
> I said it has no effect, even though it is passed to the compiler.
> 
> > anyway is needed to work when static linking
> 
> Why is this?

static pthreads will not link at all if not using -DPTW32_STATIC_LIB
static pthreads will crash at the first call if not calling attach_np()
stuff

don't blame me I'm not the author of pthreads win32
the test function
(there is a reason, the dll linkage it's different)

> 
> >> Is this preprocessor define required by the library, or was it
> >> something you invented for use in ffmpeg.c?
> >>
> >> > +        add_extralibs -lpthreadGC2 -lws2_32
> >> >      elif ! check_lib pthread.h pthread_create -lpthread; then
> >> >          die "ERROR: can't find pthreads library"
> >> >      fi
> >> > @@ -1629,7 +1634,7 @@
> >> >  enabled libnut     && require  libnut libnut.h nut_demuxer_init -lnut
> >> >  enabled libtheora  && require  libtheora theora/theora.h theora_info_init
> >> -ltheora -logg
> >> >  enabled libvorbis  && require  libvorbis vorbis/vorbisenc.h vorbis_info_init
> >> -lvorbisenc -lvorbis -logg
> >> > -enabled libx264    && require  x264 x264.h x264_encoder_open -lx264 -lm
> >> > +enabled libx264    && require2 x264 "stdint.h x264.h" x264_encoder_open -lx264
> >> -lm
> >>
> >> Not necessary.
> > libx264 requires stdint.h
> 
> Yes, but checking whether x264.h exists doesn't need it.
if you try to compile the test program using x264_encoder_open 
will fail because it uses uintXX_t

> 
> > also if compiled with pthreads static it requires -lpthreadGC2 -lws2_32
> > or detection will fail
> 
> That is an unrelated issue.
> 
> >> > +}
> >> > +#endif
> >> > +
> >> >  int main(int argc, char **argv)
> >> >  {
> >> >      int i;
> >> >      int64_t ti;
> >> >
> >> > +#ifdef PTW32_STATIC_LIB
> >> > +  pthread_win32_process_attach_np();
> >> > +  pthread_win32_thread_attach_np();
> >> > +  atexit(detach_ptw32);
> >> > +#endif
> >>
> >> What if the process is terminated without calling exit()?  I also
> >> don't like the ifdef mess.  Systems that require this don't deserve
> >> threads, IMNSHO.
> > if a process does not call exit it's because is crashed or called
> > abort(), I don't think calling detach is needed here
> > the ifdef is the only way, x264.c does the same thing without
> > atexit, that perhaps can be avoided if the code does not calls exit()
> > the problem with abnormal termination will stay
> 
> It's still ugly, and I still don't think we need to support such
> configurations.  We don't support VMS either.
I can do nothing for this, sorry, it's not my code

perhaps did you ever tried to compile something on mingw?
looks like you are giving approssimative replies
about pthread win32 on mingw

I've proposed it, I use it in my binaries because
I don't want external deps

just not may decision to include or not

I really don't want to modify pthreads win32 because
the code to make static pt in ffmpeg work looks ugly

VMS? windows on desktops is more common than linux
why it should be considered "esotic" as like as VMS

Regards

-- 
Gianluigi Tiesi <sherpya at netfarm.it>
EDP Project Leader
Netfarm S.r.l. - http://www.netfarm.it/
Free Software: http://oss.netfarm.it/




More information about the ffmpeg-devel mailing list