Ticket #1929 (closed defect: invalid)
./configure --disable-w32threads doesn't check for presence of pthreads
| Reported by: | rogerdpack | Owned by: | |
|---|---|---|---|
| Priority: | normal | Component: | build system |
| Version: | unspecified | Keywords: | win |
| Cc: | Blocked By: | ||
| Blocking: | Reproduced by developer: | no | |
| Analyzed by developer: | no |
Description
Summary of the bug: $title
How to reproduce:
./configure --disable-w32threads # in a mingw environment, that doesn't have pthreads library
output:
LD ffmpeg_g.exe
ffmpeg.o: In function `input_thread':
/home/rdp/dev/ffmpeg-windows-build-helpers/sandbox/win32/ffmpeg_git/ffmpeg.c:2568: undefined reference to `_imppthread_mutex_lock'
Is this expected? I thought it would check for build-ability.
Thanks!
-roger-
Change History
comment:1 Changed 6 months ago by cehoyos
- Keywords win added
- Component changed from undetermined to build system
comment:2 Changed 6 months ago by cehoyos
When reporting linking problems, please always run make several times (it should always show the same error), then run "make V=1" and post the complete, uncut console output of the last "make V=1" run (please do not post the complete, uncut output of an earlier make run).
Please also post the part of config.log beginning with "check_func pthread_create" and ending with "check_lib math.h sin -lm"
comment:3 follow-up: ↓ 4 Changed 6 months ago by rogerdpack
Here's my attempt (basically removing libpthread.a from my system).
/home/rogerdpack/dev/ffmpeg-windows-build-helpers/sandbox/mingw-w64-i686/bin/i686-w64-mingw32-gcc -Llibavcodec -Llibavdevice -Llibavfilter -Llibavformat -Llibavresample -Llibavutil -Llibpostproc -Llibswscale -Llibswresample -Wl,--as-needed -Wl,--warn-common -Wl,-rpath-link=libpostproc:libswresample:libswscale:libavfilter:libavdevice:libavformat:libavcodec:libavutil:libavresample -o ffmpeg_g.exe ffmpeg_opt.o ffmpeg_filter.o ffmpeg.o cmdutils.o -lavdevice -lavfilter -lavformat -lavcodec -lpostproc -lswresample -lswscale -lavutil -lavicap32 -lpsapi -lole32 -lstrmiids -luuid -ldl -ldl -lws2_32 -L/home/rogerdpack/dev/ffmpeg-windows-build-helpers/sandbox/mingw-w64-i686/i686-w64-mingw32/lib -lmingw32 -lSDLmain -lSDL -lm -luser32 -lgdi32 -lwinmm -ldxguid -lnettle -lhogweed -lgmp -lxvidcore -lxavs -lx264 -lvorbisenc -lvorbis -logg -lvo-amrwbenc -lvo-aacenc -lutvideo -lstdc++ -ltheoraenc -ltheoradec -logg -lspeex -L/home/rogerdpack/dev/ffmpeg-windows-build-helpers/sandbox/mingw-w64-i686/i686-w64-mingw32/lib -lrtmp -lwinmm -lz -lgnutls -lnettle -lhogweed -lgmp -lcrypt32 -lws2_32 -L/home/rogerdpack/dev/ffmpeg-windows-build-helpers/sandbox/mingw-w64-i686/i686-w64-mingw32/lib -lopus -lopenjpeg -lopencore-amrwb -lopencore-amrnb -lmp3lame -lgsm -L/home/rogerdpack/dev/ffmpeg-windows-build-helpers/sandbox/mingw-w64-i686/i686-w64-mingw32/lib -lfreetype -L/home/rogerdpack/dev/ffmpeg-windows-build-helpers/sandbox/mingw-w64-i686/i686-w64-mingw32/lib -lass -lm -lfontconfig -lexpat -lfribidi -lfreetype -L/home/rogerdpack/dev/ffmpeg-windows-build-helpers/sandbox/mingw-w64-i686/i686-w64-mingw32/lib -lgnutls -lnettle -lhogweed -lgmp -lcrypt32 -lws2_32 -L/home/rogerdpack/dev/ffmpeg-windows-build-helpers/sandbox/mingw-w64-i686/i686-w64-mingw32/lib -lfontconfig -lfreetype -lexpat -lavifil32 -lm -pthread -lbz2 -lz -lpsapi -ladvapi32 -lshell32
/home/rogerdpack/dev/ffmpeg-windows-build-helpers/sandbox/mingw-w64-i686/lib/gcc/i686-w64-mingw32/4.7.1/../../../../i686-w64-mingw32/bin/ld: cannot find -lpthread
collect2: error: ld returned 1 exit status
make: * [ffmpeg_g.exe] Error 1
check_func pthread_create
check_ld cc
check_cc
BEGIN /tmp/ffconf.UdeoAfnb.c
1 extern int pthread_create();
2 int main(void){ pthread_create(); }
END /tmp/ffconf.UdeoAfnb.c
/home/rogerdpack/dev/ffmpeg-windows-build-helpers/sandbox/mingw-w64-i686/bin/i686-w64-mingw32-gcc -D_ISOC99_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -U__STRICT_ANSI__ -DPTW32_STATIC_LIB -std=c99 -include ./compat/msvcrt/snprintf.h -fomit-frame-pointer -c -o /tmp/ffconf.pdlULg0G.o /tmp/ffconf.UdeoAfnb.c
/home/rogerdpack/dev/ffmpeg-windows-build-helpers/sandbox/mingw-w64-i686/bin/i686-w64-mingw32-gcc -Wl,--as-needed -o /tmp/ffconf.iBCSJu0K.exe /tmp/ffconf.pdlULg0G.o -lbz2 -lz -lpsapi -ladvapi32 -lshell32
/tmp/ffconf.pdlULg0G.o:ffconf.UdeoAfnb.c:(.text+0xc): undefined reference to `pthread_create'
collect2: error: ld returned 1 exit status
check_func pthread_create -pthread
check_ld cc -pthread
check_cc -pthread
BEGIN /tmp/ffconf.UdeoAfnb.c
1 extern int pthread_create();
2 int main(void){ pthread_create(); }
END /tmp/ffconf.UdeoAfnb.c
/home/rogerdpack/dev/ffmpeg-windows-build-helpers/sandbox/mingw-w64-i686/bin/i686-w64-mingw32-gcc -D_ISOC99_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -U__STRICT_ANSI__ -DPTW32_STATIC_LIB -std=c99 -include ./compat/msvcrt/snprintf.h -fomit-frame-pointer -pthread -c -o /tmp/ffconf.pdlULg0G.o /tmp/ffconf.UdeoAfnb.c
/home/rogerdpack/dev/ffmpeg-windows-build-helpers/sandbox/mingw-w64-i686/bin/i686-w64-mingw32-gcc -Wl,--as-needed -pthread -o /tmp/ffconf.iBCSJu0K.exe /tmp/ffconf.pdlULg0G.o -lbz2 -lz -lpsapi -ladvapi32 -lshell32
check_func pthread_cancel
check_ld cc
check_cc
BEGIN /tmp/ffconf.UdeoAfnb.c
1 extern int pthread_cancel();
2 int main(void){ pthread_cancel(); }
END /tmp/ffconf.UdeoAfnb.c
/home/rogerdpack/dev/ffmpeg-windows-build-helpers/sandbox/mingw-w64-i686/bin/i686-w64-mingw32-gcc -D_ISOC99_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -U__STRICT_ANSI__ -DPTW32_STATIC_LIB -std=c99 -include ./compat/msvcrt/snprintf.h -fomit-frame-pointer -pthread -c -o /tmp/ffconf.pdlULg0G.o /tmp/ffconf.UdeoAfnb.c
/home/rogerdpack/dev/ffmpeg-windows-build-helpers/sandbox/mingw-w64-i686/bin/i686-w64-mingw32-gcc -Wl,--as-needed -o /tmp/ffconf.iBCSJu0K.exe /tmp/ffconf.pdlULg0G.o -pthread -lbz2 -lz -lpsapi -ladvapi32 -lshell32
check_lib math.h sin -lm
check_header math.h
comment:4 in reply to: ↑ 3 Changed 6 months ago by cehoyos
Replying to rogerdpack:
/home/rogerdpack/dev/ffmpeg-windows-build-helpers/sandbox/mingw-w64-i686/lib/gcc/i686-w64-mingw32/4.7.1/../../../../i686-w64-mingw32/bin/ld: cannot find -lpthread
Do you know why the error message is different than in your original report?
comment:5 Changed 6 months ago by reimar
Your configure output shows that linking against pthread is working just fine, why does it suddenly stop working while linking ffmpeg.exe?
comment:6 follow-up: ↓ 7 Changed 5 months ago by rogerdpack
My latest guess is that configure does this test compile:
extern int pthread_create();
int main(void){ pthread_create(); }
then compiles it like $ gcc -c input_filename -o output.o
which happily creates output.o (but output.o would fail at link time since libpthread.a library is absent).
I believe my initial report was reporting that I had configured it without passing the right compiler directive flags to *use* libpthread.a correctly, the second report was when I had no libpthread.a file present on the system at all. So that's why the 2 messages differ--they both had broken pthread libraries (or absent), but they were broken in slightly different ways.
HTH.
roger-
comment:7 in reply to: ↑ 6 Changed 5 months ago by cehoyos
Replying to rogerdpack:
My latest guess is that configure does this test compile:
extern int pthread_create(); int main(void){ pthread_create(); }then compiles it like $ gcc -c input_filename -o output.o
which happily creates output.o (but output.o would fail at link time since libpthread.a library is absent).
Your config.log output above shows that configure does link pthreads:
$ gcc -pthread -o ffconf.iBCSJu0K.exe /tmp/ffconf.pdlULg0G.o (simplified)
I believe my initial report was reporting that I had configured it without passing the right compiler directive flags to *use* libpthread.a correctly, the second report was when I had no libpthread.a file present on the system at all.
It is not a good idea to change the report in the middle of the ticket.
Please elaborate which is the (bottom of the) output of:
$ make distclean && ./configure --disable-w32threads && make ffmpeg; make V=1 ffmpeg
comment:8 follow-up: ↓ 9 Changed 5 months ago by rogerdpack
If I remove the file "libpthread.a" from my system, then the output is
/home/rogerdpack/dev/ffmpeg-windows-build-helpers/sandbox/mingw-w64-i686/lib/gcc/i686-w64-mingw32/4.7.1/../../../../i686-w64-mingw32/bin/ld: cannot find -lpthread
Could you post to me the exact line you are seeing from config.log that shows it 'succeeding' so I can check it? (my thought is that it will have a "-c" in it, which means it happily creates a .o file, thinking that linking will later work--it doesn't). So basically what we have here is a *freaky* case where gcc responds to "-pthread" but doing so doesn't actually give you pthreads, is my guess. FWIW.
comment:9 in reply to: ↑ 8 Changed 5 months ago by cehoyos
Replying to rogerdpack:
Could you post to me the exact line you are seeing from config.log that shows it 'succeeding' so I can check it?
/home/rogerdpack/dev/ffmpeg-windows-build-helpers/sandbox/mingw-w64-i686/bin/i686-w64-mingw32-gcc -Wl,--as-needed -pthread -o /tmp/ffconf.iBCSJu0K.exe /tmp/ffconf.pdlULg0G.o -lbz2 -lz -lpsapi -ladvapi32 -lshell32
comment:10 Changed 5 months ago by rogerdpack
Ok I think I may have pasted a poor config.log file initially, my fault, and my apologies.
The specific issue I will address is if there is "no" libpthread.a on the system. I'll focus for that now (the headers may be there, however). So here is the output, starting over:
So, after removing libpthread.a, and then configuring and building ffmpeg with --disable-w32threads, I get this error at link time:
ffmpeg_git$ make V=1 /home/rdp/dev/ffmpeg-windows-build-helpers/sandbox/mingw-w64-i686/bin/i686-w64-mingw32-gcc -Llibavcodec -Llibavdevice -Llibavfilter -Llibavformat -Llibavresample -Llibavutil -Llibpostproc -Llibswscale -Llibswresample -Wl,--as-needed -Wl,--warn-common -Wl,-rpath-link=libpostproc:libswresample:libswscale:libavfilter:libavdevice:libavformat:libavcodec:libavutil:libavresample -o ffmpeg_g.exe ffmpeg_opt.o ffmpeg_filter.o ffmpeg.o cmdutils.o -lavdevice -lavfilter -lavformat -lavcodec -lpostproc -lswresample -lswscale -lavutil -lavicap32 -lpsapi -lole32 -lstrmiids -luuid -ldl -ldl -lws2_32 -L/home/rdp/dev/ffmpeg-windows-build-helpers/sandbox/mingw-w64-i686/i686-w64-mingw32/lib -lmingw32 -lSDLmain -lSDL -lm -luser32 -lgdi32 -lwinmm -ldxguid -lnettle -lhogweed -lgmp -lxvidcore -lxavs -lvpx -lvpx -lvorbisenc -lvorbis -logg -lvo-amrwbenc -lvo-aacenc -lutvideo -lstdc++ -ltheoraenc -ltheoradec -logg -lspeex -L/home/rdp/dev/ffmpeg-windows-build-helpers/sandbox/mingw-w64-i686/i686-w64-mingw32/lib -lrtmp -lwinmm -lz -lgnutls -lnettle -lhogweed -lgmp -lcrypt32 -lws2_32 -L/home/rdp/dev/ffmpeg-windows-build-helpers/sandbox/mingw-w64-i686/i686-w64-mingw32/lib -lopus -lopenjpeg -lopencore-amrwb -lopencore-amrnb -lmp3lame -lgsm -L/home/rdp/dev/ffmpeg-windows-build-helpers/sandbox/mingw-w64-i686/i686-w64-mingw32/lib -lfreetype -L/home/rdp/dev/ffmpeg-windows-build-helpers/sandbox/mingw-w64-i686/i686-w64-mingw32/lib -lass -lm -lfontconfig -lexpat -lfribidi -lfreetype -L/home/rdp/dev/ffmpeg-windows-build-helpers/sandbox/mingw-w64-i686/i686-w64-mingw32/lib -lgnutls -lnettle -lhogweed -lgmp -lcrypt32 -lws2_32 -L/home/rdp/dev/ffmpeg-windows-build-helpers/sandbox/mingw-w64-i686/i686-w64-mingw32/lib -lfontconfig -lfreetype -lexpat -lavifil32 -lm -lbz2 -lz -lpsapi -ladvapi32 -lshell32 /home/rdp/dev/ffmpeg-windows-build-helpers/sandbox/mingw-w64-i686/i686-w64-mingw32/lib/libvpx.a(systemdependent.c.o):(.text+0x21): undefined reference to `pthread_once' collect2: error: ld returned 1 exit status make: *** [ffmpeg_g.exe] Error 1
The relevant part of config.log is this
check_func pthread_create
check_ld cc
check_cc
BEGIN /tmp/ffconf.n0EK4a2U.c
1 extern int pthread_create();
2 int main(void){ pthread_create(); }
END /tmp/ffconf.n0EK4a2U.c
/home/rdp/dev/ffmpeg-windows-build-helpers/sandbox/mingw-w64-i686/bin/i686-w64-mingw32-gcc -D_ISOC99_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -U__STRICT_ANSI__ -DPTW32_STATIC_LIB -std=c99 -fomit-frame-pointer -c -o /tmp/ffconf.OzeIGWH5.o /tmp/ffconf.n0EK4a2U.c
/home/rdp/dev/ffmpeg-windows-build-helpers/sandbox/mingw-w64-i686/bin/i686-w64-mingw32-gcc -Wl,--as-needed -o /tmp/ffconf.1rQfly6Z.exe /tmp/ffconf.OzeIGWH5.o -lbz2 -lz -lpsapi -ladvapi32 -lshell32
/tmp/ffconf.OzeIGWH5.o:ffconf.n0EK4a2U.c:(.text+0xc): undefined reference to `pthread_create'
collect2: error: ld returned 1 exit status
check_func pthread_create -pthread
check_ld cc -pthread
check_cc -pthread
BEGIN /tmp/ffconf.n0EK4a2U.c
1 extern int pthread_create();
2 int main(void){ pthread_create(); }
END /tmp/ffconf.n0EK4a2U.c
/home/rdp/dev/ffmpeg-windows-build-helpers/sandbox/mingw-w64-i686/bin/i686-w64-mingw32-gcc -D_ISOC99_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -U__STRICT_ANSI__ -DPTW32_STATIC_LIB -std=c99 -fomit-frame-pointer -pthread -c -o /tmp/ffconf.OzeIGWH5.o /tmp/ffconf.n0EK4a2U.c
/home/rdp/dev/ffmpeg-windows-build-helpers/sandbox/mingw-w64-i686/bin/i686-w64-mingw32-gcc -Wl,--as-needed -pthread -o /tmp/ffconf.1rQfly6Z.exe /tmp/ffconf.OzeIGWH5.o -lbz2 -lz -lpsapi -ladvapi32 -lshell32
/home/rdp/dev/ffmpeg-windows-build-helpers/sandbox/mingw-w64-i686/lib/gcc/i686-w64-mingw32/4.7.2/../../../../i686-w64-mingw32/bin/ld: cannot find -lpthread
collect2: error: ld returned 1 exit status
check_func pthread_create -pthreads
check_ld cc -pthreads
check_cc -pthreads
BEGIN /tmp/ffconf.n0EK4a2U.c
1 extern int pthread_create();
2 int main(void){ pthread_create(); }
END /tmp/ffconf.n0EK4a2U.c
/home/rdp/dev/ffmpeg-windows-build-helpers/sandbox/mingw-w64-i686/bin/i686-w64-mingw32-gcc -D_ISOC99_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -U__STRICT_ANSI__ -DPTW32_STATIC_LIB -std=c99 -fomit-frame-pointer -pthreads -c -o /tmp/ffconf.OzeIGWH5.o /tmp/ffconf.n0EK4a2U.c
i686-w64-mingw32-gcc: error: unrecognized command line option '-pthreads'
check_func pthread_create -lpthreadGC2
check_ld cc -lpthreadGC2
check_cc
BEGIN /tmp/ffconf.n0EK4a2U.c
1 extern int pthread_create();
2 int main(void){ pthread_create(); }
END /tmp/ffconf.n0EK4a2U.c
/home/rdp/dev/ffmpeg-windows-build-helpers/sandbox/mingw-w64-i686/bin/i686-w64-mingw32-gcc -D_ISOC99_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -U__STRICT_ANSI__ -DPTW32_STATIC_LIB -std=c99 -fomit-frame-pointer -c -o /tmp/ffconf.OzeIGWH5.o /tmp/ffconf.n0EK4a2U.c
/home/rdp/dev/ffmpeg-windows-build-helpers/sandbox/mingw-w64-i686/bin/i686-w64-mingw32-gcc -Wl,--as-needed -o /tmp/ffconf.1rQfly6Z.exe /tmp/ffconf.OzeIGWH5.o -lpthreadGC2 -lbz2 -lz -lpsapi -ladvapi32 -lshell32
/home/rdp/dev/ffmpeg-windows-build-helpers/sandbox/mingw-w64-i686/lib/gcc/i686-w64-mingw32/4.7.2/../../../../i686-w64-mingw32/bin/ld: cannot find -lpthreadGC2
collect2: error: ld returned 1 exit status
check_lib pthread.h pthread_create -lpthread
check_header pthread.h
check_cpp
BEGIN /tmp/ffconf.n0EK4a2U.c
1 #include <pthread.h>
2 int x;
END /tmp/ffconf.n0EK4a2U.c
/home/rdp/dev/ffmpeg-windows-build-helpers/sandbox/mingw-w64-i686/bin/i686-w64-mingw32-gcc -D_ISOC99_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -U__STRICT_ANSI__ -DPTW32_STATIC_LIB -std=c99 -fomit-frame-pointer -E -o /tmp/ffconf.OzeIGWH5.o /tmp/ffconf.n0EK4a2U.c
check_func pthread_create -lpthread
check_ld cc -lpthread
check_cc
BEGIN /tmp/ffconf.n0EK4a2U.c
1 extern int pthread_create();
2 int main(void){ pthread_create(); }
END /tmp/ffconf.n0EK4a2U.c
/home/rdp/dev/ffmpeg-windows-build-helpers/sandbox/mingw-w64-i686/bin/i686-w64-mingw32-gcc -D_ISOC99_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -U__STRICT_ANSI__ -DPTW32_STATIC_LIB -std=c99 -fomit-frame-pointer -c -o /tmp/ffconf.OzeIGWH5.o /tmp/ffconf.n0EK4a2U.c
/home/rdp/dev/ffmpeg-windows-build-helpers/sandbox/mingw-w64-i686/bin/i686-w64-mingw32-gcc -Wl,--as-needed -o /tmp/ffconf.1rQfly6Z.exe /tmp/ffconf.OzeIGWH5.o -lpthread -lbz2 -lz -lpsapi -ladvapi32 -lshell32
/home/rdp/dev/ffmpeg-windows-build-helpers/sandbox/mingw-w64-i686/lib/gcc/i686-w64-mingw32/4.7.2/../../../../i686-w64-mingw32/bin/ld: cannot find -lpthread
collect2: error: ld returned 1 exit status
check_lib math.h sin -lm
...
I think I copied and pasted it in there ok. It appears to find the file "pthread.h" but the linking tests all fail, but I would be happy to be proven wrong.
Thanks!
comment:11 Changed 5 months ago by cehoyos
- Status changed from new to closed
- Resolution set to invalid
If you want to reopen this ticket, please provide the following:
- The exact configure line you are using including its output until (and including) the line starting with "makeinfo enabled".
- The complete, uncut output of "make V=1" (including this command) after running make before (at least twice) and getting a linking failure.
- You may be asked to provide an excerpt of config.log, if you prefer attach the complete file.
comment:12 Changed 5 months ago by reimar
You're making this very confusing by reporting a new issue with each post.
If you know exactly what you want to report, IMHO please open a new issue, this one is just too confusing.
However it seems like FFmpeg as desired by you does not use pthreads anymore.
But since you compiled libvpx against pthreads it has become unusable.
Since you didn't provide a full config.log I can't say why it decides to use the broken libvpx and whether that should be considered a bug.
comment:13 Changed 5 months ago by rogerdpack
Ok, before filing a new post, as a point of reference, if I'm compiling for windows, and I pass configure "--disable-w32threads" and have no pthreads, should configure fail? Or does ffmpeg have some other option (like "disabling" threads) that it just uses in that case?
Thanks.


