[英]Compilation of x264 project
I had downloaded the source of x264 library .我已经下载了x264 库的源代码。
The version of x264 is 148. x264 的版本是 148。
For compilation of shared dlls I am using the following command under MSYS Environment:对于共享 dll 的编译,我在 MSYS 环境下使用以下命令:
./configure --disable-cli --enable-shared --prefix=.
The result is following:结果如下:
platform: X86_64
byte order: little-endian
system: WINDOWS
cli: no
libx264: internal
shared: yes
static: no
asm: yes
interlaced: yes
avs: no
lavf: no
ffms: no
mp4: no
gpl: yes
thread: win32
opencl: yes
filters: crop select_every
debug: no
gprof: no
strip: no
PIC: yes
bit depth: 8
chroma format: all
After execution of make I have the following error:执行make后出现以下错误:
common/win32thread.o:win32thread.c:(.text+0x60): undefined reference to `_beginthreadex'
common/win32thread.o:win32thread.c:(.text+0x60): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `_beginthreadex'
collect2: error: ld returned 1 exit status
Makefile:192: recipe for target 'libx264-148.dll' failed
make: *** [libx264-148.dll] Error 1
My working Environment:我的工作环境:
The configure command was executed without errors, but the make gives me the error described above.执行配置命令没有错误,但 make 给了我上述错误。
GCC is built by MSYS2/MinGW with different configurations, and bundled with different versions of MinGW-w64 headers/libs. GCC 由 MSYS2/MinGW 构建,具有不同的配置,并捆绑了不同版本的 MinGW-w64 头文件/库。
Ergo, MSYS applications need to be built using the pthreads
library.因此,需要使用
pthreads
库构建 MSYS 应用程序。 You can force an MSYS build of x264 to use the posix thread model, instead of the win32 model like this:您可以强制 x264 的 MSYS 构建使用 posix 线程模型,而不是像这样的 win32 模型:
$ ./configure --disable-cli --enable-shared --disable-win32thread
platform: X86_64
平台:X86_64
byte order: little-endian字节顺序:小端
system: WINDOWS系统:WINDOWS
cli: yescli:是的
libx264: internallibx264:内部
shared: yes共享:是
static: no静态:没有
asm: yesasm:是的
interlaced: yes交错:是
avs: avisynthavs:avisynth
lavf: no拉夫:没有
ffms: no实况调查:没有
mp4: nomp4:没有
gpl: yesgpl:是的
thread: posix线程:posix
opencl: noopencl:没有
filters: crop select_every过滤器:裁剪 select_every
lto: nolto:没有
debug: no调试:没有
gprof: no教授:没有
strip: no条:没有
PIC: yes图片:是的
bit depth: all位深:全部
chroma format: all色度格式:全部
You can run 'make' or 'make fprofiled' now.
您现在可以运行“make”或“make fprofiled”。
The problem is, there is no msys/winpthreads
package, so you would first need to cross-compile pthreads-win32
for MSYS2.问题是,没有
msys/winpthreads
包,因此您首先需要为 MSYS2 交叉编译pthreads-win32
。
Having said all that, you say说了这么多,你说
For compilation of shared dlls
用于编译共享dll
and not而不是
For compilation of .so shared libraries
用于编译 .so 共享库
So this seems like an xY problem to me.所以这对我来说似乎是一个 xY 问题。 I think you should be using MSYS to cross-compile x264 like this:
我认为您应该使用 MSYS 像这样交叉编译 x264:
$ ./configure --host=x86_64-w64-mingw32 --disable-cli --enable-shared --cross-prefix=x86_64-w64-mingw32-
(I would also use --prefix=/usr/local
, as well as --disable-opencl
for compatability with FFmpeg. (我也会使用
--prefix=/usr/local
,以及--disable-opencl
与 FFmpeg 兼容。
./configure --enable-shared --enable-static --disable-thread
I had the same problem.我有同样的问题。 It works with disabled thread.
它适用于禁用的线程。
I used the following option:我使用了以下选项:
./configure --disable-cli --enable-shared
But didn't wanted to disable threads, so, what I did is modified win32thread.c
like this:但是不想禁用线程,所以,我所做的是像这样修改
win32thread.c
:
Before:之前:
#if HAVE_WINRT
/* _beginthreadex() is technically the correct option, but it's only available for Desktop applications.
* Using CreateThread() as an alternative works on Windows Store and Windows Phone 8.1+ as long as we're
* using a dynamically linked MSVCRT which happens to be a requirement for WinRT applications anyway */
#define _beginthreadex CreateThread
#define InitializeCriticalSectionAndSpinCount(a, b) InitializeCriticalSectionEx(a, b, CRITICAL_SECTION_NO_DEBUG_INFO)
#define WaitForSingleObject(a, b) WaitForSingleObjectEx(a, b, FALSE)
#else
#include <process.h>
#endif
After之后
#define _beginthreadex CreateThread
#if HAVE_WINRT
#define InitializeCriticalSectionAndSpinCount(a, b) InitializeCriticalSectionEx(a, b, CRITICAL_SECTION_NO_DEBUG_INFO)
#define WaitForSingleObject(a, b) WaitForSingleObjectEx(a, b, FALSE)
#endif
Basically, I replaced _beginthreadex
by Windows' native CreateThread
.基本上,我用 Windows 的原生
CreateThread
替换了_beginthreadex
。 Not sure it's a huge problem for x264, but now I can compile.不确定这对 x264 来说是一个大问题,但现在我可以编译了。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.