libyuv之linux编译

文章目录

  • 一、下载源码
  • 二、编译源码
  • 三、注意事项
    • 1、银河麒麟系统(aarch64)
      • (1)解决 armv8-a+dotprod+i8mm 指令集支持问题
      • (2)解决 armv9-a+sve2 指令集支持问题

一、下载源码

到GitHub网站下载https://github.com/lemenkov/libyuv源码,或者用直接用git克隆到本地,如:git clone https://github.com/lemenkov/libyuv.git

二、编译源码

进入到libyuv目录,执行

cd libyuv
mkdir build && cd build 
cmake ..
make
make install 

三、注意事项

1、银河麒麟系统(aarch64)

(1)解决 armv8-a+dotprod+i8mm 指令集支持问题

[ 68%] Building CXX object CMakeFiles/yuv_common_objects.dir/source/scale_msa.cc.o
[ 70%] Building CXX object CMakeFiles/yuv_common_objects.dir/source/scale_rgb.cc.o
[ 71%] Building CXX object CMakeFiles/yuv_common_objects.dir/source/scale_rvv.cc.o
[ 73%] Building CXX object CMakeFiles/yuv_common_objects.dir/source/scale_uv.cc.o
[ 75%] Building CXX object CMakeFiles/yuv_common_objects.dir/source/scale_win.cc.o
[ 77%] Building CXX object CMakeFiles/yuv_common_objects.dir/source/video_common.cc.o
[ 77%] Built target yuv_common_objects
[ 78%] Building CXX object CMakeFiles/yuv_neon64.dir/source/compare_neon64.cc.o
cc1plus: 错误:invalid feature modifier in ‘-march=armv8-a+dotprod+i8mm’
make[2]: *** [CMakeFiles/yuv_neon64.dir/build.make:76:CMakeFiles/yuv_neon64.dir/source/compare_neon64.cc.o] 错误 1
make[1]: *** [CMakeFiles/Makefile2:123:CMakeFiles/yuv_neon64.dir/all] 错误 2
make: *** [Makefile:156:all] 错误 2
root@dev-pc:/opt/libyuv/build#

这是由于CPU不支持armv8-a+dotprod+i8mm指令集,因此需要修改CMakeLists.txt文件,添加宏定义add_definitions(-DLIBYUV_DISABLE_NEON=1),同时去掉Neon相关的代码编译工作,如下:
在这里插入图片描述

(2)解决 armv9-a+sve2 指令集支持问题

[ 73%] Building CXX object CMakeFiles/yuv_common_objects.dir/source/scale_msa.cc.o
[ 75%] Building CXX object CMakeFiles/yuv_common_objects.dir/source/scale_rgb.cc.o
[ 77%] Building CXX object CMakeFiles/yuv_common_objects.dir/source/scale_rvv.cc.o
[ 79%] Building CXX object CMakeFiles/yuv_common_objects.dir/source/scale_uv.cc.o
[ 81%] Building CXX object CMakeFiles/yuv_common_objects.dir/source/scale_win.cc.o
[ 83%] Building CXX object CMakeFiles/yuv_common_objects.dir/source/video_common.cc.o
[ 83%] Built target yuv_common_objects
[ 84%] Building CXX object CMakeFiles/yuv_sve.dir/source/row_sve.cc.o
cc1plus: 错误:unknown value ‘armv9-a+sve2’ for -march
cc1plus: 附注:valid arguments are: armv8-a armv8.1-a armv8.2-a armv8.3-a; did you mean ‘armv8-a’?
make[2]: *** [CMakeFiles/yuv_sve.dir/build.make:76:CMakeFiles/yuv_sve.dir/source/row_sve.cc.o] 错误 1
make[1]: *** [CMakeFiles/Makefile2:121:CMakeFiles/yuv_sve.dir/all] 错误 2
make: *** [Makefile:156:all] 错误 2

这是由于CPU不支持armv9-a+sve2指令集,因此需要修改CMakeLists.txt文件,添加宏定义add_definitions(-DLIBYUV_DISABLE_SVE=1),同时去掉SVE相关的代码编译工作,如下:
在这里插入图片描述

你可能感兴趣的:(Linux,linux,运维,服务器)