赞
踩
背景:
在cef上进行二次开发,发现默认不只支持h264解码。需要重新编译chromium解决。
步骤:
https://bitbucket.org/chromiumembedded/cef/wiki/MasterBuildQuickStart.md#markdown-header-linux-setup 为官方编译指导。主要步骤已经十分详细。下面红字部分补充一些实际编译遇到的问题。
前提:
需要fq
需要fq
需要fq!!
需要好用的vpn,或者ssr 加 proxifier 实现全局代理。具体教程网上很多。
What's Required
Step-by-step Guide
In this example "~" is "/home/marshall". Note that in some cases the absolute path must be used. Environment variables described in this section can be added to your "~/.profile" or "~/.bashrc" file to persist them across sessions.
整体主要是用户和权限问题,需要非root用户执行
1. Create the following directories.
mkdir ~/code mkdir ~/code/automate mkdir ~/code/chromium_git
2. Download and run "~/code/install-build-deps.sh" to install build dependencies. Answer Y (yes) to all of the questions.
cd ~/code sudo apt-get install curl curl 'https://chromium.googlesource.com/chromium/src/+/master/build/install-build-deps.sh?format=TEXT' | base64 -d > install-build-deps.sh chmod 755 install-build-deps.sh sudo ./install-build-deps.sh --no-arm --no-chromeos-fonts --no-nacl
3. Install the "libgtkglext1-dev" package required by the cefclient sample application.
sudo apt-get install libgtkglext1-dev
4. Download "~/code/depot_tools" using Git.
cd ~/code git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git
5. Add the "~/code/depot_tools" directory to your PATH. Note the use of an absolute path here.
export PATH=/home/marshall/code/depot_tools:$PATH
6. Download the "~/automate/automate-git.py" script.
cd ~/code/automate wget https://bitbucket.org/chromiumembedded/cef/raw/master/tools/automate/automate-git.py
7. Create the "~/code/chromium_git/update.sh" script with the following contents.
(环境变量主要是为了加入对h264解码的支持,chromium默认是不支持h264的)
#!/bin/bash export DEPOT_TOOLS_UPDATE=0 export CEF_USE_GN=1 export GN_DEFINES="is_official_build=true proprietary_codecs=true ffmpeg_branding=Chrome" export GYP_DEFINES=buildtype=Official python ../automate/automate-git.py --download-dir=/home/marshall/code/chromium_git --depot-tools-dir=/home/marshall/code/depot_tools --no-distrib --no-build
(--branch=3683 指定对应要下载的分支版本 --force-clean 最好加上,可以去除残留)
Give it executable permissions.
cd ~/code/chromium_git chmod 755 update.sh
Run the "update.sh" script and wait for CEF and Chromium source code to download. CEF source code will be downloaded to "~/code/chromium_git/cef" and Chromium source code will be downloaded to "~/code/chromium_git/chromium/src". After download completion the CEF source code will be copied to "~/code/chromium_git/chromium/src/cef".
cd ~/code/chromium_git ./update.sh
8. Create the "~/code/chromium_git/chromium/src/cef/create.sh" script with the following contents.】
(环境变量主要是为了加入对h264解码的支持,chromium默认是不支持h264的)
#!/bin/bash export DEPOT_TOOLS_UPDATE=0 export CEF_USE_GN=1 export GN_DEFINES="is_official_build=true proprietary_codecs=true ffmpeg_branding=Chrome use_jumbo_build=true" export GYP_DEFINES=buildtype=Official export GN_DEFINES=use_jumbo_build=true ./cef_create_projects.sh
Give it executable permissions.
cd ~/code/chromium_git/chromium/src/cef chmod 755 create.sh
Run the "create.sh" script to create Ninja project files. Repeat this step if you change the project configuration or add/remove files in the GN configuration (BUILD.gn file).
cd ~/code/chromium_git/chromium/src/cef ./create.sh
9. Create a Debug build of CEF/Chromium using Ninja. Edit the CEF source code at "~/code/chromium_git/chromium/src/cef" and repeat this step multiple times to perform incremental builds while developing. Note the additional "chrome_sandbox" target required by step 10.
cd ~/code/chromium_git/chromium/src ninja -C out/Debug_GN_x64 cef chrome_sandbox
10. Set up the Linux SUID sandbox.
# This environment variable should be set at all times. export CHROME_DEVEL_SANDBOX=/usr/local/sbin/chrome-devel-sandbox # This command only needs to be run a single time. cd ~/code/chromium_git/chromium/src sudo BUILDTYPE=Debug_GN_x64 ./build/update-linux-sandbox.sh
11. Run the cefclient sample application.
cd ~/code/chromium_git/chromium/src ./out/Debug_GN_x64/cefclient 相关问题: 1、________ running 'cipd ensure -log-level error -root /home/z/code/chromium_git/chromium -ensure-file /tmp/tmpkunrfR.ensure' in '.' CIPD selfupdate failed. Trying to bootstrap the CIPD client from scratch... [P21376 19:08:21.295 client.go:309 W] RPC failed transiently. Will retry in 1s {"error":"failed to send request: Post https://chrome-infra-packages.appspot.com/prpc/cipd.Repository/ResolveVersion: proxyconnect tcp: net/http: TLS handshake timeout", "host":"chrome-infra-packages.appspot.com", "method":"ResolveVersion", "service":"cipd.Repository", "sleepTime":"1s" 解决:查看代理设置 默认https是优先选择的,如果https不可用,直接设置为export https_proxy=http:// 2、FAILED: gen/mojo/public/js/mojo_bindings_lite.js 解决:安装jdk 3、clang++: error: unable to execute command: Killed clang++: error: clang frontend command failed due to signal (use -v to see invocation) clang version 9.0.0 (trunk 351477) Target: x86_64-unknown-linux-gnu Thread model: posix InstalledDir: ../../third_party/llvm-build/Release+Asserts/bin clang++: note: diagnostic msg: PLEASE submit a bug report to https://bugs.llvm.org/ and include the crash backtrace, preprocessed source, and associated run script. clang++: note: diagnostic msg: 解决:内存不够,增加swap空间 sudo fallocate -l 6G /swapfile sudo chmod 600 /swapfile sudo mkswap /swapfile sudo swapon /swapfile 开机自动挂载swap: 使用 vi 或 nano 在 /etc/fstab 文件底部添加如下内容: /swapfile none swap sw 0 0 4、WARNING: subprocess '"git" "-c" "core.deltaBaseCacheLimit=2g" "fetch" "origin"' in 解决: 在对应目录执行 git remote prune origin(同步远程仓库)
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。