1.编译依赖库
a.zlib库
cd /home/guochongxin/bbb-debian
mkdir thirds
cd thirds
mkdir install
tar xvf zlib-1.2.8.tar.xz
cd zlib-1.2.8/
CC=/home/guochongxin/bbb-debian/gcc-linaro-arm-linux-gnueabihf-4.8-2013.10_linux/bin/arm-linux-gnueabihf-gcc ./configure --prefix=/home/guochongxin/bbb-debian/gcc-linaro-arm-linux-gnueabihf-4.8-2013.10_linux/arm-linux-gnueabihf/ --shared
make
make install
b.jpeg库
cd ..
tar xvf jpegsrc.v9b.tar.gz
cd jpeg-9b/
CC=/home/guochongxin/bbb-debian/gcc-linaro-arm-linux-gnueabihf-4.8-2013.10_linux/bin/arm-linux-gnueabihf-gcc ./configure --prefix=/home/guochongxin/bbb-debian/gcc-linaro-arm-linux-gnueabihf-4.8-2013.10_linux/arm-linux-gnueabihf/ --host=arm-linux-gnueabihf --enable-shared
make
make install
c.png库
cd ..
tar xvf libpng-1.6.21.tar.xz
cd libpng-1.6.21/
CC=/home/guochongxin/bbb-debian/gcc-linaro-arm-linux-gnueabihf-4.8-2013.10_linux/bin/arm-linux-gnueabihf-gcc ./configure --prefix=/home/guochongxin/bbb-debian/gcc-linaro-arm-linux-gnueabihf-4.8-2013.10_linux/arm-linux-gnueabihf/ --host=arm-linux-gnueabihf --with-pkgconfigdir=/home/guochongxin/bbb-debian/gcc-linaro-arm-linux-gnueabihf-4.8-2013.10_linux/arm-linux-gnueabihf/lib/pkgconfig LDFLAGS=-L/home/guochongxin/bbb-debian/gcc-linaro-arm-linux-gnueabihf-4.8-2013.10_linux/arm-linux-gnueabihf/lib/ CPPFLAGS=-I/home/guochongxin/bbb-debian/gcc-linaro-arm-linux-gnueabihf-4.8-2013.10_linux/arm-linux-gnueabihf/include/
make
make install
d.x264库
cd ..
tar xvf x264-snapshot-20160131-2245-stable.tar.bz2
cd x264-snapshot-20160131-2245-stable/
./configure --host=arm-linux-gnueabihf --cross-prefix=/home/guochongxin/bbb-debian/gcc-linaro-arm-linux-gnueabihf-4.8-2013.10_linux/bin/arm-linux-gnueabihf- --enable-shared --prefix=/home/guochongxin/bbb-debian/gcc-linaro-arm-linux-gnueabihf-4.8-2013.10_linux/arm-linux-gnueabihf/
make
make install
e.xvidcore
cd ..
tar xvf xvidcore-1.3.4.tar.gz
cd xvidcore/build/generic
CC=/home/guochongxin/bbb-debian/gcc-linaro-arm-linux-gnueabihf-4.8-2013.10_linux/bin/arm-linux-gnueabihf-gcc ./configure --prefix=/home/guochongxin/bbb-debian/gcc-linaro-arm-linux-gnueabihf-4.8-2013.10_linux/arm-linux-gnueabihf/ --host=arm-linux-gnueabihf --disable-assembly
make
make install
f.tiff库
cd ../../../
tar xvf tiff-4.0.6.tar.gz
cd tiff-4.0.6/
CC=/home/guochongxin/bbb-debian/gcc-linaro-arm-linux-gnueabihf-4.8-2013.10_linux/bin/arm-linux-gnueabihf-gcc CXX=/home/guochongxin/bbb-debian/gcc-linaro-arm-linux-gnueabihf-4.8-2013.10_linux/bin/arm-linux-gnueabihf-g++ ./configure --prefix=/home/guochongxin/bbb-debian/gcc-linaro-arm-linux-gnueabihf-4.8-2013.10_linux/arm-linux-gnueabihf/ --host=arm-linux-gnueabihf --enable-shared LDFLAGS=-L/home/guochongxin/bbb-debian/gcc-linaro-arm-linux-gnueabihf-4.8-2013.10_linux/arm-linux-gnueabihf/lib CPPFLAGS=-I/home/guochongxin/bbb-debian/gcc-linaro-arm-linux-gnueabihf-4.8-2013.10_linux/arm-linux-gnueabihf/include
make
make install
g.ffmpeg
cd ..
tar xvf ffmpeg-2.8.6.tar.bz2
cd ffmpeg-2.8.6/
./configure --prefix=/home/guochongxin/bbb-debian/gcc-linaro-arm-linux-gnueabihf-4.8-2013.10_linux/arm-linux-gnueabihf/ --enable-shared --enable-gpl --enable-cross-compile --arch=arm --disable-stripping --target-os=linux --enable-libx264 --enable-libxvid --cc=/home/guochongxin/bbb-debian/gcc-linaro-arm-linux-gnueabihf-4.8-2013.10_linux/bin/arm-linux-gnueabihf-gcc --enable-swscale --extra-cflags=-I/home/guochongxin/bbb-debian/gcc-linaro-arm-linux-gnueabihf-4.8-2013.10_linux/arm-linux-gnueabihf/include --extra-ldflags=-L/home/guochongxin/bbb-debian/gcc-linaro-arm-linux-gnueabihf-4.8-2013.10_linux/arm-linux-gnueabihf/lib --disable-asm
make
make install
2.编译OpenCV库
cd ..
unzip 3.1.0.zip
cd opencv-3.1.0
mkdir build install
cd build
cmake-gui .
执行完上述最后一条命令时,需要对OpenCV的编译进行配置,首先会弹出如下对话框:
按上图设置好相应路径后,点击“Configure”按钮,弹出如下对话框:
按上图选择相应的项后点击“Next >“按钮,出现如下对话框:
按上图设置后(Target Root要设置为ffmpeg源码根路径)点击”Finish“按钮后回到如下对话框:
按上图设置好安装路径,并将下图的gtk选项去掉:
然后点击“Generate”按钮,生成配置文件,关闭该对话框,接下来执行如下命令:
make
make install
执行完上面这两条命令编译并将目标文件安装到/home/guochongxin/bbb-debian/thirds/opencv-3.1.0/install目录下,将install目录下的所有文件夹和文件全部直接复制到BBB的根文件系统下即可。
END