RV1126平台搭建推流开发环境
我的交叉编译器的地址:
/home/liefyuan/rv1126/RV1126_RV1109_LINUX_SDK_V2.1.0_20210512/prebuilts/gcc/linux-x86/arm/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf/bin/arm-linux-gnueabihf-
一、libx264交叉编译
进入libx264-git目录开始交叉编译,这里要注意–cross-prefix交叉工具链地址,也就是放在sdk里面的位置,这里我位置仅供参考(后面的交叉工具链地址都是这个):
开始交叉编译配置:
./configure --prefix=/home/liefyuan/rv1126/RV1126_RV1109_LINUX_SDK_V2.1.0_20210512/prebuilts/gcc/linux-x86/arm/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf/bin/arm-linux-gnueabihf- --enable-shared
./configure --prefix=/opt/arm_libx264 --host=arm-linux --cross-prefix=/home/liefyuan/rv1126/RV1126_RV1109_LINUX_SDK_V2.1.0_20210512/prebuilts/gcc/linux-x86/arm/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf/bin/arm-linux-gnueabihf- --enable-shared --disable-static
liefyuan@ubuntu:~/rv1126/3th_lib/ffmpeg_lib/libx264-git$ ./configure --prefix=/opt/arm_libx264 --host=arm-linux --cross-prefix=/home/liefyuan/rv1126/RV1126_RV1109_LINUX_SDK_V2.1.0_20210512/prebuilts/gcc/linux-x86/arm/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf/bin/arm-linux-gnueabihf- --enable-shared --disable-static
Unknown option --disable-static, ignored
platform: ARM
byte order: little-endian
system: LINUX
cli: yes
libx264: internal
shared: yes
static: no
asm: yes
interlaced: yes
avs: avxsynth
lavf: no
ffms: no
mp4: no
gpl: yes
thread: posix
opencl: yes
filters: crop select_every
debug: no
gprof: no
strip: no
PIC: yes
bit depth: 8
chroma format: all
You can run 'make' or 'make fprofiled' now.
然后进行交叉编译:
make -j16
sudo make install
二、libx265交叉编译
步骤一:
解压libx265.tar.gz压缩包
步骤二:
修改CMakeList.txt文件
路径在:vim currrnt_dir/libx265-git/source/CMakeLists.txt
在文件头部添加以下信息:
SET(CMAKE_SYSTEM_NAME Linux)
SET(CMAKE_SYSTEM_PROCESSOR arm)
SET(CMAKE_C_COMPILER "/home/hao/shared/rv1126_rv1109_linux_sdk_v1.8.0_20210224/prebuilts/gcc/linux-x86/arm/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf/bin/arm-linux-gnueabihf-gcc")
SET(CMAKE_CXX_COMPILER "/home/hao/shared/rv1126_rv1109_linux_sdk_v1.8.0_20210224/prebuilts/gcc/linux-x86/arm/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf/bin/arm-linux-gnueabihf-g++")
set(CMAKE_EXE_LINKER_FLAGS "-ldl")
#set(CMAKE_CXX_FLAGS -ldl)
add_compile_options(-fPIC)
步骤三:
mkdir currrnt_dir/libx265-git/source/build
进入:cd currrnt_dir/libx265-git/source/build
cmake -DCMAKE_INSTALL_PREFIX=/opt/arm_libx265_install ..
make -j32
sudo make install
修改cmake文件:/libx265-git/source/CMakeLists.txt
在文件头部添加如下信息:
SET(CMAKE_SYSTEM_NAME Linux)
SET(CMAKE_SYSTEM_PROCESSOR arm)
SET(CMAKE_C_COMPILER "/home/liefyuan/rv1126/RV1126_RV1109_LINUX_SDK_V2.1.0_20210512/prebuilts/gcc/linux-x86/arm/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf/bin/arm-linux-gnueabihf-gcc")
SET(CMAKE_CXX_COMPILER "/home/liefyuan/rv1126/RV1126_RV1109_LINUX_SDK_V2.1.0_20210512/prebuilts/gcc/linux-x86/arm/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf/bin/arm-linux-gnueabihf-g++")
set(CMAKE_EXE_LINKER_FLAGS "-ldl")
#set(CMAKE_CXX_FLAGS -ldl)
add_compile_options(-fPIC)
建立build文件夹,并进入该文件夹下,同时进行编译
运行命令:
cmake -DCMAKE_INSTALL_PREFIX=/opt/arm_libx265_install ..
然后进行编译安装
make -j16
make install
编译报错
1、报错一:
...
/home/liefyuan/rv1126/3th_lib/ffmpeg_lib/libx265-git/source/common/param.cpp:1419:47: error: unable to find string literal operator ‘operator""cliopt’ with ‘const char [4]’, ‘unsigned int’ arguments
s += sprintf(s, " %s", (param) ? cliopt : "no-"cliopt);
^~~~~~~~~~~
/home/liefyuan/rv1126/3th_lib/ffmpeg_lib/libx265-git/source/common/param.cpp:1478:5: note: in expansion of macro ‘BOOL’
BOOL(p->bBPyramid, "b-pyramid");
^~~~
/home/liefyuan/rv1126/3th_lib/ffmpeg_lib/libx265-git/source/common/param.cpp:1419:47: error: unable to find string literal operator ‘operator""cliopt’ with ‘const char [4]’, ‘unsigned int’ arguments
s += sprintf(s, " %s", (param) ? cliopt : "no-"cliopt);
^~~~~~~~~~~
/home/liefyuan/rv1126/3th_lib/ffmpeg_lib/libx265-git/source/common/param.cpp:1479:5: note: in expansion of macro ‘BOOL’
BOOL(p->rc.cuTree, "cutree");
^~~~
/home/liefyuan/rv1126/3th_lib/ffmpeg_lib/libx265-git/source/common/param.cpp:1419:47: error: unable to find string literal operator ‘operator""cliopt’ with ‘const char [4]’, ‘unsigned int’ arguments
s += sprintf(s, " %s", (param) ? cliopt : "no-"cliopt);
^~~~~~~~~~~
...
CMakeFiles/Makefile2:262: recipe for target 'encoder/CMakeFiles/encoder.dir/all' failed
make[1]: *** [encoder/CMakeFiles/encoder.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
CMakeFiles/Makefile2:317: recipe for target 'common/CMakeFiles/common.dir/all' failed
make[1]: *** [common/CMakeFiles/common.dir/all] Error 2
Makefile:129: recipe for target 'all' failed
make: *** [all] Error 2
编辑文件:
vim /home/liefyuan/rv1126/3th_lib/ffmpeg_lib/libx265-git/source/common/param.cpp
1418gg
由下面
#define BOOL(param, cliopt) \
s += sprintf(s, " %s", (param) ? cliopt : "no-"cliopt);
改成这样
#define BOOL(param, cliopt) \
s += sprintf(s, " %s", (param) ? cliopt : " no- " cliopt);
2、报错二:
/home/liefyuan/rv1126/3th_lib/ffmpeg_lib/libx265-git/source/encoder/ratecontrol.cpp:56:28: error: unable to find string literal operator ‘operator""opt’ with ‘const char [4]’, ‘unsigned int’ arguments
char* q = strstr(opts, "no-"opt);\
^~~~~~~~
/home/liefyuan/rv1126/3th_lib/ffmpeg_lib/libx265-git/source/encoder/ratecontrol.cpp:453:17: note: in expansion of macro ‘CMP_OPT_FIRST_PASS’
CMP_OPT_FIRST_PASS("keyint", m_param->keyframeMax);
^~~~~~~~~~~~~~~~~~
/home/liefyuan/rv1126/3th_lib/ffmpeg_lib/libx265-git/source/encoder/ratecontrol.cpp:56:28: error: unable to find string literal operator ‘operator""opt’ with ‘const char [4]’, ‘unsigned int’ arguments
char* q = strstr(opts, "no-"opt);\
^~~~~~~~
/home/liefyuan/rv1126/3th_lib/ffmpeg_lib/libx265-git/source/encoder/ratecontrol.cpp:454:17: note: in expansion of macro ‘CMP_OPT_FIRST_PASS’
CMP_OPT_FIRST_PASS("scenecut", m_param->scenecutThreshold);
^~~~~~~~~~~~~~~~~~
/home/liefyuan/rv1126/3th_lib/ffmpeg_lib/libx265-git/source/encoder/ratecontrol.cpp:56:28: error: unable to find string literal operator ‘operator""opt’ with ‘const char [4]’, ‘unsigned int’ arguments
char* q = strstr(opts, "no-"opt);\
^~~~~~~~
/home/liefyuan/rv1126/3th_lib/ffmpeg_lib/libx265-git/source/encoder/ratecontrol.cpp:455:17: note: in expansion of macro ‘CMP_OPT_FIRST_PASS’
CMP_OPT_FIRST_PASS("intra-refresh", m_param->bIntraRefresh);
common/CMakeFiles/common.dir/build.make:494: recipe for target 'common/CMakeFiles/common.dir/param.cpp.o' failed
make[2]: *** [common/CMakeFiles/common.dir/param.cpp.o] Error 1
CMakeFiles/Makefile2:317: recipe for target 'common/CMakeFiles/common.dir/all' failed
make[1]: *** [common/CMakeFiles/common.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
encoder/CMakeFiles/encoder.dir/build.make:374: recipe for target 'encoder/CMakeFiles/encoder.dir/ratecontrol.cpp.o' failed
make[2]: *** [encoder/CMakeFiles/encoder.dir/ratecontrol.cpp.o] Error 1
CMakeFiles/Makefile2:262: recipe for target 'encoder/CMakeFiles/encoder.dir/all' failed
make[1]: *** [encoder/CMakeFiles/encoder.dir/all] Error 2
Makefile:129: recipe for target 'all' failed
make: *** [all] Error 2
和上面的错误一样,改那个文件的那个地方,加三个空格,"no-"
改为" no- "
然后就编译成功了!
In file included from /home/liefyuan/rv1126/RV1126_RV1109_LINUX_SDK_V2.1.0_20210512/prebuilts/gcc/linux-x86/arm/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf/arm-linux-gnueabihf/include/c++/8.3.0/vector:69,
from /home/liefyuan/rv1126/RV1126_RV1109_LINUX_SDK_V2.1.0_20210512/prebuilts/gcc/linux-x86/arm/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf/arm-linux-gnueabihf/include/c++/8.3.0/queue:61,
from /home/liefyuan/rv1126/3th_lib/ffmpeg_lib/libx265-git/source/x265.cpp:52:
/home/liefyuan/rv1126/RV1126_RV1109_LINUX_SDK_V2.1.0_20210512/prebuilts/gcc/linux-x86/arm/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf/arm-linux-gnueabihf/include/c++/8.3.0/bits/vector.tcc: In member function ‘void std::vector<_Tp, _Alloc>::_M_realloc_insert(std::vector<_Tp, _Alloc>::iterator, _Args&& ...) [with _Args = {long long int}; _Tp = long long int; _Alloc = std::allocator<long long int>]’:
/home/liefyuan/rv1126/RV1126_RV1109_LINUX_SDK_V2.1.0_20210512/prebuilts/gcc/linux-x86/arm/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf/arm-linux-gnueabihf/include/c++/8.3.0/bits/vector.tcc:413:7: note: parameter passing for argument of type ‘std::vector<long long int, std::allocator<long long int> >::iterator’ {aka ‘__gnu_cxx::__normal_iterator<long long int*, std::vector<long long int, std::allocator<long long int> > >’} changed in GCC 7.1
vector<_Tp, _Alloc>::
^~~~~~~~~~~~~~~~~~~
/home/liefyuan/rv1126/RV1126_RV1109_LINUX_SDK_V2.1.0_20210512/prebuilts/gcc/linux-x86/arm/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf/arm-linux-gnueabihf/include/c++/8.3.0/bits/vector.tcc: In function ‘int main(int, char**)’:
/home/liefyuan/rv1126/RV1126_RV1109_LINUX_SDK_V2.1.0_20210512/prebuilts/gcc/linux-x86/arm/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf/arm-linux-gnueabihf/include/c++/8.3.0/bits/vector.tcc:109:4: note: parameter passing for argument of type ‘__gnu_cxx::__normal_iterator<long long int*, std::vector<long long int, std::allocator<long long int> > >’ changed in GCC 7.1
_M_realloc_insert(end(), std::forward<_Args>(__args)...);
^~~~~~~~~~~~~~~~~
/home/liefyuan/rv1126/RV1126_RV1109_LINUX_SDK_V2.1.0_20210512/prebuilts/gcc/linux-x86/arm/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf/arm-linux-gnueabihf/include/c++/8.3.0/bits/vector.tcc:109:4: note: parameter passing for argument of type ‘__gnu_cxx::__normal_iterator<long long int*, std::vector<long long int, std::allocator<long long int> > >’ changed in GCC 7.1
_M_realloc_insert(end(), std::forward<_Args>(__args)...);
^~~~~~~~~~~~~~~~~
[100%] Linking CXX executable x265
[100%] Built target cli
编译成功后记得安装make install。
三、openssl交叉编译
下载openssl源码:
wget https://www.openssl.org/source/old/1.1.1/openssl-1.1.1f.tar.gz
解压:
tar -zxvf openssl-1.1.1f.tar.gz
进入目录
cd openssl-1.1.1f/
配置
./config no-asm shared no-async --prefix=/opt/arm_openssl --cross-compile-prefix=/home/liefyuan/rv1126/RV1126_RV1109_LINUX_SDK_V2.1.0_20210512/prebuilts/gcc/linux-x86/arm/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf/bin/arm-linux-gnueabihf-
编译
make
安装
sudo make install
报错:arm-linux-gnueabihf-gcc: error: unrecognized command line option ‘-m64’
解决方法:在顶层的Makefile中,找到有 ‘-m64’的地方(两处),将其删除。
四、libsrt交叉编译
把openssl的交叉编译库拷贝到
打开openssl的lib目录:
root@ubuntu:/opt/arm_openssl/lib# ls
engines engines-1.1 libcrypto.a libcrypto.so libcrypto.so.1.0.0 libssl.a libssl.so libssl.so.1.0.0 pkgconfig
打开Openssl的include目录
把openssl目录拷贝到srt/haicrypt目录下
cp -r openssl/ /home/liefyuan/rv1126/3th_lib/ffmpeg_lib/srt/haicrypt
进入srt目录下进行配置
先删除CMakeCache.txt文件,再配置
./configure --prefix=/opt/arm_libsrt --openssl-include-dir=/opt/arm_openssl/include --openssl-ssl-library=/opt/arm_openssl/lib --with-compiler-prefix=/home/liefyuan/rv1126/RV1126_RV1109_LINUX_SDK_V2.1.0_20210512/prebuilts/gcc/linux-x86/arm/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf/bin/arm-linux-gnueabihf-
配置的时候出现错误:bash: ./configure: /usr/bin/tclsh: bad interpreter: No such file or directory
liefyuan@ubuntu:~/rv1126/3th_lib/ffmpeg_lib/srt$ ./configure --prefix=/opt/arm_libsrt --openssl-include-dir=/opt/arm_openssl/include --openssl-ssl-library=/opt/arm_openssl/lib --with-compiler-prefix=/home/liefyuan/rv1126/RV1126_RV1109_LINUX_SDK_V2.1.0_20210512/prebuilts/gcc/linux-x86/arm/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf/bin/arm-linux-gnueabihf-
bash: ./configure: /usr/bin/tclsh: bad interpreter: No such file or directory
需要安装一下tclsh:apt install tclsh
配置就没有什么问题了。
然后编译、安装
make -j16
sudo make install
五、ffmpeg交叉编译
第一步配置:
./configure --prefix=/opt/arm_ffmpeg --enable-cross-compile --cross-prefix=/home/liefyuan/rv1126/RV1126_RV1109_LINUX_SDK_V2.1.0_20210512/prebuilts/gcc/linux-x86/arm/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf/bin/arm-linux-gnueabihf- --arch=armv7-a --target-os=linux --enable-gpl --enable-nonfree --extra-cflags="-I/opt/arm_libx264/include" --extra-ldflags="-L/opt/arm_libx264/lib " --enable-libx264 --extra-libs="-ldl -fpic -shared" --enable-shared --pkg-config-flags=--static
这个配置编译安装以后,在安装目录生成arm_ffmpeg文件夹。
需要输出H265/PKG-CONFIG路径
export PKG_CONFIG_PATH=/opt/arm_libx265_install/lib/pkgconfig:$PKG_CONFIG_PATH
export PKG_CONFIG_PATH=/opt/arm_libx264/lib/pkgconfig:$PKG_CONFIG_PATH
export PKG_CONFIG_PATH=/opt/arm_libsrt/lib/pkgconfig:$PKG_CONFIG_PATH
Libx264和Libsrt交叉编译
./configure --prefix=/opt/arm32_ffmpeg_srt --cross-prefix=/home/liefyuan/rv1126/RV1126_RV1109_LINUX_SDK_V2.1.0_20210512/prebuilts/gcc/linux-x86/arm/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf/bin/arm-linux-gnueabihf- --enable-cross-compile --target-os=linux --cc=/home/liefyuan/rv1126/RV1126_RV1109_LINUX_SDK_V2.1.0_20210512/prebuilts/gcc/linux-x86/arm/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf/bin/arm-linux-gnueabihf-gcc --arch=arm --enable-shared --disable-static --enable-ffmpeg --extra-cflags=-I/opt/arm_libsrt/include --extra-cflags=-I/opt/arm_libx264/include --extra-ldflags=-L/opt/arm_libx264/lib --extra-ldflags=-L/opt/arm_libsrt/lib --enable-libx264 --enable-gpl --extra-libs="-lm -lsrt -lssl -ldl -lcrypto"
./configure --prefix=/opt/arm32_ffmpeg_srt --cross-prefix=/home/liefyuan/rv1126/RV1126_RV1109_LINUX_SDK_V2.1.0_20210512/prebuilts/gcc/linux-x86/arm/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf/bin/arm-linux-gnueabihf- --enable-cross-compile --target-os=linux --cc=/home/liefyuan/rv1126/RV1126_RV1109_LINUX_SDK_V2.1.0_20210512/prebuilts/gcc/linux-x86/arm/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf/bin/arm-linux-gnueabihf-gcc --arch=arm --enable-shared --disable-static --enable-ffmpeg --extra-cflags=-I/opt/arm_libsrt/include --extra-cflags=-I/opt/arm_libx264/include --extra-cflags=-I/opt/arm_libx265/include --extra-ldflags=-L/opt/arm_libx264/lib --extra-ldflags=-L/opt/arm_libx265/lib --enable-libx264 --enable-libx265 --enable-gpl --pkg-config="pkg-config --static"
./configure --prefix=/opt/arm32_ffmpeg_srt --cross-prefix=/home/liefyuan/rv1126/RV1126_RV1109_LINUX_SDK_V2.1.0_20210512/prebuilts/gcc/linux-x86/arm/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf/bin/arm-linux-gnueabihf- --enable-cross-compile --target-os=linux --cc=/home/liefyuan/rv1126/RV1126_RV1109_LINUX_SDK_V2.1.0_20210512/prebuilts/gcc/linux-x86/arm/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf/bin/arm-linux-gnueabihf-gcc --arch=arm --enable-shared --disable-static --enable-ffmpeg --extra-cflags=-I/opt/arm_libsrt/include --extra-cflags=-I/opt/arm_libx264/include --extra-cflags=-I/opt/arm_libx265_install/include --extra-ldflags=-L/opt/arm_libx264/lib --extra-ldflags=-L/opt/arm_libx265_install/lib --extra-cflags=-I/opt/arm_libsrt/include --extra-ldflags=-L/opt/arm_libsrt/lib --enable-libsrt --enable-libx264 --enable-libx265 --enable-gpl --pkg-config="pkg-config --static" --extra-libs="-ldl"
建议使用第三个配置,最终编译安装后会在安装目录生成arm32_ffmpeg_srt文件夹
第二步:make
第三步:make install
编译出现的问题:
问题1:未定义closesocket,解决办法为在libavutil/timer.h中手动定义 #define closesocket(fd) close(fd)
libavformat/network.c: In function ‘ff_listen_bind’:
libavformat/network.c:254:5: error: implicit declaration of function ‘closesocket’; did you mean ‘ff_socket’? [-Werror=implicit-function-declaration]
closesocket(fd);
^~~~~~~~~~~
ff_socket
libavformat/options.c: In function ‘format_child_class_next’:
- 分享
- 举报
-
浏览量:2780次2023-01-08 18:43:37
-
浏览量:1266次2024-05-24 17:11:01
-
浏览量:1237次2024-05-24 17:28:44
-
2022-11-10 10:36:09
-
浏览量:611次2024-01-18 17:18:51
-
2022-11-07 14:56:46
-
浏览量:971次2023-11-30 11:48:53
-
浏览量:188次2024-10-18 13:07:07
-
2022-11-08 12:06:09
-
浏览量:826次2023-11-22 14:07:08
-
浏览量:3942次2021-06-18 16:05:42
-
浏览量:2523次2023-06-28 17:22:40
-
浏览量:1204次2024-01-09 18:27:38
-
浏览量:957次2023-11-10 15:08:11
-
浏览量:634次2023-12-21 16:28:56
-
浏览量:762次2023-12-25 14:23:01
-
浏览量:1962次2020-04-03 10:15:29
-
浏览量:2043次2023-04-07 17:30:05
-
浏览量:4907次2022-11-07 14:06:56
-
11篇
- 安装rk1109/rk1126环境
- Microchip推出首款完全可配置的碳化硅MOSFET数字栅极驱动器
- rv1126开发常用debug手段
- RK3568开发笔记整理之dtb.img和dtbo.img
- 瑞芯微RK3566电子纸方案五大优势,赋能大屏智能办公本
- A251-RK3568瑞芯微系列开发板测评之上手体验
- 飞翔吧少年! RK3288的四核全新Mali-T764 GPU图形处理器
- 智慧大屏升级,瑞芯微RK3399芯MAXHUB旋转会议平板提升移动办公体验
- 人脸识别速度提升50%,瑞芯微推出RV1126智能考勤/门禁/闸机产品方案
- 只有我最摇摆!现有android游戏一秒变3D!【指尖上的RK3288芯】
-
广告/SPAM
-
恶意灌水
-
违规内容
-
文不对题
-
重复发帖
Keith_Cheung
感谢您的打赏,如若您也想被打赏,可前往 发表专栏 哦~
举报类型
- 内容涉黄/赌/毒
- 内容侵权/抄袭
- 政治相关
- 涉嫌广告
- 侮辱谩骂
- 其他
详细说明