translated

This commit is contained in:
geekpi 2015-02-11 13:19:33 +08:00
parent 9176a44912
commit adfd8b55d5
2 changed files with 91 additions and 93 deletions

View File

@ -1,93 +0,0 @@
translating----geekpi
Linux FAQs with Answers--How to fix “fatal error: x264.h: No such file or directory” on Linux
================================================================================
> **Question**: I am trying to build a video encoding application from the source on Linux. However, during compilation, I am encountering the error: "fatal error: x264.h: No such file or directory" How can I fix this error?
The following compilation error indicates that you do not have x264 library's development files installed on your Linux system.
fatal error: x264.h: No such file or directory
[x264][1] is an H.264/MPEG-4 AVC encoder library licensed with GNU GPL. The x264 library is popularly used by many video encoder/transcoder programs such as Avidemux, [FFmpeg][2], [HandBrake][3], OpenShot, MEncode and more.
To solve the above compilation error, you need to install development files for x264 library. Here is how you can do it.
### Install x264 Library and its Development Files on Debian, Ubuntu or Linux Mint ###
On Debian based systems, x264 library is already included in the base repositories. Thus its installation is straightforward with apt-get as follows.
$ sudo apt-get install libx264-dev
### Install x264 Library and its Development Files on Fedora, CentOS/RHEL ###
On Red Hat based distributions such as Fedora or CentOS, the x264 library is available via the free repository of RPM Fusion. Thus, you need to install [RPM Fusion (free)][4] first.
Once RPM Fusion is set up, you can install x264 development files as follows.
$ sudo yum --enablerepo=rpmfusion-free install x264-devel
Note that RPM Fusion repository is not available for CentOS 7 yet, so the above method does not work for CentOS 7. In case of CentOS 7, you can build and install x264 library from the source, which is explained below.
### Compile x264 Library from the Source on Debian, Ubuntu or Linux Mint ###
If the libx264 package that comes with your distribution is not up-to-date, you can compile the latest x264 library from the source as follows.
$ 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
The x264 library will be installed in /usr/local/lib. To allow the library to be used by other applications, you need to complete the last step:
Open /etc/ld.so.conf with a text editor, and append the following line.
$ sudo vi /etc/ld.so.conf
----------
/usr/local/lib
Finally reload all shared libraries by running:
$ sudo ldconfig
### Compile x264 Library from the Source on Fedora, CentOS/RHEL ###
If the x264 library is not available on your Linux distribution (e.g., CentOS 7) or the x264 library is not up-to-date, you can build the latest x264 library from the source as follows.
$ 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
Finally, to allow other applications to use x264 library installed in /usr/local/lib, add the following line in /etc/ld.so.conf:
$ sudo vi /etc/ld.so.conf
----------
/usr/local/lib
and reload all shared libraries by running:
$ sudo ldconfig
![](https://farm8.staticflickr.com/7350/16453197512_7c18c5c09e_b.jpg)
--------------------------------------------------------------------------------
via: http://ask.xmodulo.com/fatal-error-x264-h-no-such-file-or-directory.html
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
[1]:http://www.videolan.org/developers/x264.html
[2]:http://ask.xmodulo.com/compile-ffmpeg-centos-fedora-rhel.html
[3]:http://xmodulo.com/how-to-install-handbrake-on-linux.html
[4]:http://xmodulo.com/how-to-install-rpm-fusion-on-fedora.html

View File

@ -0,0 +1,91 @@
Linux 有问必答如何在Linux 中修复“fatal error: x264.h: No such file or directory”的错误
================================================================================
> **提问**: 我想在Linux中从源码编译视频编码程序。到那时在编译时我遇到了一个错误“fatal error: x264.h: No such file or directory”我该如何修复
下面的编译错误错明你系统中没有x264开发库文件。
fatal error: x264.h: No such file or directory
[x264][1]是GNU GPL授权的H.264/MPEG-4 AVC编码库。x264库被广泛用于视频编码/转码程序比如Avidemux、[FFmpeg][2]、 [HandBrake][3]、 OpenShot、 MEncode等等。
要解决这个问题你需要安装x264的开发库文件。你可以这么做。
###在 Debian、 Ubuntu 或者 Linux Mint 中安装像x264库和开发文件 ###
在基于Debian的系统中x264库已经包含在基础仓库中。可以直接用apt-get来安装。
$ sudo apt-get install libx264-dev
### 在 Fedora、 CentOS/RHEL中安装像x264库和开发文件 ###
在基于Red Hat的发行版比如Fedora或者CentOSx264库在免费的RPM Fusion仓库中有。那么你需要首先安装[RPM Fusion (免费)][4] 。
RPM Fusion设置完成后你可以使用下面的命令安装x264开发文件。
$ sudo yum --enablerepo=rpmfusion-free install x264-devel
注意RPM Fusion仓库在CentOS 7中还没有因此上面的方法在CentOS 7中还不可行。万一是CentOS 7 你可以从源码编译并安装x264,下面会解释的。
### 在Debian、 Ubuntu 或者 Linux Mint中源码编译x264库 ###
如果libx264包在你的发行版中并没有那么你可以按照下面的方法编译最新的x264库。
$ 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
x264库将会安装在/usr/local/lib。要让其他程序可以使用这个库你需要完成最后一步。
打开/etc/ld.so.conf并添加下面的行。
$ sudo vi /etc/ld.so.conf
----------
/usr/local/lib
最后运行下面的命令重新加载共享库:
$ sudo ldconfig
### 在 Fedora, CentOS/RHEL 中源码编译x264库 ###
如果你Linux的发行版中没有x264库比如:CentOS 7或者x264库并不是最新的你可以如下编译最新的x264库。
$ 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
最后,要让其他的程序可以访问到位于 /usr/local/lib的x264库在 /etc/ld.so.conf加入下面的行。
$ sudo vi /etc/ld.so.conf
----------
/usr/local/lib
最后运行下面的命令重新加载共享库:
$ sudo ldconfig
![](https://farm8.staticflickr.com/7350/16453197512_7c18c5c09e_b.jpg)
--------------------------------------------------------------------------------
via: http://ask.xmodulo.com/fatal-error-x264-h-no-such-file-or-directory.html
译者:[geekpi](https://github.com/geekpi)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
[1]:http://www.videolan.org/developers/x264.html
[2]:http://ask.xmodulo.com/compile-ffmpeg-centos-fedora-rhel.html
[3]:http://xmodulo.com/how-to-install-handbrake-on-linux.html
[4]:http://xmodulo.com/how-to-install-rpm-fusion-on-fedora.html