Jiaolong's Blog Jiaolong's Blog
首页
分类
归档
Wiki
摘录
导航
留言
关于

Jiaolong

Solo Developer
首页
分类
归档
Wiki
摘录
导航
留言
关于
  • 在 Ubuntu 20.04 上安装 GCC
  • hello world
  • 使用cva6+spike搭建RISC-V环境
  • gcc编译过程查看汇编代码
  • 分析RISC-V汇编代码
  • RISC-V V扩展1.0版本环境搭建与测试
  • RISCV-V扩展执行速度测试
  • 移植FFmpeg到RISC-V记录
    • ./configure
    • 1. 编译 yasm
    • 2. 编译pkg-config
    • 3. 编译 libx264
    • ffmpeg编译configure
    • 报错记录
  • Linux创建Swap交换分区
  • RISC-V \\V\\ Vector Extension 1.0 翻译
  • RISCV-V拓展1.0解读
  • 浅谈向量化和SIMD
  • x264编译测试
  • 浅淡Makefile
  • 回炉重造C语言
  • 使用Gprof+Gprod2dot做性能分析
  • 移植x264到RISC-V
  • QEMU运行RVV
  • 优化x264
  • 音视频理论基础
  • Swift拼音排序
  • Blog
Jiaolong
2022-08-24
Catelog

移植FFmpeg到RISC-V记录进行中

# ./configure

一般手动编译分三步, configure 配置, make 编译 make install 安装

常规配置方法:

查看帮助选项./configure help,如果帮助选项中有 build 选项,只需在命令行加--build=riscv64-unknown-elf

少部分程序在 configure help 没有 build 选项,需要手动运行 config.guess脚本 ,检测系统体系结构。

riscv64-unknown-linux-gnu-gcc

# 1. 编译 yasm

yasm是一个 汇编编译器,后面编译 x264 需要用到它,它能加快编译速度。

进入解压过的yasm文件夹

./configure --prefix=/usr/local --build=riscv64-unknown-linux-gnu
1
1

# 2. 编译pkg-config

./configure --prefix=/usr/local --build=riscv64-unknown-linux-gnu --with-internal-glib
1
1

# 3. 编译 libx264

./configure  --enable-shared --enable-static --prefix=/usr/local
1
1

# ffmpeg编译configure

在ffmpeg目录下,查看所有可配置选项

./configure --help
1
1
  • –-arch可以指定架构

    可选值可在configure里搜索ARCH_LIST查看

  • --prefix 安装程序到指定目录(默认/usr/local)

  • --cross-prefix :编译工具路径

  • --enable-cross-compile:启用交叉编译器

./configure --cross-prefix=riscv64-unknown-linux-gnu- 
			--enable-cross-compile 
			--target-os=linux 
			--cc=riscv64-unknown-linux-gnu-gcc 
			--arch=riscv 
			--prefix=/usr/local/ffmpeg 
			--pkg-config=true 
			--pkgconfigdir=/usr/local/pkg-config 
			--enable-ffmpeg --disable-armv5te --disable-armv6 --disable-armv6t2 
1
2
3
4
5
6
7
8
9
1
2
3
4
5
6
7
8
9

综合:

./configure --cross-prefix=riscv64-unknown-linux-gnu- --enable-cross-compile --target-os=linux --cc=riscv64-unknown-linux-gnu-gcc --arch=riscv --prefix=/usr/local/ffmpeg --pkg-config=true --pkgconfigdir=/usr/local/pkg-config --enable-ffmpeg --disable-armv5te --disable-armv6 --disable-armv6t2 
1
1

# 报错记录

  1. WARNING: riscv64-unknown-elf-pkg-config not found, library detection may fail.
collect2: error: ld returned 1 exit status
make: *** [Makefile:131: ffmpeg_g] Error 1
1
2
1
2
 --pkg-config=true --pkgconfigdir=/usr/local/pkt-config
1
1
  1. error: 'PATH_MAX' undeclared here (not in a function)
In file included from libavcodec/v4l2_buffers.c:34:
libavcodec/v4l2_m2m.h:44:18: error: 'PATH_MAX' undeclared here (not in a function)
   44 |     char devname[PATH_MAX];
      |                  ^~~~~~~~
make: *** [ffbuild/common.mak:81: libavcodec/v4l2_buffers.o] Error 1
1
2
3
4
5
1
2
3
4
5

解决方案:

检查该文件,并引入头文件

#include <linux/limits.h>
1
1
Last updated: 2022/12/04, 13:58:10

← RISCV-V扩展执行速度测试 Linux创建Swap交换分区→

Copyright © 2022-2023 | Jiaolong Wang
  • 跟随系统
  • 浅色模式
  • 深色模式