Last updated on February 6, 2015 by Dan Nanni
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 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, HandBrake, 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.
x264
Library and Development Files on Debian, Ubuntu or Linux MintOn 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
x264
Library and Development Files on Fedora, CentOS or RHELOn 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) first.
Once RPM Fusion is set up, you can install x264
development files as follows.
$ sudo yum --enablerepo=rpmfusion-free-updates 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.
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 https://code.videolan.org/videolan/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
x264
Library from the Source on Fedora, CentOS or RHELIf 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 https://code.videolan.org/videolan/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
This website is made possible by minimal ads and your gracious donation via PayPal or credit card
Please note that this article is published by Xmodulo.com under a Creative Commons Attribution-ShareAlike 3.0 Unported License. If you would like to use the whole or any part of this article, you need to cite this web page at Xmodulo.com as the original source.
Xmodulo © 2021 ‒ About ‒ Write for Us ‒ Feed ‒ Powered by DigitalOcean