StaZhu / enable-chromium-hevc-hardware-decoding

A guide that teach you enable hardware HEVC decoding & encoding for Chrome / Edge, or build a custom version of Chromium / Electron that supports hardware & software HEVC decoding and hardware HEVC encoding.
MIT License
1.24k stars 60 forks source link

FAILED: libffmpeg.so libffmpeg.so.TOC #54

Closed SeduardoIA0 closed 1 year ago

SeduardoIA0 commented 1 year ago

I am trying to create my own version of chromium with HEVC support, on ubuntu, and I am failing to create it. I add the steps that I am following. Thank you in advance for the help.

System: image

Steps: cd /home/eduardo/2023/chrome/ git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git export PATH="$PATH:/home/eduardo/2023/chrome/depot_tools" mkdir chromium && cd chromium fetch --nohooks --no-history chromium cd src ./build/install-build-deps.sh gclient runhooks gn gen out/Default

cd third_party/ffmpeg git am /home/eduardo/2023/chrome/add-hevc-ffmpeg-decoder-parser.patch cd src git am /home/eduardo/2023/chrome/remove-main-main10-profile-limit.patch cp -R /home/eduardo/2023/chrome/widevine/* third_party/widevine/cdm

autoninja -C out/Default chrome

Error: ninja: Entering directory `out/Default' [0/1] Regenerating ninja files [9985/58534] SOLINK ./libffmpeg.so FAILED: libffmpeg.so libffmpeg.so.TOC "python3" "../../build/toolchain/gcc_solink_wrapper.py" --readelf="../../third_party/llvm-build/Release+Asserts/bin/llvm-readelf" --nm="../../third_party/llvm-build/Release+Asserts/bin/llvm-nm" --sofile="./libffmpeg.so" --tocfile="./libffmpeg.so.TOC" --output="./libffmpeg.so" -- ../../third_party/llvm-build/Release+Asserts/bin/clang++ -shared -Wl,-soname="libffmpeg.so" -Wl,-Bsymbolic -L gen/third_party/ffmpeg -Werror -fuse-ld=lld -Wl,--fatal-warnings -Wl,--build-id -fPIC -Wl,-z,noexecstack -Wl,-z,relro -Wl,--color-diagnostics -Wl,--undefined-version -Wl,--no-call-graph-profile-sort -m64 -no-canonical-prefixes -Wl,--gdb-index -rdynamic -Wl,-z,defs -Wl,--as-needed -nostdlib++ --sysroot=../../build/linux/debian_bullseye_amd64-sysroot -Wl,-rpath=\$ORIGIN -o "./libffmpeg.so" @"./libffmpeg.so.rsp"
ld.lld: error: undefined symbol: ff_hevc_parser

referenced by parsers.c obj/third_party/ffmpeg/ffmpeg_internal/parsers.o:(parser_list)

ld.lld: error: undefined symbol: ff_hevc_decoder

referenced by allcodecs.c obj/third_party/ffmpeg/ffmpeg_internal/allcodecs.o:(codec_list) clang++: error: linker command failed with exit code 1 (use -v to see invocation) [9990/58534] CC obj/third_party/libaom/libaom/variance.o ninja: build stopped: subcommand failed.

StaZhu commented 1 year ago

Looks like this section (https://github.com/StaZhu/enable-chromium-hevc-hardware-decoding/blob/d0b8d2d4cb1b5ff3cf0fe95da200ad686db76294/add-hevc-ffmpeg-decoder-parser.patch#L3126) is not included in the dependency.

Looks like maybe because you are using wrong gn args to build the chromium, can you share your gn args?

StaZhu commented 1 year ago

Keep in mind that this section is important:

If you are using Mac + want to build x64 arch (target_cpu to x86 , arm64 , arm also available) + want to add CDM support, then run gn gen out/Release64 --args="is_component_build = false is_official_build = true is_debug = false ffmpeg_branding = \"Chrome\" target_cpu = \"x64\" proprietary_codecs = true media_use_ffmpeg = true enable_widevine = true bundle_widevine_cdm = true", if you are using Windows, you need to add enable_media_foundation_widevine_cdm = true as well.

SeduardoIA0 commented 1 year ago

The steps I am following are these, without any argument. If you have any guides I can read or some steps to share I would be very grateful.

git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git

export PATH="$PATH:/home/eduardo/2023/chrome/depot_tools"

mkdir chromium && cd chromium

fetch --nohooks --no-history chromium

cd src

./build/install-build-deps.sh

gclient runhooks

gn gen out/Default

cd third_party/ffmpeg

git am /home/eduardo/2023/chrome/add-hevc-ffmpeg-decoder-parser.patch

cd src

git am /home/eduardo/2023/chrome/remove-main-main10-profile-limit.patch

cp -R /home/eduardo/2023/chrome/widevine/* third_party/widevine/cdm

autoninja -C out/Default chrome

StaZhu commented 1 year ago

Can you follow this https://github.com/StaZhu/enable-chromium-hevc-hardware-decoding#how-to-build ?

StaZhu commented 1 year ago

I am going to closing this since the build step has already wrote in the README.md, If you still have an issue building Chromium, please comment and let me know, Thanks!