2022年-编译IJK

1,182 阅读2分钟

直播项目所需 ,这边记录一下编译过程以及和坑吧。

教程 ijk 地址

参考

步骤

  • 创建空文件夹 进行clone
git clone https://github.com/Bilibili/ijkplayer.git ijkplayer-ios

image.png

  • 进入 切换分支
cd ijkplayer-ios
git checkout -B latest k0.8.8

image.png

  • 执行脚本
./init-ios.sh

这个步骤稍微时间长点 请耐心等待 然后 ijkplayer-ios 整个文件夹就会变大了

  • 编译 ffmpeg
cd ios
./compile-ffmpeg.sh clean
./compile-ffmpeg.sh all

clean成功

image.png

all 失败

解决 .arch armv7-a

**./libavutil/arm/asm.S:50:9:** **error:** **unknown directive**

        .arch armv7-a

**^**

image.png

参考

解决方案一

将tools/do-compile-ffmpeg.sh文件里面的armv7架构禁用汇编,改成

FFMPEG_CFG_FLAGS="$FFMPEG_CFG_FLAGS $FFMPEG_CFG_FLAGS_ARM

替换成 

FFMPEG_CFG_FLAGS="$FFMPEG_CFG_FLAGS --enable-pic --disable-asm

image.png

继续执行 先 clean

./compile-ffmpeg.sh clean
./compile-ffmpeg.sh all

ok了

image.png

解决方案二:

compile-ffmpeg.sh 进行调整 3处

image.png

image.png

image.png

image.png

编译成功

编译 IJK

修改 Run 的 Build Configuration 为 Release

image.png

编译 asm

选择 真机 Any iOS Device(arm64,armv7)

image.png

调试出 Products

image.png

打开 IJKMediaPlayer.xcodeproj

image.png

修改 mainGroup 找到值

image.png

交互位置

image.png

image.png

asm 继续

编译出模拟器 选择任何一个模拟器都可以

image.png

lipo

lipo -info 

image.png

合并测试、真机成新的

lipo -create xxx xxx -output xxxx

先复制出一个模拟器和真机的 然后合并成新的

image.png

image.png

have the same architectures (arm64) and can't be in the same fat output file

有相同架构

剔除 arm64架构

Excluded Architectures 添加 arm64

image.png

继续 create 合并

image.png

解决方案二:

这个方法报错是 .a 找不到文件所以这个暂时不搞了 目前这个 是真机不行 模拟器的可以

image.png

image.png

包小

image.png

image.png

image.png 这个设置no 效果再目前test项目上很小

总结:手动拖入比较小、脱去符号也会小

static

似乎让包小 但是我用的时候报错了

暂时记录一下吧

image.png