docker
docker
容器,使用 amd64
架构容器兼容 webrtc
和 open harmony sdk
工具链docker run --privileged -itd --name ohms_webrtc -v /webrtc:/root/webrtc:rw --platform linux/amd64 ubuntu:20.04
uname -a
Linux admin 5.4.0-181-generic #201-Ubuntu SMP Thu Mar 28 15:39:01 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux
docker exec -it ohms_webrtc bash
mkdir webrtc
cd webrtc
git clone <https://chromium.googlesource.com/chromium/tools/depot_tools.git>
vi ~/.bashrc # 在.bashrc文件的末尾添加下面一行代码
export PATH="$PATH:/xxx/webrtc/depot_tools"
source ~/.bashrc # 配置完环境变量后使环境变量生效
git clone <https://gitee.com/openharmony-sig/ohos_webrtc.git>
apt install sudo vim git python3 lsb-release ninja-build # 下载一些基础工具
cd ohos_webrtc
./build/install-build-deps.sh # 下载 webrtc 编译依赖工具链
编译的时候 -j 参数最好小于 cpu 核心,否则可能会应为 cpu 跑满而导致编译失败,虽然编译会慢一点但是还能接受。
比如:ninja -C out/arm64 -v -j8。
Architecture: x86_64
CPU op-mode(s): 32-bit
Byte Order: Little Endian
CPU(s): 12
On-line CPU(s) list: 0-11
Thread(s) per core: 1
Core(s) per socket: 12
Socket(s): 1
Vendor ID: 0x61
Model: 0
Stepping: 0x0
BogoMIPS: 48.00
./build.sh /owner/workspace/ohos-sdk/linux/native/
# 修改 /owner/workspace/ohos-sdk/linux/native/ 为自己下载鸿蒙sdk,解压之后的目录
arm64-v8a
gn gen out/arm64 --args='is_clang=true target_os="ohos" target_cpu="arm64" ohos_extra_ldflags="-static-libstdc++" is_official_build=true rtc_use_h264=true rtc_use_h265=true is_component_ffmpeg=true ohos_sdk_native_root="path/to/ohos/sdk"'
ninja -C out/arm64 -v -j8