Linux 有问必答:如何在Linux 中修复“fatal error: x264.h: No such file or directo

作者:佚名 上传时间:2019-04-08 版权申诉

Linux 有问必答:如何在Linux 中修复“fatal error: x264.h: No such file or directo

提问 : 我想在Linux中从源码编译视频编码程序。到那时,在编译时,我遇到了一个错误“fatal error: x264.h: No such file or directory”,我该如何修复?

下面的编译错误错明你系统中没有x264开发库文件。


  
  1. fatal error : x264 . h : No such file or directory

x264 是GNU GPL授权的H.264/MPEG-4 AVC编码库。x264库被广泛用于视频编码/转码程序比如Avidemux、 FFmpeg HandBrake 、 OpenShot、 MEncode等等。

要解决这个问题,你需要安装x264的开发库文件。你可以如下做。

在 Debian、 Ubuntu 或者 Linux Mint 中安装像x264库和开发文件

在基于Debian的系统中,x264库已经包含在基础仓库中。可以直接用apt-get来安装。


  
  1. $ sudo apt-get install libx264 - dev

在 Fedora、 CentOS/RHEL中安装像x264库和开发文件

在基于Red Hat的发行版比如Fedora或者CentOS,x264库在免费的RPM Fusion仓库中有。那么,你需要首先安装 RPM Fusion (免费)

RPM Fusion设置完成后,你可以使用下面的命令安装x264开发文件。


  
  1. $ sudo yum -- enablerepo = rpmfusion - free install x264 - devel

注意RPM Fusion仓库在CentOS 7中还没有,因此上面的方法在CentOS 7中还不可行。万一是CentOS 7 ,你可以从源码编译并安装x264,下面会解释的。

在Debian、 Ubuntu 或者 Linux Mint中源码编译x264库

如果libx264包在你的发行版中并没有,那么你可以按照下面的方法编译最新的x264库。


  
  1. $ sudo apt-get install g ++ automake autoconf libtool yasm nasm git
  2. $ git clone git : //git.videolan.org/x264.git
  3. $ cd x264
  4. $ ./ configure -- enable - static -- enable - shared
  5. $ make
  6. $ sudo make install

x264库将会安装在/usr/local/lib。要让其他程序可以使用这个库,你需要完成最后一步。

打开/etc/ld.so.conf,并添加下面的行。


  
  1. $ sudo vi / etc / ld . so . conf


  
  1. /usr/ local / lib

最后运行下面的命令重新加载共享库:


  
  1. $ sudo ldconfig

在 Fedora, CentOS/RHEL 中源码编译x264库

如果你Linux的发行版中没有x264库(比如:CentOS 7)或者x264库并不是最新的,你可以如下编译最新的x264库。


  
  1. $ sudo yum install gcc gcc - c ++ automake autoconf libtool yasm nasm git
  2. $ git clone git : //git.videolan.org/x264.git
  3. $ cd x264
  4. $ ./ configure -- enable - static -- enable - shared
  5. $ make
  6. $ sudo make install

最后,要让其他的程序可以访问到位于 /usr/local/lib的x264库,在 /etc/ld.so.conf加入下面的行。


  
  1. $ sudo vi / etc / ld . so . conf


  
  1. /usr/ local / lib

最后运行下面的命令重新加载共享库:


  
  1. $ sudo ldconfig


原文发布时间:2015-04-05

本文来自云栖合作伙伴“linux中国”

免责申明:文章和图片全部来源于公开网络,如有侵权,请通知删除 server@dude6.com

用户评论
相关推荐
Linux 有问必答:如何在Linux 修复fatal error: x264.h: No such file or directo
Linux 有问必答:如何在Linux 中修复“fatal error: x264.h: No such file or directo 提问
Linux 有问必答:如何在Linux修复fatal error: lame/lame.h: No such file or dir
Linux 有问必答:如何在Linux中修复“fatal error: lame/lame.h: No such file or dir 提问
Linux 有问必答:如何修复fatal error: openssl/aes.h: No such file or directory
Linux 有问必答:如何修复“fatal error: openssl/aes.h: No such file or directory Ques
fatal error zmq.hpp No such file or directory compilation terminated.
fatal error: zmq.hpp: No such file or directory compilation terminated. 找不到zmq.hpp的原因是, zmq.hpp只存在ma
HPP
23KB
2020-08-07 10:46
fatal error zmq.hpp No such file or directory compilation terminated.
fatal error: zmq.hpp: No such file or directory compilation terminated. 找不到zmq.hpp的原因是, zmq.hpp只存在ma
HPP
23KB
2020-08-07 10:46
Linux有问必答:如何修复“sshd error: could not load host key”
Linux有问必答:如何修复“sshd error: could not load host key” 问题 :当我尝试SSH到一
fatal error C1083Cannot open include file configwin.h修复工具.rar
软件介绍: 网友分享的能够解决fatal error C1083: Cannot open include file: 'config-win.h': No such file or dir
RAR
0B
2020-05-17 20:01
fatal open dev null or dup failed No such file or directory修复
使用gitBashhere闪退并生成mintty.exe.stackdump文件cmd使用git报错fatal:open/dev/nullordupfailed:Nosuchfileordirecto
ZIP
0B
2019-07-18 20:03
修复VS2008LINK fatal error LNK1000
修复VS2008LINKfatalerrorLNK1000:InternalerrorduringIncrBuildImage错误
RAR
0B
2019-09-06 09:15
Linux有问必答-如何在Linux安装Go语言
Linux有问必答-如何在Linux中安装Go语言 Go (也叫 "golang")是一款由Google最初开发的编程语言。它自诞生就有几个设计原则:简单性、安全性和速度