FFmpeg + mingw64: referensi tidak ditentukan untuk `sem_post '


0

Saya mengalami masalah dalam membangun ffmpeg menggunakan kompiler mingw64. Ini adalah konfigurasi saya:

./configure --prefix=/home/ytan/Dev/build-mingw/ffmpeg/ --enable-cross-compile --cross-prefix=x86_64-w64-mingw32- --arch=x86_64 --target-os=mingw64 --pkg-config-flags="--static" --enable-shared --disable-static --enable-libvpx --enable-libvorbis --enable-libmp3lame --enable-openssl --enable-pic  --enable-debug --extra-ldlibflags="-static"    

Ketika saya menjalankan make, gagal saat menghubungkan:

(...lot of text omitted)
LD  libavcodec/avcodec-57.dll
/home/ytan/Dev/build-mingw/libvpx/lib/libvpx.a(onyx_if.c.o):(.text+0x408d): undefined reference to `sem_post'
/home/ytan/Dev/build-mingw/libvpx/lib/libvpx.a(onyx_if.c.o):(.text+0x408d): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `sem_post'
/home/ytan/Dev/build-mingw/libvpx/lib/libvpx.a(onyx_if.c.o):(.text+0x4d33): undefined reference to `sem_post'
/home/ytan/Dev/build-mingw/libvpx/lib/libvpx.a(onyx_if.c.o):(.text+0x4d33): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `sem_post'
/home/ytan/Dev/build-mingw/libvpx/lib/libvpx.a(onyx_if.c.o):(.text+0x6a62): undefined reference to `sem_wait'
/home/ytan/Dev/build-mingw/libvpx/lib/libvpx.a(onyx_if.c.o):(.text+0x6a62): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `sem_wait'
/home/ytan/Dev/build-mingw/libvpx/lib/libvpx.a(onyx_if.c.o):(.text+0x8965): undefined reference to `sem_wait'
/home/ytan/Dev/build-mingw/libvpx/lib/libvpx.a(onyx_if.c.o):(.text+0x8965): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `sem_wait'
/home/ytan/Dev/build-mingw/libvpx/lib/libvpx.a(threading.c.o):(.text+0x563): undefined reference to `sched_yield'
/home/ytan/Dev/build-mingw/libvpx/lib/libvpx.a(threading.c.o):(.text+0x563): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `sched_yield'
/home/ytan/Dev/build-mingw/libvpx/lib/libvpx.a(threading.c.o):(.text+0x16f6): undefined reference to `sem_post'
/home/ytan/Dev/build-mingw/libvpx/lib/libvpx.a(threading.c.o):(.text+0x16f6): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `sem_post'
/home/ytan/Dev/build-mingw/libvpx/lib/libvpx.a(threading.c.o):(.text+0x174b): undefined reference to `sem_wait'
/home/ytan/Dev/build-mingw/libvpx/lib/libvpx.a(threading.c.o):(.text+0x174b): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `sem_wait'
/home/ytan/Dev/build-mingw/libvpx/lib/libvpx.a(threading.c.o):(.text+0x18a9): undefined reference to `sem_init'
/home/ytan/Dev/build-mingw/libvpx/lib/libvpx.a(threading.c.o):(.text+0x18a9): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `sem_init'
/home/ytan/Dev/build-mingw/libvpx/lib/libvpx.a(threading.c.o):(.text+0x191b): undefined reference to `pthread_create'
/home/ytan/Dev/build-mingw/libvpx/lib/libvpx.a(threading.c.o):(.text+0x191b): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `pthread_create'
/home/ytan/Dev/build-mingw/libvpx/lib/libvpx.a(threading.c.o):(.text+0x194e): undefined reference to `sem_init'
/home/ytan/Dev/build-mingw/libvpx/lib/libvpx.a(threading.c.o):(.text+0x194e): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `sem_init'
/home/ytan/Dev/build-mingw/libvpx/lib/libvpx.a(threading.c.o):(.text+0x19bb): undefined reference to `sem_destroy'
/home/ytan/Dev/build-mingw/libvpx/lib/libvpx.a(threading.c.o):(.text+0x19bb): additional relocation overflows omitted from the output
/home/ytan/Dev/build-mingw/libvpx/lib/libvpx.a(threading.c.o):(.text+0x19f4): undefined reference to `sem_destroy'
/home/ytan/Dev/build-mingw/libvpx/lib/libvpx.a(threading.c.o):(.text+0x220e): undefined reference to `sem_post'
/home/ytan/Dev/build-mingw/libvpx/lib/libvpx.a(threading.c.o):(.text+0x2224): undefined reference to `pthread_join'
/home/ytan/Dev/build-mingw/libvpx/lib/libvpx.a(threading.c.o):(.text+0x2252): undefined reference to `sem_destroy'
/home/ytan/Dev/build-mingw/libvpx/lib/libvpx.a(threading.c.o):(.text+0x22e8): undefined reference to `sem_destroy'
/home/ytan/Dev/build-mingw/libvpx/lib/libvpx.a(threading.c.o):(.text+0x26a2): undefined reference to `sem_post'
/home/ytan/Dev/build-mingw/libvpx/lib/libvpx.a(threading.c.o):(.text+0x26d4): undefined reference to `sem_wait'
/home/ytan/Dev/build-mingw/libvpx/lib/libvpx.a(encodeframe.c.o):(.text+0x1b36): undefined reference to `sched_yield'
/home/ytan/Dev/build-mingw/libvpx/lib/libvpx.a(encodeframe.c.o):(.text+0x21a2): undefined reference to `sem_post'
/home/ytan/Dev/build-mingw/libvpx/lib/libvpx.a(encodeframe.c.o):(.text+0x24d5): undefined reference to `sched_yield'
/home/ytan/Dev/build-mingw/libvpx/lib/libvpx.a(encodeframe.c.o):(.text+0x2757): undefined reference to `sem_wait'
/home/ytan/Dev/build-mingw/libvpx/lib/libvpx.a(encodeframe.c.o):(.text+0x3259): undefined reference to `sem_post'
/home/ytan/Dev/build-mingw/libvpx/lib/libvpx.a(ethreading.c.o):(.text+0x27): undefined reference to `sem_wait'
/home/ytan/Dev/build-mingw/libvpx/lib/libvpx.a(ethreading.c.o):(.text+0x5d): undefined reference to `sem_post'
/home/ytan/Dev/build-mingw/libvpx/lib/libvpx.a(ethreading.c.o):(.text+0x100): undefined reference to `sem_wait'
/home/ytan/Dev/build-mingw/libvpx/lib/libvpx.a(ethreading.c.o):(.text+0x2f3): undefined reference to `sched_yield'
/home/ytan/Dev/build-mingw/libvpx/lib/libvpx.a(ethreading.c.o):(.text+0x7cb): undefined reference to `sem_post'
/home/ytan/Dev/build-mingw/libvpx/lib/libvpx.a(ethreading.c.o):(.text+0x10f9): undefined reference to `sem_init'
/home/ytan/Dev/build-mingw/libvpx/lib/libvpx.a(ethreading.c.o):(.text+0x117c): undefined reference to `sem_init'
/home/ytan/Dev/build-mingw/libvpx/lib/libvpx.a(ethreading.c.o):(.text+0x11ac): undefined reference to `pthread_create'
/home/ytan/Dev/build-mingw/libvpx/lib/libvpx.a(ethreading.c.o):(.text+0x11ef): undefined reference to `pthread_join'
/home/ytan/Dev/build-mingw/libvpx/lib/libvpx.a(ethreading.c.o):(.text+0x1202): undefined reference to `sem_destroy'
/home/ytan/Dev/build-mingw/libvpx/lib/libvpx.a(ethreading.c.o):(.text+0x120f): undefined reference to `sem_destroy'
/home/ytan/Dev/build-mingw/libvpx/lib/libvpx.a(ethreading.c.o):(.text+0x1287): undefined reference to `sem_init'
/home/ytan/Dev/build-mingw/libvpx/lib/libvpx.a(ethreading.c.o):(.text+0x1294): undefined reference to `sem_init'
/home/ytan/Dev/build-mingw/libvpx/lib/libvpx.a(ethreading.c.o):(.text+0x12b7): undefined reference to `pthread_create'
/home/ytan/Dev/build-mingw/libvpx/lib/libvpx.a(ethreading.c.o):(.text+0x12e0): undefined reference to `sem_post'
/home/ytan/Dev/build-mingw/libvpx/lib/libvpx.a(ethreading.c.o):(.text+0x12f2): undefined reference to `pthread_join'
/home/ytan/Dev/build-mingw/libvpx/lib/libvpx.a(ethreading.c.o):(.text+0x1305): undefined reference to `sem_destroy'
/home/ytan/Dev/build-mingw/libvpx/lib/libvpx.a(ethreading.c.o):(.text+0x1313): undefined reference to `sem_destroy'
/home/ytan/Dev/build-mingw/libvpx/lib/libvpx.a(ethreading.c.o):(.text+0x131b): undefined reference to `sem_destroy'
/home/ytan/Dev/build-mingw/libvpx/lib/libvpx.a(ethreading.c.o):(.text+0x1323): undefined reference to `sem_destroy'
/home/ytan/Dev/build-mingw/libvpx/lib/libvpx.a(ethreading.c.o):(.text+0x13f3): undefined reference to `sem_init'
/home/ytan/Dev/build-mingw/libvpx/lib/libvpx.a(ethreading.c.o):(.text+0x1400): undefined reference to `sem_init'
/home/ytan/Dev/build-mingw/libvpx/lib/libvpx.a(ethreading.c.o):(.text+0x1423): undefined reference to `pthread_create'
/home/ytan/Dev/build-mingw/libvpx/lib/libvpx.a(ethreading.c.o):(.text+0x147e): undefined reference to `sem_post'
/home/ytan/Dev/build-mingw/libvpx/lib/libvpx.a(ethreading.c.o):(.text+0x1490): undefined reference to `pthread_join'
/home/ytan/Dev/build-mingw/libvpx/lib/libvpx.a(ethreading.c.o):(.text+0x14a3): undefined reference to `sem_destroy'
/home/ytan/Dev/build-mingw/libvpx/lib/libvpx.a(ethreading.c.o):(.text+0x14ba): undefined reference to `sem_post'
/home/ytan/Dev/build-mingw/libvpx/lib/libvpx.a(ethreading.c.o):(.text+0x14c8): undefined reference to `pthread_join'
/home/ytan/Dev/build-mingw/libvpx/lib/libvpx.a(ethreading.c.o):(.text+0x14d4): undefined reference to `sem_destroy'
/home/ytan/Dev/build-mingw/libvpx/lib/libvpx.a(ethreading.c.o):(.text+0x14e0): undefined reference to `sem_destroy'
/home/ytan/Dev/build-mingw/libvpx/lib/libvpx.a(ethreading.c.o):(.text+0x14e8): undefined reference to `sem_destroy'
collect2: error: ld returned 1 exit status
library.mak:102: recipe for target 'libavcodec/avcodec-57.dll' failed
make: *** [libavcodec/avcodec-57.dll] Error 1

sem_post tampaknya menunjuk ke pthread yang digunakan oleh mingw64 compiler, tetapi menambahkannya ke --host-cflags="-lpthread" tidak melihat untuk membantu. Ada ide?


bagaimana menambahkan ke flag langkah tautan, di mana diperlukan, I.E. itu LFLAGS.rather daripada ke flag kompilasi, di mana tidak diperlukan
user3629249

Saya mencoba, tetapi memiliki kesalahan yang sama.
bot1131357

Jawaban:


0

Menambahkan --extra-ldlibflags="-pthread" membuatnya bekerja. Saya pikir itu bukan karena saya menambahkannya di tempat yang salah, tetapi karena saya harus menggunakan -pthread dari pada -lpthread. Ada perbedaan.

Sekarang perintah configure saya seperti ini:

./configure --prefix=/home/ytan/Dev/build-mingw/ffmpeg/ --enable-cross-compile --cross-prefix=x86_64-w64-mingw32- --arch=x86_64 --target-os=mingw64 --pkg-config-flags="--static" --enable-shared --disable-static --enable-libvpx --enable-libvorbis --enable-libmp3lame --enable-openssl --enable-pic  --enable-debug --extra-ldlibflags="-static -pthread"
Dengan menggunakan situs kami, Anda mengakui telah membaca dan memahami Kebijakan Cookie dan Kebijakan Privasi kami.
Licensed under cc by-sa 3.0 with attribution required.