Git Product home page Git Product logo

Comments (6)

 avatar commented on May 19, 2024

First off, calling these attach functions is required if pthread-w32 is used when doing static linking. Though it looks like a newer version might make that optional. The latest release seems to have a bug associated with that, but the CVS version might be fine.

The configure test should catch this. It tries to compile a test program using these attach functions, and if that fails, use of pthreads is disabled. Also, pthread.h should always define this, as long as _POSIX_C_SOURCE is defined to something recent (I didn't check if that's still the case with newer pthread-w32 versions). On my Linux system, it's automatically defined to 200809 by the compiler (because we use --std=gnu99). So I'm not sure what's going wrong here, and why the configure test even succeeds. Can you post your config.log?

from mpv.

 avatar commented on May 19, 2024

Also, has this been always the case, or is it a regression?

from mpv.

qyot27 avatar qyot27 commented on May 19, 2024

I'm not sure if it's a regression. I've experienced it since I first attempted to cross-compile mpv, but considering that I only found out about mpv ~3 weeks ago I can't really say if it used to work. I'd never managed to compile MPlayer2 under MinGW due to a lot more build errors, but I'd only realized very very shortly before finding mpv that I was still attempting to build a revision from June. Since mpv was up-to-date and built easily with MinGW, I never attempted another MinGW build of MPlayer2.

I wouldn't be surprised if it's something I did wrong during pthreads' setup, or if the build is a tad too old (I usually only build it after I do a fresh OS upgrade, so the build is from October 25th).

from a fresh clone of mpv-player/mpv.git

during configure:

Checking for pthread ... ./configure: 1498: test: -lpthreadGC2: unexpected operator
yes 
CC core/m_struct.o
CC  core/mp_common.o
CC  core/mp_fifo.o
CC  core/mp_msg.o
CC  core/mplayer.o
core/mplayer.c: In function 'detach_ptw32':
core/mplayer.c:4308:5: error: implicit declaration of function 'pthread_win32_thread_detach_np' [-Werror=implicit-function-declaration]
core/mplayer.c:4309:5: error: implicit declaration of function 'pthread_win32_process_detach_np' [-Werror=implicit-function-declaration]
core/mplayer.c: In function 'osdep_preinit':
core/mplayer.c:4329:5: error: implicit declaration of function 'pthread_win32_process_attach_np' [-Werror=implicit-function-declaration]
core/mplayer.c:4330:5: error: implicit declaration of function 'pthread_win32_thread_attach_np' [-Werror=implicit-function-declaration]
cc1: some warnings being treated as errors
make: *** [core/mplayer.o] Error 1

config.log:
http://pastebin.com/a6c9Nfvg

from mpv.

 avatar commented on May 19, 2024

I was quite puzzled at first, but then I found mplayer.c doesn't even #include the pthread header. Can you try this patch:

diff --git a/configure b/configure
index d314141..5d2b23b 100755
--- a/configure
+++ b/configure
@@ -1495,7 +1495,7 @@ cc_check $_ld_tmp -DPTW32_STATIC_LIB && (tmp_run || test "$_ld_static") && _ld_p
 fi
 fi
 if test "$_pthreads" = yes ; then
-  test $_ld_pthread && res_comment="using $_ld_pthread"
+  test "$_ld_pthread" && res_comment="using $_ld_pthread"
   def_pthreads='#define HAVE_PTHREADS 1'
   def_threads='#define HAVE_THREADS 1'
   extra_cflags="$extra_cflags $THREAD_CFLAGS"
diff --git a/core/mplayer.c b/core/mplayer.c
index 04ea0e2..2d58689 100644
--- a/core/mplayer.c
+++ b/core/mplayer.c
@@ -22,6 +22,10 @@
 #include 
 #include 
 
+#ifdef PTW32_STATIC_LIB
+#include 
+#endif
+
 #include 
 #include 
 

from mpv.

qyot27 avatar qyot27 commented on May 19, 2024

The patch as posted fails to patch to core/mplayer.c because the #includes are bare. But I applied it manually and pointed it at pthread.h, and compilation now succeeds.

The binary is also larger, so it does appear that libpthreadGC2 did get linked in.

from mpv.

 avatar commented on May 19, 2024

Oh, sorry, github messes it up when displaying it on the website. Yes, it's meant to "#include <pthread.h>".

Thanks for testing. I'll push the patch to master at some later time.

from mpv.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.