Linux 有问必答:如何在Linux 中修复“fatal error: x264.h: No such file or directo
2015-04-05 07:18
633 查看
提问: 我想在Linux中从源码编译视频编码程序。到那时,在编译时,我遇到了一个错误“fatal error: x264.h: No such file or directory”,我该如何修复?
下面的编译错误错明你系统中没有x264开发库文件。
x264是GNU GPL授权的H.264/MPEG-4 ***C编码库。x264库被广泛用于视频编码/转码程序比如Avidemux、FFmpeg、 HandBrake、 OpenShot、 MEncode等等。
要解决这个问题,你需要安装x264的开发库文件。你可以如下做。
RPM Fusion设置完成后,你可以使用下面的命令安装x264开发文件。
注意RPM Fusion仓库在CentOS 7中还没有,因此上面的方法在CentOS 7中还不可行。万一是CentOS 7 ,你可以从源码编译并安装x264,下面会解释的。
x264库将会安装在/usr/local/lib。要让其他程序可以使用这个库,你需要完成最后一步。
打开/etc/ld.so.conf,并添加下面的行。
最后运行下面的命令重新加载共享库:
最后,要让其他的程序可以访问到位于 /usr/local/lib的x264库,在 /etc/ld.so.conf加入下面的行。
最后运行下面的命令重新加载共享库:
下面的编译错误错明你系统中没有x264开发库文件。
[code]fatal error: x264.h: No such file or directory[/code]
x264是GNU GPL授权的H.264/MPEG-4 ***C编码库。x264库被广泛用于视频编码/转码程序比如Avidemux、FFmpeg、 HandBrake、 OpenShot、 MEncode等等。
要解决这个问题,你需要安装x264的开发库文件。你可以如下做。
在 Debian、 Ubuntu 或者 Linux Mint 中安装像x264库和开发文件
在基于Debian的系统中,x264库已经包含在基础仓库中。可以直接用apt-get来安装。[code] $ sudo apt-get install libx264-dev[/code]
在 Fedora、 CentOS/RHEL中安装像x264库和开发文件
在基于Red Hat的发行版比如Fedora或者CentOS,x264库在免费的RPM Fusion仓库中有。那么,你需要首先安装RPM Fusion (免费) 。RPM Fusion设置完成后,你可以使用下面的命令安装x264开发文件。
[code] $ sudo yum --enablerepo=rpmfusion-free install x264-devel[/code]
注意RPM Fusion仓库在CentOS 7中还没有,因此上面的方法在CentOS 7中还不可行。万一是CentOS 7 ,你可以从源码编译并安装x264,下面会解释的。
在Debian、 Ubuntu 或者 Linux Mint中源码编译x264库
如果libx264包在你的发行版中并没有,那么你可以按照下面的方法编译最新的x264库。[code]$ sudo apt-get install g++ automake autoconf libtool yasm nasm git $ git clone git://git.videolan.org/x264.git $ cd x264 $ ./configure --enable-static --enable-shared $ make $ sudo make install[/code]
x264库将会安装在/usr/local/lib。要让其他程序可以使用这个库,你需要完成最后一步。
打开/etc/ld.so.conf,并添加下面的行。
[code]$ sudo vi /etc/ld.so.conf[/code]
[code]/usr/local/lib[/code]
最后运行下面的命令重新加载共享库:
[code]$ sudo ldconfig[/code]
在 Fedora, CentOS/RHEL 中源码编译x264库
如果你Linux的发行版中没有x264库(比如:CentOS 7)或者x264库并不是最新的,你可以如下编译最新的x264库。[code]$ sudo yum install gcc gcc-c++ automake autoconf libtool yasm nasm git $ git clone git://git.videolan.org/x264.git $ cd x264 $ ./configure --enable-static --enable-shared $ make $ sudo make install[/code]
最后,要让其他的程序可以访问到位于 /usr/local/lib的x264库,在 /etc/ld.so.conf加入下面的行。
[code]$ sudo vi /etc/ld.so.conf[/code]
[code]/usr/local/lib[/code]
最后运行下面的命令重新加载共享库:
[code]$ sudo ldconfig[/code]
相关文章推荐
- 在Linux中修复“fatal error: x264.h: No such file or directo”错误的方法
- Linux 有问必答:如何修复“fatal error: openssl/aes.h: No such file or directory
- Linux 有问必答:如何在Linux中修复“fatal error: lame/lame.h: No such file or dir
- Linux有问必答:如何修复"fatal error: jsoncpp/json/json.h: No such file..."
- 如何修复 “fatal error: security/pam_modules.h: No such file or directory”
- ubuntu下如何处理出现“ unable to execute ./DrClientLinux: No such file or directory”,“没有那个文件或目录”的问题。
- Linux下修复“fatal error: jsoncpp/json/json.h: No such file or directory”
- 【Linux】执行shell脚本出现异常:bad interpreter: No such file or directory如何解决
- Linux设备驱动程序安装fatal error: linux/module.h: No such file or directory
- Linux下修复“fatal error: jsoncpp/json/json.h: No such file or directory” 分类: C++ | 标签: Linux,jsonjson
- Android 源码编译Linux内核时出现fatal error: linux/netfilter/xt_dscp.h: No such file or directory
- (原創) 如何解決Java在Linux上『libXp.so.6: cannot open shared object file: No such file or directory』的錯誤訊息? (OS) (Linux) (CentOS) (Java)
- linux Ubuntu C++:“fatal error: iostream.h: No such file or directory ”
- Linux中如何设置服务自启动 FAQ: Ubuntu 12.04 64bit /sbin/insserv: No such file or directory
- Linux下执行.sh文件提示No such file or directory
- Linux 格式化分区 报错Could not stat --- No such file or directory 和 partprobe 命令
- 在Linux中执行.sh脚本,异常/bin/sh^M: bad interpreter: No such file or directory
- ubuntu 64bit arm-linux-gcc: No such file or directory 问题
- Linux 格式化分区 报错Could not stat --- No such file or directory 和 partprobe 命令
- linux下执行Sh文件报告bin/sh^M: bad interpreter: No such file or directory