我正在尝试从源代码在 CentOS 中编译 FFmpeg。我参考了官方编译指南(https://trac.ffmpeg.org/wiki/CompilationGuide/Centos)对于 CentOS 一步步安装,并已安装列出的依赖项。但是当我尝试配置 FFmpeg 时,遇到了如下问题:
文件中的错误行(1249~1270)configure
是:
check_exec(){
check_ld "cc" "$@" && { enabled cross_compile || $TMPE >> $logfile 2>&1; }
}
check_exec_crash(){
log check_exec_crash "$@"
code=$(cat)
# exit() is not async signal safe. _Exit (C99) and _exit (POSIX)
# are safe but may not be available everywhere. Thus we use
# raise(SIGTERM) instead. The check is run in a subshell so we
# can redirect the "Terminated" message from the shell. SIGBUS
# is not defined by standard C so it is used conditionally.
(check_exec "$@") >> $logfile 2>&1 <<EOF
config.log 显示:
zscale_filter=yes
zscale_filter_deps=libzimg
mktemp -u XXXXXX
Ubjjqz
check_ld cc
check_cc
BEGIN /tmp/ffconf.rgbbriKe.c
1 int main(void){ return 0; }
END /tmp/ffconf.rgbbriKe.c
gcc -I/home/vis/guangli/local/include -c -o /tmp/ffconf.LLalSg6X.o /tmp/ffconf.rgbbriKe.c
gcc -L/home/vis/guangli/local/lib -ldl -o /tmp/ffconf.G3SYKa9M /tmp/ffconf.LLalSg6X.o
C compiler test failed.
我的操作系统是CentOS x86_64,系统中安装的gcc是gcc-4.4.6,但是为了用gcc-4.8.2编译FFmpeg,我相应地GCC482_HOME/{bin,include}
在环境变量中添加:PATH, C_INCLUDE_PATH
答案1
事实证明(出于未知的原因)放置/tmp
在系统上的任何可执行文件都会出现段错误。甚至cp /bin/ls /tmp && cd /tmp && ./ls
给出了一个ls
that 段错误。但如果移动到您的主目录,那么它就可以工作。
那就是破坏配置;明显的解决方法是创建主目录的子目录并将 TMPDIR 设置为该子目录。