背景是我們有嵌入式的需求,需要編譯webrtc進(jìn)入板子上。先說結(jié)論,最后是這樣config之后就編譯通過的:
gn gen out/linux-yeshen --args=‘target_os=“l(fā)inux” target_cpu=“arm64” ffmpeg_branding=“Chrome” proprietary_codecs=true is_debug=true target_sysroot=“…/…/linux/general_yeshen_arm64/aarch64-buildroot-linux-gnu/sysroot” rtc_use_pipewire=false rtc_use_x11=false’
查看編譯選項(xiàng)
gn args out/linux-yeshen --list
主要處理點(diǎn):
- target_sysroot 需要設(shè)置為嵌入式板子的sysroot。
- target_cpu 需要設(shè)置為版子的cpu類型,可選的有 arm64、arm
- 看看有哪些編譯選項(xiàng)不支持的,逐一關(guān)閉即可。比如rtc_use_pipewire是linux上獲取桌面相關(guān)的服務(wù),可以直接關(guān)掉。
這樣就完成了~
其他注意點(diǎn):
- 如果要使用android的toolschain,可以這樣指定
custom_toolchain="http://build/toolchain/android:clang_arm64"
# custom_toolchain="http://build/toolchain/linux:clang_arm64"
如果不在常見的支持列表中(arm64/arm32/amd64/x86),可以這樣指定出來,然后寫一些 config.gni
。
- 特殊報錯處理:
In file included from …/…/modules/rtp_rtcp/source/yeshen.h:72:
…/…/third_party/llvm-build/Release+Asserts/lib/clang/15.0.0/include/emmintrin.h:14:2:
error: “This header is only meant to be used on x86 and x64 architecture”
#error “This header is only meant to be used on x86 and x64 architecture”
如果遇到這類錯誤,大概率是引錯頭文件了(引了x86的頭文件),處理下相關(guān)的import即可。llvm是無辜的,不用看llvm相關(guān)的設(shè)置。
- 如果遇到這個報錯:
python3 “…/…/build/toolchain/gcc_link_wrapper.py” --output=“py_quality_assessment/quality_assessment/fake_polqa” – …/…/third_party/llvm-build/Release+Asserts/bin/clang++ -fuse-ld=lld -Wl,–fatal-warnings -Wl,–build-id -fPIC -Wl,-z,noexecstack -Wl,-z,relro -Wl,-z,now -Wl,–color-diagnostics -Wl,–no-call-graph-profile-sort --target=aarch64-linux-gnu -no-canonical-prefixes -Wl,–gdb-index -rdynamic -Wl,-z,defs -Wl,–as-needed -nostdlib++ --sysroot=…/…/build/linux/general_yeshen_arm64/aarch64-buildroot-linux-gnu/sysroot -pie -Wl,–disable-new-dtags -o “py_quality_assessment/quality_assessment/fake_polqa” -Wl,–start-group @“py_quality_assessment/quality_assessment/fake_polqa.rsp” -Wl,–end-group -ldl -lpthread -lrt
ld.lld: error: cannot open crtbeginS.o: No such file or directory
ld.lld: error: unable to find library -lgcc
ld.lld: error: unable to find library -lgcc
ld.lld: error: cannot open crtendS.o: No such file or directory
clang++: error: linker command failed with exit code 1 (use -v to see invocation)
說明缺少了這三個文件:crtbeginS.o、libgcc、crtendS.o,可以連接提供sysroot的供應(yīng)商補(bǔ)充。
也可以自己把ln -s相關(guān)文件到 ../../build/linux/general_yeshen_arm64/aarch64-buildroot-linux-gnu/sysroot/usr/lib
目錄下。文章來源:http://www.zghlxwxcb.cn/news/detail-677055.html
玩~文章來源地址http://www.zghlxwxcb.cn/news/detail-677055.html
到了這里,關(guān)于webrtc交叉編譯嵌入式的方法的文章就介紹完了。如果您還想了解更多內(nèi)容,請在右上角搜索TOY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!