我想在Mac OS X 10.10上交叉编译ffmpeg 2.8.x,但是我遇到了以下错误。
HOSTCC libavcodec/cabac_tablegen.o
In file included from libavcodec/cabac_tablegen.c:25:
In file included from libavcodec/cabac_functions.h:43:
libavcodec/arm/cabac.h:96:25: error: value '24' out of range for constraint 'M'
[byte]"M"(offsetof(CABACContext, bytestream)),
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/7.0.2/include/stddef.h:120:24: note:
expanded from macro 'offsetof'
#define offsetof(t, d) __builtin_offsetof(t, d)
^~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
make: *** [libavcodec/cabac_tablegen.o] Error 1
错误显示主机 cc 中出现一些错误,主机 cc clang-700.1.81
$ gcc --version
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 7.0.2 (clang-700.1.81)
Target: x86_64-apple-darwin14.5.0
Thread model: posix
在我将 Xcode 升级到 7.2 之前,它工作正常。
对于 ffmpeg 3.x,没有这样的问题。但是我需要的 ffmpeg 版本是 2.8.x。如何在不将 Xcode 降级到以前版本的情况下修复?
这是主机cc的问题。
我保留了当前版本的Xcode,并在Command_Line_Tools_OS_X_10.10_for_Xcode_6.4
安装了另一个版本的命令行工具。
此命令行工具的 clang 版本是
$ /Library/Developer/CommandLineTools/usr/bin/cc --version
Apple LLVM version 6.1.0 (clang-602.0.53) (based on LLVM 3.6.0svn)
Target: x86_64-apple-darwin14.5.0
Thread model: posix
并在配置 ffmpeg 时将主机 cc 更改为此编译器。
./configure --host-cc=/Library/Developer/CommandLineTools/usr/bin/cc
现在它可以编译而不会出错。