原文连接:https://blog.csdn.net/jenie/article/details/110000453
1).安装依赖的包:
code:
sudo apt-get update
sudo apt-get install build-essential git-core checkinstall texi2html libfaac-dev \
libopencore-amrnb-dev libopencore-amrwb-dev libsdl1.2-dev libtheora-dev \
libvorbis-dev libx11-dev libxfixes-dev zlib1g-dev
2.安装Yasm:x264需要使用yasm来针对CPU架构进行优化,提高性能。
code:
cd
wget http://www.tortall.net/projects/yasm/releases/yasm-1.2.0.tar.gz
tar xzvf yasm-1.2.0.tar.gz
cd yasm-1.2.0
./configure
make
make install
3.安装x264:下载源代码、编译、安装
code:
cd
git clone http://git.videolan.org/git/x264.git
cd x264
./configure --enable-shared //动态库
make
make install
4.此时 libx264.so默认安装在/usr/local/lib,直接编译会出现
tmux: error while loading shared libraries: libx264.so.2: cannot open shared object file: No such file or directory
原因就是已经安装了该共享库, 但执行需要调用该共享库的程序的时候, 程序按照默认共享库路径 /usr/lib 找不到该共享库文件.
如果共享库文件安装到了/usr/local/lib(很多开源的共享库都会安装到该目录下)或其它"非/lib或/usr/lib"目录下, 那么在执行ldconfig命令前, 还要把新共享库目录加入到共享库配置文件/etc/ld.so.conf中, 如下:
# cat /etc/ld.so.conf
include ld.so.conf.d/*.conf
# echo "/usr/local/lib" >> /etc/ld.so.conf
# ldconfig
网友评论