Building cef

Having problems with building or using CEF's C/C++ APIs? This forum is here to help. Please do not post bug reports or feature requests here.

Building cef

Postby aleitner » Wed Nov 15, 2023 2:19 pm

I am trying to build chromium and so that I have access to a few files. How would you advise I update my command to get the expected files? I've read through the documentation present on the wiki but it isn't quite clear about the build-target and the distribution specifics.

Code: Select all
python3 automate-git.py --download-dir=./chromium-git --branch=6045 --minimal-distrib --force-clean --build-target="cefclient chrome_sandbox" --x64-build


What I need:
Release files: libEGL.so, libGLESv2.so, libcef.so, libvk_swiftshader.so, libvulkan.so.1, chrome-sandbox
Resource files: chrome_100_percent.pak, chrome_200_percent.pak, icudtl.dat, locales/, resources.pak
Header files

Do I need to build cefsimple? I am experimenting with this myself but it takes hours to build :(
Last edited by aleitner on Wed Nov 15, 2023 4:52 pm, edited 1 time in total.
aleitner
Techie
 
Posts: 49
Joined: Fri Jun 16, 2023 12:05 pm

Re: Building cef

Postby magreenblatt » Wed Nov 15, 2023 4:27 pm

Why do you need to build those files yourself? Binaries are available from https://cef-builds.spotifycdn.com/index.html
magreenblatt
Site Admin
 
Posts: 12409
Joined: Fri May 29, 2009 6:57 pm

Re: Building cef

Postby aleitner » Wed Nov 15, 2023 4:44 pm

I want to build cef for running headless using ozone so that we can remove our X Server dependency

I've been using the following GN_DEFINES

Code: Select all
export GN_DEFINES="use_ozone=true \                                                                                                                                         
ozone_platform_headless=true \                                                                                                                                         
ozone_platform=\"headless\" \                                                                                                                                         
is_official_build=true \                                                                                                                                         
is_debug=false \
chrome_pgo_phase=0 \
use_sysroot=true \
symbol_level=1 \
is_cfi=false"
Last edited by aleitner on Wed Nov 15, 2023 5:21 pm, edited 1 time in total.
aleitner
Techie
 
Posts: 49
Joined: Fri Jun 16, 2023 12:05 pm

Re: Building cef

Postby magreenblatt » Wed Nov 15, 2023 5:20 pm

aleitner wrote:I want to build cef for running headless using ozone so that we can remove our X Server dependency

In that case you should follow either the automated or master build instructions (depending on your needs), and add the GN_DEFINES related to ozone as shown here.
magreenblatt
Site Admin
 
Posts: 12409
Joined: Fri May 29, 2009 6:57 pm

Re: Building cef

Postby aleitner » Tue Nov 21, 2023 5:34 pm

I am currently working on building and packaging CEF with Ozone platform support enabled for a personal project. It builds fine on my local machine, but I'm running into build errors on Red Hat Enterprise Linux. The errors seem to be related to Git and gclient sync, but the exact cause is unclear to me.

Here is the relevant part of the GN_DEFINES and the build script I am using:

GN_DEFINES
Code: Select all
GN_DEFINES='use_ozone=true is_official_build=true is_debug=false chrome_pgo_phase=0 use_sysroot=true symbol_level=1
 is_cfi=false use_thin_lto=false use_vaapi=false use_allocator=none'


automate-git.py
Code: Select all
python3 /home/build/rpmbuild/SOURCES/automate-git.py --download-dir=/home/build/rpmbuild/BUILD/chromium_git --branc
h=6045 --minimal-distrib --force-clean --no-debug-build --no-distrib-docs --no-distrib-archive --build-target=cefclient --distrib-subd
ir=libcef --verbose-build --x64-build


During the build process, I encounter what appears to be git and gclient sync errors. Unfortunately, the output isn't clear to me, and I'm struggling to pinpoint the exact cause of the issue.

Here's a snippet of the error output related to git and gclient sync:
Code: Select all
Error: Command 'git checkout --quiet [commit_hash]' returned non-zero exit status 1 in /home/build/rpmbuild/BUILD/chromium_git/chromium/src/third_party/dawn/third_party/webgpu-cts
error: Your local changes to the following files would be overwritten by checkout:
...
Please, commit your changes or stash them before you can switch branches.
Aborting
...
subprocess.CalledProcessError: Command '['gclient', 'sync', '--reset', '--nohooks', '--with_branch_heads', '--jobs', '16']' returned non-zero exit status 1.
error: Bad exit status from /var/tmp/rpm-tmp.XfBAFz (%build)
...
make[1]: *** [Makefile:36: packages] Error 1
make: *** [Makefile:26: core] Error 2


Here is the full output if necessary
Code: Select all
> + GN_DEFINES='use_ozone=true is_official_build=true is_debug=false chrome_pgo_phase=0 use_sysroot=true symbol_level=1
 is_cfi=false use_thin_lto=false use_vaapi=false use_allocator=none'
> + python3 /home/build/rpmbuild/SOURCES/automate-git.py --download-dir=/home/build/rpmbuild/BUILD/chromium_git --branc
h=6045 --minimal-distrib --force-clean --no-debug-build --no-distrib-docs --no-distrib-archive --build-target=cefclient --distrib-subd
ir=libcef --verbose-build --x64-build
> Updating depot_tools...
> Cloning into '/home/build/rpmbuild/BUILD/chromium_git/cef'...
> Note: checking out 'origin/6045'.
>
> You are in 'detached HEAD' state. You can look around, make experimental
> changes and commit them, and you can discard any commits you make in this
> state without impacting any branches by performing another checkout.
>
> If you want to create a new branch to retain commits you create, you may
> do so (now or later) by using -b with the checkout command again. Example:
>
>   git checkout -b new_branch_name
>
> HEAD is now at c76a3b9... Update to Chromium version 119.0.6045.159
> Previous HEAD position was 38b8de0... Roll recipe dependencies (trivial).
> HEAD is now at 744bfd2... git_cl: show actual gerrit host instead of placeholder
>
> ________ running 'git -c core.deltaBaseCacheLimit=2g clone --no-checkout --progress https://chromium.googlesource.com
/chromium/src.git /home/build/rpmbuild/BUILD/chromium_git/chromium/_gclient_src_r1gu6xfp' in '/home/build/rpmbuild/BUILD/chromium_git/
chromium'
> Cloning into '/home/build/rpmbuild/BUILD/chromium_git/chromium/_gclient_src_r1gu6xfp'...
> remote: Sending approximately 43.07 GiB ...
remote: Counting objects: 963752, done
remote: Finding sources: 100% (4581/4581)581)
remote: Total 21688239 (delta 15901623), reused 21686792 (delta 15901623)
Receiving objects: 100% (21688239/21688239), 42.99 GiB | 54.83 MiB/s, done.2.87 MiB/s
Resolving deltas: 100% (15901623/15901623), done.23)
> [1:08:50] Still working on:
> [1:08:50]   src
> [1:09:00] Still working on:
> [1:09:00]   src
> [1:09:10] Still working on:
> [1:09:10]   src
> [1:09:20] Still working on:
> [1:09:20]   src
> [1:09:30] Still working on:
> [1:09:30]   src
> [1:09:37] Still working on:
> [1:09:37]   src
> [1:20:31] Still working on:
> [1:20:31]   src/third_party/swiftshader
> [1:20:31]   src/third_party/tflite/src
> [1:20:31]   src/v8
> [1:20:31]   src/third_party/angle/third_party/VK-GL-CTS/src
> [1:20:35] Still working on:
> [1:20:35]   src/third_party/swiftshader
> [1:20:35]   src/third_party/tflite/src
> [1:20:35]   src/v8
> [1:20:35]   src/third_party/angle/third_party/VK-GL-CTS/src
> [1:22:03] Still working on:
> [1:22:03]   src/v8
> [1:22:03]   src/third_party/angle/third_party/VK-GL-CTS/src
> [1:22:13] Still working on:
> [1:22:13]   src/v8
> [1:22:13]   src/third_party/angle/third_party/VK-GL-CTS/src
> [1:22:23] Still working on:
> [1:22:23]   src/v8
> [1:22:23]   src/third_party/angle/third_party/VK-GL-CTS/src
> [1:22:26] Still working on:
> [1:22:26]   src/v8
> [1:22:26]   src/third_party/angle/third_party/VK-GL-CTS/src
> [1:23:26] Still working on:
> [1:23:26]   src/third_party/angle/third_party/VK-GL-CTS/src
> [1:23:36] Still working on:
> [1:23:36]   src/third_party/angle/third_party/VK-GL-CTS/src
> [1:23:46] Still working on:
> [1:23:46]   src/third_party/angle/third_party/VK-GL-CTS/src
> [1:23:56] Still working on:
> [1:23:56]   src/third_party/angle/third_party/VK-GL-CTS/src
> [1:24:06] Still working on:
> [1:24:06]   src/third_party/angle/third_party/VK-GL-CTS/src
> [1:24:16] Still working on:
> [1:24:16]   src/third_party/angle/third_party/VK-GL-CTS/src
> [1:24:26] Still working on:
> [1:24:26]   src/third_party/angle/third_party/VK-GL-CTS/src
> [1:24:36] Still working on:
> [1:24:36]   src/third_party/angle/third_party/VK-GL-CTS/src
> [1:24:46] Still working on:
> [1:24:46]   src/third_party/angle/third_party/VK-GL-CTS/src
> [1:24:56] Still working on:
> [1:24:56]   src/third_party/angle/third_party/VK-GL-CTS/src
> [1:25:06] Still working on:
> [1:25:06]   src/third_party/angle/third_party/VK-GL-CTS/src
> [1:25:16] Still working on:
> [1:25:16]   src/third_party/angle/third_party/VK-GL-CTS/src
> [1:25:26] Still working on:
> [1:25:26]   src/third_party/angle/third_party/VK-GL-CTS/src
> [1:25:36] Still working on:
> [1:25:36]   src/third_party/angle/third_party/VK-GL-CTS/src
> [1:25:46] Still working on:
> [1:25:46]   src/third_party/angle/third_party/VK-GL-CTS/src
> [1:25:56] Still working on:
> [1:25:56]   src/third_party/angle/third_party/VK-GL-CTS/src
> [1:26:06] Still working on:
> [1:26:06]   src/third_party/angle/third_party/VK-GL-CTS/src
> [1:26:16] Still working on:
> [1:26:16]   src/third_party/angle/third_party/VK-GL-CTS/src
> [1:26:26] Still working on:
> [1:26:26]   src/third_party/angle/third_party/VK-GL-CTS/src
> [1:26:36] Still working on:
> [1:26:36]   src/third_party/angle/third_party/VK-GL-CTS/src
> [1:26:46] Still working on:
> [1:26:46]   src/third_party/angle/third_party/VK-GL-CTS/src
> [1:26:54] Still working on:
> [1:26:54]   src/third_party/angle/third_party/VK-GL-CTS/src
> WARNING: Your metrics.cfg file was invalid or nonexistent. A new one will be created.
> From https://chromium.googlesource.com/chromium/src
>b2b13a4..6f1fc91  main-> origin/main
>9073884..da0e28d  refs/branch-heads/6099 -> branch-heads/6099
>  * [new tag]120.0.6099.35 -> 120.0.6099.35
> Previous HEAD position was b2b13a4... Revert "[OOPIF PDF] Parameterize remaining PDFExtensionTestBase subclasses"
> HEAD is now at eaa7671... win: skip AddNetworkAdaptor tests on x86 builds
>
> src/third_party/dawn/third_party/webgpu-cts (ERROR)
> ----------------------------------------
> [0:00:15] Started.
> [0:00:15] Finished running: git config remote.origin.url
> [0:00:15] Finished running: git rev-list -n 1 HEAD
> [0:00:15] Finished running: git rev-parse --abbrev-ref=strict HEAD
> [0:00:17] Finished running: git rev-list -n 1 HEAD
> ----------------------------------------
> Error: Command 'git checkout --quiet be1210e145e89e7a2943947d983f9592495e0f52' returned non-zero exit status 1 in /ho
me/build/rpmbuild/BUILD/chromium_git/chromium/src/third_party/dawn/third_party/webgpu-cts
> error: Your local changes to the following files would be overwritten by checkout:
>src/resources/cache/webgpu/shader/execution/binary/f16_matrix_matrix_multiplication.bin
>src/resources/cache/webgpu/shader/execution/binary/f16_matrix_subtraction.bin
>src/resources/cache/webgpu/shader/execution/binary/f32_matrix_matrix_multiplication.bin
>src/resources/cache/webgpu/shader/execution/binary/f32_matrix_scalar_multiplication.bin
>src/resources/cache/webgpu/shader/execution/binary/i32_arithmetic.bin
> src/resources/cache/webgpu/shader/execution/binary/i32_arithmetic.bin
> src/resources/cache/webgpu/shader/execution/ceil.bin
> src/resources/cache/webgpu/shader/execution/clamp.bin
> src/resources/cache/webgpu/shader/execution/cross.bin
> src/resources/cache/webgpu/shader/execution/mix.bin
> src/resources/cache/webgpu/shader/execution/unary/u32_complement.bin
> Please, commit your changes or stash them before you can switch branches.
> Aborting
>
> --> Creating directory /home/build/rpmbuild/BUILD/chromium_git
> --> Download Directory: /home/build/rpmbuild/BUILD/chromium_git
> --> Depot Tools Directory: /home/build/rpmbuild/BUILD/chromium_git/depot_tools
> -------- Running "git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git /home/build/rpmbuild/BUI
LD/chromium_git/depot_tools" in "/home/build/rpmbuild/BUILD/chromium_git"...
> --> Updating depot_tools
> -------- Running "update_depot_tools" in "/home/build/rpmbuild/BUILD/chromium_git/depot_tools"...
> --> CEF Branch: 6045
> --> CEF URL: https://bitbucket.org/chromiumembedded/cef.git
> --> CEF Source Directory: /home/build/rpmbuild/BUILD/chromium_git/cef
> -------- Running "git clone https://bitbucket.org/chromiumembedded/cef.git /home/build/rpmbuild/BUILD/chromium_git/ce
f" in "/home/build/rpmbuild/BUILD/chromium_git"...
> -------- Running "git rev-parse HEAD" in "/home/build/rpmbuild/BUILD/chromium_git/cef"...
> -------- Running "git rev-parse origin/6045" in "/home/build/rpmbuild/BUILD/chromium_git/cef"...
> --> CEF Current Checkout: 738192addf1f0d3f713affe033659c64f8dbeaf9
> --> CEF Desired Checkout: c76a3b9f2e3fd582512e89fd0e901368bac1a822 (origin/6045)
> -------- Running "git checkout --force origin/6045" in "/home/build/rpmbuild/BUILD/chromium_git/cef"...
> --> Reading /home/build/rpmbuild/BUILD/chromium_git/cef/CHROMIUM_BUILD_COMPATIBILITY.txt
> -------- Running "git checkout --force 744bfd2a7b" in "/home/build/rpmbuild/BUILD/chromium_git/depot_tools"...
> --> CEF Output Directory: /home/build/rpmbuild/BUILD/chromium_git/out_6045
> --> Creating directory /home/build/rpmbuild/BUILD/chromium_git/chromium
> --> Writing /home/build/rpmbuild/BUILD/chromium_git/chromium/.gclient
> -------- Running "gclient sync --nohooks --with_branch_heads --jobs 16" in "/home/build/rpmbuild/BUILD/chromium_git/c
hromium"...
> -------- Running "git config --get remote.origin.url" in "/home/build/rpmbuild/BUILD/chromium_git/chromium/src"...
> --> Chromium URL: https://chromium.googlesource.com/chromium/src.git
> -------- Running "git fetch" in "/home/build/rpmbuild/BUILD/chromium_git/chromium/src"...
> -------- Running "git fetch --tags" in "/home/build/rpmbuild/BUILD/chromium_git/chromium/src"...
> -------- Running "git rev-parse HEAD" in "/home/build/rpmbuild/BUILD/chromium_git/chromium/src"...
> -------- Running "git rev-parse refs/tags/119.0.6045.159" in "/home/build/rpmbuild/BUILD/chromium_git/chromium/src"..
.
> --> Chromium Current Checkout: b2b13a46f4cb2fbbc39cdb2a0a4a9250115b9dbf
> --> Chromium Desired Checkout: eaa767197fa7dd412133d1b84f7eb60da43409c9 (refs/tags/119.0.6045.159)
> -------- Running "git checkout --force refs/tags/119.0.6045.159" in "/home/build/rpmbuild/BUILD/chromium_git/chromium
/src"...
> --> Chromium DEPS file: /home/build/rpmbuild/BUILD/chromium_git/chromium/src/DEPS
> -------- Running "gclient sync --reset --nohooks --with_branch_heads --jobs 16" in "/home/build/rpmbuild/BUILD/chromi
um_git/chromium"...
> Traceback (most recent call last):
>   File "/home/build/rpmbuild/SOURCES/automate-git.py", line 1253, in <module>
>     ('--reset ' if discard_local_changes else ''), chromium_dir, depot_tools_dir)
>   File "/home/build/rpmbuild/SOURCES/automate-git.py", line 67, in run
>     args, cwd=working_dir, env=env, shell=(sys.platform == 'win32'))
>   File "/usr/lib64/python3.6/subprocess.py", line 311, in check_call
>     raise CalledProcessError(retcode, cmd)
> subprocess.CalledProcessError: Command '['gclient', 'sync', '--reset', '--nohooks', '--with_branch_heads', '--jobs',
'16']' returned non-zero exit status 1.
> error: Bad exit status from /var/tmp/rpm-tmp.XfBAFz (%build)
>
>
> RPM build errors:
>     Bad exit status from /var/tmp/rpm-tmp.XfBAFz (%build)
make[1]: *** [Makefile:36: packages] Error 1
make[1]: Leaving directory '/home/ubuntu/Documents/github/kcm/core'
make: *** [Makefile:26: core] Error 2
aleitner
Techie
 
Posts: 49
Joined: Fri Jun 16, 2023 12:05 pm

Re: Building cef

Postby aleitner » Tue Nov 28, 2023 10:51 pm

We have finally figured out what was causing the build failures that were blocking CEF from being built by our build system:

git

RHEL 7 has an ancient version of git that chokes on the Chromium source and incorrectly thinks a bunch of things are always modified, even after the initial git clone
running something like:
Code: Select all
$ git clone https://chromium.googlesource.com/external/github.com/gpuweb/cts.git
$ cd cts
$ git status

reports a bunch of files as modified, and there's nothing you can do to convince git otherwise.
RHEL 8 has a new enough version that this isn't an issue
We'll now build git from source for the EL7 build environment 2.39.3.
aleitner
Techie
 
Posts: 49
Joined: Fri Jun 16, 2023 12:05 pm

Re: Building cef

Postby aleitner » Wed Nov 29, 2023 9:47 am

After updating git, as per my previous post, the build process gets a lot further but I am encountering another error building on an RHEL 7 environment:

TypeError: Expected maxsize to be an integer or None

Do you know of any other dependencies which would cause this problem if not the latest version?

Full error trace
Code: Select all
 Generating CEF project files...
 Creating /home/build/rpmbuild/BUILD/chromium_git/chromium/src/out/Debug_GN_x64 directory.
 Traceback (most recent call last):
   File "/home/build/rpmbuild/BUILD/chromium_git/depot_tools/gn.py", line 14, in <module>
import gclient_paths
   File "/home/build/rpmbuild/BUILD/chromium_git/depot_tools/gclient_paths.py", line 24, in <module>
def FindGclientRoot(from_dir, filename='.gclient'):
   File "/usr/lib64/python3.6/functools.py", line 477, in lru_cache
raise TypeError('Expected maxsize to be an integer or None')
 TypeError: Expected maxsize to be an integer or None
 Traceback (most recent call last):
   File "/home/build/rpmbuild/BUILD/chromium_git/chromium/src/cef/tools/gclient_hook.py", line 149, in <module>
RunAction(src_dir, cmd)
   File "/home/build/rpmbuild/BUILD/chromium_git/chromium/src/cef/tools/gclient_util.py", line 36, in RunAction
command, cwd=dir, always_show_header=True, print_stdout=True)
   File "/home/build/rpmbuild/BUILD/chromium_git/depot_tools/gclient_utils.py", line 713, in CheckCallAndFilter
command_output.getvalue(), None)
 subprocess2.CalledProcessError: Command 'gn gen out/Debug_GN_x64' returned non-zero exit status 1 in /home/build/rpmb
uild/BUILD/chromium_git/chromium/src
 Traceback (most recent call last):
   File "/home/build/rpmbuild/BUILD/chromium_git/depot_tools/gn.py", line 14, in <module>
import gclient_paths
   File "/home/build/rpmbuild/BUILD/chromium_git/depot_tools/gclient_paths.py", line 24, in <module>
def FindGclientRoot(from_dir, filename='.gclient'):
   File "/usr/lib64/python3.6/functools.py", line 477, in lru_cache
raise TypeError('Expected maxsize to be an integer or None')
 TypeError: Expected maxsize to be an integer or None
aleitner
Techie
 
Posts: 49
Joined: Fri Jun 16, 2023 12:05 pm

Re: Building cef

Postby ndesktop » Wed Nov 29, 2023 10:17 am

Maybe this helps.
Python 3.8+ most likely will solve, as they say.
ndesktop
Master
 
Posts: 756
Joined: Thu Dec 03, 2015 10:10 am

Re: Building cef

Postby aleitner » Thu Nov 30, 2023 4:31 pm

I updated my rhel7 docker container to manually build/install python 3.9 which did in fact get past this issue. However during the build process I received an error that my glibc wasn't the correct version. At this point in time it seems like building cef on an rhel 7 machine is not possible.
aleitner
Techie
 
Posts: 49
Joined: Fri Jun 16, 2023 12:05 pm


Return to Support Forum

Who is online

Users browsing this forum: Google [Bot] and 190 guests