GithubHelp home page GithubHelp logo

cefsharpdockerfiles's Introduction

CefSharp Dockerfiles

Summary

Automated chrome cef building and/or cefsharp building dockerfiles and scripts.

While the processes of building CEF and CEFSHARP are not hard they require a very exacting environment and build steps can take a long time so are annoying to repeat. The goal if this repo is a collection of scripts to automate everything to make it easy for anyone to do. We are using Docker to run everything in a container as it makes it much easier to reproduce and won't pollute your dev environment with all the pre-reqs. You can easily tweak the exact versions you want to build, and the build flags. From creating a VM on your cloud provider of choice (or your own machine) it is about 20 minutes of setup, starting a build script, and just waiting a few hours for it to spit out the compiled binaries. It has been tested with chrome 63->100 but would likely work for any modern chrome build without changes (in most cases).

Thanks

Thanks to the fantastic CEFSharp team, especially @amaitland who works insanely hard on the open source project. @perlun provided some great direction on the Windows building and was also a huge help. Please support CEFSharp if you use it, even if you do a small monthly donation of $10 or $25 it can be a big help: https://github.com/sponsors/amaitland (primary CEFSharp developer, and full time parent).

Quick Start

If you are building in process isolation mode (recommended) make sure the base image file is the same build as your actual OS (or the VM's os). IE if you are on windows Fall 2018 release 1803 (10.0.17134) change VAR_BASE_DOCKER_FILE to the 1803 image. Run ./build.ps1 and it should build the packages. Warning: The Windows 10 Client May 2021/Nov 2021 DOES NOT support the more performant process isolation mode. See HyperV Isolation (for server or Windows 10 client) Mode below for details.

For a super fast start look at the azure auto provision option below. As long as you have an azure account created it can create the entire setup and build in a few commands. If using Azure create a F32_v2 VM with the image "Datacenter Core 1903 with Containers", if using another machine just install docker for windows (make sure you have 20GB (40GB for chrome < 65) of ram between actual ram + page file). Set the Docker For Windows Config File changing the path to the folder to store data on (suggested local temp drive) and restart docker service. Copy the items from this repo into a folder. Copy the versions_src.ps1 to versions.ps1 and change the variables to what you want: for example $VAR_GN_DEFINES="is_official_build=true proprietary_codecs=true ffmpeg_branding=Chrome";$VAR_DUAL_BUILD="1";. Only use DUAL_BUILD if you have 30 gigs of ram or more, otherwise leave it at 0 and the build will take an extra 20-40 minutes.

Caveats

Beware if using the exact same version string as an official CEF Build as it will mean you need to make sure your nuget source is always used before the master source. If you use a slightly different minor build you will not have that problem. For CefSharp you can use a manual higher fake minor version number(ie .99) to not get confused with the official builds (but the CEF build note above still applies).

In part we use the latest version of several installers/build tools if they changed so might the success of these dockerfiles. It does not build the debug versions of CEF or CEFSharp. This could be added as an option pretty easily (but would probably at-least double build times). For some reason I had issues getting the automated build script for CEF to work doing the calls by hand is pretty basic however.

Window 10 Client (Pro) by default with docker uses HyperV isolation, this mode is very non performant vs process isolation mode. Make sure to change it (and see the note below, but beware does not work on 21H1/21H2 builds).

Requirements

The following requirements are for chrome and the current vs_2019 installer, they may change over time. Compiling is largely CPU bound but linking is largely IO bound.

  • At least 20GB of ram dedicated to this would recommend 30GB total with page file to make sure you don't run out (older builds like 63 were 32GB with 40GB total). You can have any amount of that 20/30GB as a page file, just beware the less actual ram the much slower linking will be.
  • At least 250GB of space.

New Volume Mode

Due to a bug in 1903 (microsoft/hcsshim#708) a new method had to be found rather than building all the cef source in a normal docker build step. The solution was to move the source building to store data in a volume. This has several benefits now including: builds can be resumed (if you force the same volume to be used), source code can be left behind on the volume as docker will not manually copy this with the storage driver (previously very non-performant). Downsides include the fact it will leave volumes behind that need to be removed from unsuccessful builds, there is a bit of a hacked step to support volumes. To support volumes we have to use docker run for the cef build step (as docker build does not support volumes during build). This means we needed a way to detect IF we need to run the build step or if it was already completed successfully. To do this we rely on some tag naming tests (see build script).

Server Setup

There is not much in terms of a software requirements other than docker. You can run it on Windows Server or Windows 10 Client. For Windows 10 Client Install it from https://store.docker.com/editions/community/docker-ce-desktop-windows. For server Docker EE from: https://docs.docker.com/install/windows/docker-ee/#docker-universal-control-plane-and-windows (or standard docker for windows for desktops) if docker is not auto installed. If installing on Windows 10 Client make sure to see the Hyper V Notes below.

Docker For Windows Config File

You will want a docker configuration with options similar to this. On windows client you can use the docker settings (Right-click on the Docker whale icon in the on the task bar, then click "Settings..." then click to advanced mode). For server the file is edited directly (or created if it didn't exist) at C:\ProgramData\docker\config\daemon.json

{
  "registry-mirrors": [],
  "insecure-registries": [],
  "debug": true,
  "experimental": false,
  "exec-opts": [
    "isolation=process"
  ],
  "data-root": "d:/docker_data",
  "storage-opts": [
    "size=400G"
  ]
}

Azure Specifics

If you are new to Azure it is pretty easy to get started and they will give you $200 for your first month free so there will be no costs. Below we even have an auto deploy script if you prefer not to do it by hand. An Azure F32 v2 is pretty good, its only 256 gigs of space but that should be ok. ~$2.72 an hour in WestUS2 running the latest windows image. You can use the prebuilt image "Windows Server 2016 Datacenter - with Containers" or a newer one if it exists. You can either use one with a full shell (pre 1709) or one of the newer builds like "Windows Server 2016 Datacenter - with Containers 1803". Without a full shell you won't have explorer and remote desktop will just open a command prompt. You can launch notepad and manage it all through there (or use remote PS) but a full shell is easier for some people. Use the local SSD as the docker storage folder (note this will likely get wiped if you de-allocate the machine so do the entire build at once). You could potentially hook up a huge number of disks in raid 0 configuration to get somewhat decent speed that way. Create a new resource, search for the prebuilt image noted above. You do not need managed disks, assign a random user/password, new network/storage/etc is all fine. For the size make sure you select one of the F series (F32 recommended). It won't show by default, leave HD type set to SSD put Min CPU's at 32 and Ram at 64 then hit "View all".

I suggest auto-shutdown to make sure you don't leave it running.

Azure Auto Create Scripts

If you have an azure account already created you can use the az_create.ps1 script to automatically setup the VM for you. It will create a Standard_F32s_v2 VM by default but this is 32 cpu's. New Azure accounts need to file a support request to increase CPU quota beyond 10. These are often approved within minutes but if you don't want to do so you can edit az_create.ps1 and change the size to something like a Standard_F8s_v2. It will take longer to build but your cost will be roughly the same total cost.

It will create everything under a new "CEFTest" resource group to make cleanup at the end easy. You can adjust the settings at the top if desired but really the only important options you pass as options to it. It will setup the VM and enable remote powershell to make the process very easy. Just launch powershell (or type powershell into the run box in windows). If the first time using powershell with azure you will need to install the tools for azure: Install-Module -Name AzureRM -Scope CurrentUser. Next change to the folder with all the CefSharpDockerfiles (cd c:\downloads\CefSharpDockerfiles for example).

Login with your azure credentials first: Connect-AzureRmAccount

Then if you have multiple subscriptions set the one you want with: Set-AzureRmContext -SubscriptionName "My Subscription"

Next run this and enter a new username and password to configure the new VM with: $cred = Get-Credential -Message "Enter user and password for remote machine admin"

Next we will run the deploy script, by default it can configure the machine to automatically shutdown at 11:30pm PDT if you provide an email it will do this and notify you. If you do not you need to manually turn the machine off when done. You can adjust time and such in the az_create.ps1 at the top (along with some other items but likely you do not need to adjust them): ./az_create.ps1 -admin_creds $cred -shutdown_email "[email protected]"

It should print out when done Public IP: 123.123.123.123

Next set this in a variable $IP_ADDY like: $IP_ADDY = "123.123.123.123"

Note we are disabling the security checks in the remote powershell session. This could make you vulnerable to MITM attacks if on an unsafe network.

Next create the remote powershell session and copy the files over, and disable anti virus real time scanning (slows down compiling significantly):

$so = New-PsSessionOption -SkipCACheck -SkipCNCheck -SkipRevocationCheck;
$remote = New-PSSession -ComputerName $IP_ADDY -UseSSL -SessionOption $so -Credential $cred;

Get-ChildItem -Path "./" | Copy-Item -ToSession $remote -Destination "C:/CefSharpDockerfiles/"
Copy-Item -ToSession $remote daemon.json -Destination "c:/ProgramData/docker/config/daemon.json";
Invoke-Command -Session $remote -ScriptBlock { Restart-Service Docker;Set-MpPreference -DisableRealtimeMonitoring $true; }

Next we will "enter" the remote machine via powershell:

Enter-PSSession $remote

Then you should see your terminal is like [123.123.123.123]: PS c:\> showing you are on the remote machine.

Finally we start the build:

cd C:/CefSharpDockerfiles
./build.ps1

When done exit out the remote session by typing: exit

Finally we copy the resulting files locally: Copy-Item -FromSession $remote "c:/CefSharpDockerfiles/packages_cefsharp.zip" -Destination ".";

You could also expose the docker server to the internet and use remote docker commands rather than running the powershell remotely. When done you can delete the entire CEFTest resource group from the azure portal as well to clean everything up.

Estimated time requirements

With the Azure F32 v2 host above the total estimated build time is about 2-3 hours depending on CEF version (~$6 on azure). Machines are nice 600MB/sec read/write to the local disk. There are larger VM's as well up to 72+ CPU's however some of the build stages are very linear. Note it can vary somewhat dramatically for the not cef build steps based on the luck of the draw (but the cef build is most of the build time). It seems local IO depending on what physical host it is spun up on can cause 30-50% performance fluxes. Most of the build steps make efficient use of the machine however: The git cloning is not very efficient. It is 30 minutes of the cef build time below. It doesn't quite max out network or IO. The linking stage is also not super efficient see the DUAL_BUILD flag below to help with that. Linking will take 20+ minutes per platform (40 total unless run concurrently). Here are the individual build/commit times:

  • pull source image: 3 minutes
  • vs: 8 minutes
  • cef: 1.8->3.2 hours (with DUAL_BUILD)
  • cef-binary: 3 minutes
  • cefsharp: 4 minutes

HyperV Isolation (for server or Windows 10 client) Mode

HyperV isolation mode should be avoided if possible. It is slower, and more prone to fail. For Windows 10 clients below 1809 (October 2018 edition) there is not a legal alternative. You must also use Docker Desktop build newer than October of 2018. NOTE: If you are not using process isolation mode you WILL need to set $VAR_HYPERV_MEMORY_ADD and make sure your page file is properly sized (recommend a page file at least a few gigs bigger as it needs that amount of FREE page file space). It will set the memory on every docker build step to up the default memory limit. Technically this is primarily needed in the CEF build step. NOTE if you stop docker during a build with HyperV it does not properly kill off the hyperV container restart docker to fix this. Warning: The Windows 10 May 2021/Nov 2021 (21H1/21H2 10.0.19043/10.0.19044) DOES NOT support process isolation mode. This is due to an MS failure per micorosft/windows-containers#163. If you want isolation support you must use builds 20H2 (10.0.19042) or lower OR Windows 11. Note Hyper-V isolation can be over 3 times as slow as process isolation mode for Windows 10 clients.

Build Process

Once docker is setup and running copy this repo to a local folder. Copy versions_src.ps1 to versions.ps1 and change the version strings to match what you want. NOTE BASE_DOCKER_FILE must match the same kernel as the host machine IF you are using process isolation mode. This means you cannot use the 1709 image on an older host and you can use and older image on a 1709 host. Either base file is fine however to use just match it to the host.

Next run build.ps1 and if you are lucky you will end up with a cefsharp_packages.zip file with all the nupkg files you need:) Beware that as docker might be flaky(especially in hyperV mode) you may need to call build.ps1 a few times. It should largely just resume. Once it is done building you will have the cefsharp_packages.zip file. If you want any of the CEF binaries, or symbol files, you can copy them from the CEF image like: docker cp cef:c:/code/binaries/*.zip .

To be safer you can run the biggest build command by hand. The hardest (longest) build step if the CEF build at the start. You can comment out the last step in the dockerfile and manually do that step and commit it. Infact you can just docker run the build image from before than manually call cef_build.ps1 one or more times (it should do a decent job at auto-resuming) until success. If you are using a proper host with enough ram it should be able to automatically build 9 times out of 10 (if not higher) with its current redundant tries. Of course if you prefer to manually run the commands from it you can do that too. To do so comment out the final build step in Dockerfile_cef then run the following:

    #So if the autmate-git.py doesn't work (if something errors out it doesn't always stop at the right point) try running the build steps manually that are there.
    # From the c:/code/chromium_git/chromium/src folder run the build hooks to download tools: gclient runhooks
    # From the c:/code/chromium_git/chromium/src/cef folder run the following to make the projects: ./cef_create_projects.bat
    # From the c:/code/chromium_git/chromium/src
    # ninja -C out/Release_GN_x64 cefclient
    # ninja -C out/Release_GN_x86 cefclient
    # cd C:/code/chromium_git/chromium/src/cef/tools/
    # C:/code/chromium_git/chromium/src/cef/tools/make_distrib.bat --ninja-build --allow-partial;
    # c:/code/chromium_git/chromium/src/cef/tools/make_distrib.bat --ninja-build --allow-partial --x64-build;
    # Allow partial needed if not building debug builds, make sure to run it when done or run the cef_build last few commands to create the archive with the result and to clean up the workspace of the source files.

Dual Build Flag

Note the DUAL_BUILD may speed up builds by running x86 and x64 builds concurrently (each with 1/2 as many threads). This is primarily useful during linking. Linking is largely single threaded and takes awhile and is single thread CPU bound (given enough IO). The main issue is memory usage. If both linking steps run at once you may need nearly 30GB of memory at once (in worst case older builds would use up to 50GB). It would be better if they linked at slightly separate times but as every compute system was different there did not seem to be a good way to determine how long to sleep for to make it most efficient.

Docker for Windows Caveats

  • Most of these issues become an issue on the longer docker runs and disk speed. On an Azure VM it rarely fails out. There has been some redundancy added to build scripts to address these issues.
  • It is slow and Docker for windows can be flaky (especially in HyperV mode). Keep in mind this is running latest 16299 w/ 32 gigs of ram. Sometimes it will miss a step that should be cached and redo it. It seems less flaky running docker in process isolation mode (--isolation=process) instead of hyper-v mode. This is a legal compile time limitation however that windows clients cannot use this mode. Granted building your own docker windows binary is also not that hard. If using hyperv mode please see the server setup for HyperV notes.
  • Make sure to disable file indexing on the drive used for docker data and DISABLE any anti-virus / windows defender it will hugely slow you down. The build script will try to notify you if it notices defender is doing real time monitoring. If you are using a dedicated build drive (in azure or locally) disabling indexing is recommended: To disable file indexing right click on the drive and uncheck allow indexing. If you leave indexing on it may slow building down but should not break anything.
  • Space is massively hogged and it is super slow with large numbers of small files and large files are rewritten 3 extra times when a container is committed. To avoid this we will remove repos/etc used during a build step before it finishes to speed things up.
  • windowsfilter behind the scenes is exceptionally non performant. This primarily comes into play after a build step is finished and it needs to create the diff for the result. First you work in the vhd file, so all changes made while it is building or you are running it happen in the VHD. Second after commit / build step finishes the container will exit. Docker will not return until it fully commits this build step (but the container will NOT show running). Docker starts the diff with the VHD and copies all the files for that layer to docker_data\tmp\random_id. Oddly it actually seems to create one random tmp random id folders with duplicate data from the VM, then it reads each file in this tmp folder writing it to another docker-data\tmp\random_id\ folder. It slowly deletes from one of them once it finishes writing the second. Then it makes another copy to the docker_data\windowsfilter\final_id permanent folder then removes the temp folder and the original VHD. I am not sure why all the copying. This can take A LONG time (hours on a 7200 rpm drive), the only way to know if this is going on is watch your storage. If docker is writing then its doing it. Use procmon.exe if it is reading from a VHD writing to a tmp folder then its step 1. If it is reading from one tmp folder and writing to another tmp folder that is step 2. If it is reading from a tmp folder and writing to a windowsfilter sub folder then it is on the final step 3.
  • Sometimes docker may start to mis-behave often restarting docker may fix the problem. Sometimes a full reboot is needed.

How requirements were determined

  • Space: windows base ~6 gigs, ~9 gigs for the finished visual studio build image. Another 20 or so when done with cefsharp. Chrome will take 200 gigs or so during build for the VHD, we remove the bulk of this before it finishes though. So for docker storage I would recommend 16 + 200 = ~ 220 gigs of space + some buffer so maybe 250GB.
  • Memory: For Chrome 63 bare minimum memory requirements (actual + page file) for JUST the linker is x86: 24.2 GB x64: 25.7 GB. For chrome 67 however the memory requirements are much lower, only 13GB for linking! I would make sure you have at least 24 gigs of ram to be safe with OS and other overhead, for older versions at least 32GB.

Patching CEF / CEFSharp

  • If so desired you can patch CEF or CEFSharp relatively easily. Place a file named cef_patch_XXXX.diff or cefsharp_patch_XXXX.diff to the build folder. You can change XXX to whatever you want, and even have multiple if desired. It will automatically be applied with git apply. This works for several different patch formats (anything git apply will take will work).

Building only CEF or CEFSharp

  • You can build just CEF and not cefsharp by setting $VAR_CEF_BUILD_ONLY to $true in the versions.ps1.
  • If you want to only build CEFSharp you will need to provide the CEF binaries (either you built or official ones from: http://opensource.spotify.com/cefbuilds/index.html). You should download both 32 bit and 64 bit standard distribution versions and put them in a local folder. Then edit versions.ps1 and set $VAR_CEF_USE_BINARY_PATH to the local folders. You should then set $VAR_CEF_BINARY_EXT to the extension of them (ie zip or tar.bz2 for example).

Sample of building only CEFSharp

General Warnings for build flags:

  • Cannot do component builds as it will not work for other items
  • Remove_webcore_debug_symbols seemed to also cause issues
  • DON'T USE is_win_fastlink as it is only for debug builds not for release
  • YOU MUST DO A --quiet VS install for headless, otherwise it will just hang forever.
  • use_jumbo_build see http://magpcss.org/ceforum/viewtopic.php?p=37293 about enabling this if you are doing proprietary_codecs as well, note this does not seem to actually cause a problem however in the builds we tested.

Additional Resources

The following were helpful:

cefsharpdockerfiles's People

Contributors

alfred-reynolds avatar mitchcapper avatar perlun avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

cefsharpdockerfiles's Issues

Build failed "Not able to find win32 file as expected"

Hi there,
I successfully build cefsharp 67 without any issue with these settings :
$VAR_CHROME_BRANCH="3396";
$VAR_CEFSHARP_VERSION="67.0.90";
$VAR_CEFSHARP_BRANCH="cefsharp/67";
$VAR_BASE_DOCKER_FILE="mcr.microsoft.com/dotnet/framework/runtime:4.7.2-windowsservercore-ltsc2016";
$VAR_DUAL_BUILD="0";
$VAR_GN_DEFINES="is_official_build=true proprietary_codecs=true ffmpeg_branding=Chrome";
$VAR_GYP_DEFINES="";
$VAR_CEF_BUILD_ONLY=$false;
$VAR_CEF_USE_BINARY_PATH="";
$VAR_CEF_BINARY_EXT="zip";
$VAR_CEF_SAVE_SOURCES="0";
$VAR_CEF_VERSION_STR="auto";
$VAR_HYPERV_MEMORY_ADD="--memory=30g";

Now I try to build v 73 but it fails almost at the end :
Creating zip archive for cef_binary_73.1.13+g6e3c989+chromium-73.0.3683.75_windows64...
Creating zip archive for cef_binary_73.1.13+g6e3c989+chromium-73.0.3683.75_windows64_release_symbols...
Not able to find win32 file as expected
At C:\code\cef_build.ps1:87 char:2

  • throw "Not able to find win32 file as expected";
    
  • ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : OperationStopped: (Not able to find win32 file a
      s expected:String) [], RuntimeException
    • FullyQualifiedErrorId : Not able to find win32 file as expected

The command 'powershell -Command $ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue'; c:/code/cef_bu
ild.ps1' returned a non-zero code: 1
Caught an exception: Process docker build --memory=30g --build-arg CEF_SAVE_SOURCES="0" --build-arg BINARY_EXT="zip" --bui
ld-arg DUAL_BUILD="0" --build-arg GN_DEFINES="is_official_build=true proprietary_codecs=true ffmpeg_branding=Chrome" --bui
ld-arg GYP_DEFINES="" --build-arg CHROME_BRANCH="3683" -f Dockerfile_cef -t cef . exited with non zero code: 1 aborting!
Exception Type: System.Management.Automation.RuntimeException
Stack Trace: at RunProc, D:\CefSharpDockerfiles-master\functions.ps1: line 82
at , D:\CefSharpDockerfiles-master\build.ps1: line 71
at , : line 1

Here is my versions.ps1 :
$VAR_CHROME_BRANCH="3683";
$VAR_CEFSHARP_VERSION="73.1.130";
$VAR_CEFSHARP_BRANCH="cefsharp/73";

$VAR_BASE_DOCKER_FILE="mcr.microsoft.com/dotnet/framework/runtime:4.7.2-windowsservercore-ltsc2016";
$VAR_DUAL_BUILD="0";
$VAR_GN_DEFINES="is_official_build=true proprietary_codecs=true ffmpeg_branding=Chrome";
$VAR_GYP_DEFINES="";
$VAR_CEF_BUILD_ONLY=$false;
$VAR_CEF_USE_BINARY_PATH="";
$VAR_CEF_BINARY_EXT="zip";
$VAR_CEF_SAVE_SOURCES="0";
$VAR_CEF_VERSION_STR="auto";
$VAR_HYPERV_MEMORY_ADD="--memory=30g";

Error compressing CEF build in VAR_CEF_BUILD_ONLY mode

When running the build in CEF only mode using process isolation mode locally I get an error:
Unable to find image 'powershell:latest' locally
when running this step in build.ps1
RunProc -proc "docker" -redirect_output:$redirect_output -opts "run --name cef powershell Compress-Archive -Path C:/code/binaries/*.zip -CompressionLevel Fastest -DestinationPath /packages_cef"
I'm a docker for windows newbie but I think there is a missing "cef" here in the run command, so it can reference the cef container that was just created. It should be
RunProc -proc "docker" -redirect_output:$redirect_output -opts "run --name cef cef powershell Compress-Archive -Path C:/code/binaries/*.zip -CompressionLevel Fastest -DestinationPath /packages_cef"
I'll attach a PR to this bug shortly with the suggested change.

In branch 3370+codecs need to install pywin32

First, your repo is awesome and helped me build cef with codecs successfully.

Problem

When trying to build with the following changes in versions.ps1:

$VAR_CHROME_BRANCH="3770"; 
$VAR_CEFSHARP_VERSION="75.1.143"; 
$VAR_CEFSHARP_BRANCH="cefsharp/75";
$VAR_GN_DEFINES="is_official_build=true proprietary_codecs=true ffmpeg_branding=Chrome";
$VAR_GYP_DEFINES="target_arch=x64";

The build failed with this error:
python ImportError: No module named win32file

Possible solution

my solution was to add

RunProc -proc "c:/code/depot_tools/python.bat" -opts "-m pip install pywin32";

before the following line:
cef_build.ps1#L27.

After this, the cef build worked. Hope this will help and Thank you again!

Build fails immediately due to git changes

Hey there!

I tried running build.ps1 and it instantly failed after setting up the container with an error about uncommitted git changes in the tools repo.

I can't get a log atm since I'm out and busy but I'll try to grab it later.

Building locally on windows 11.

Thanks,
Jammerxd

Error while building latest versions

I've succesfully built version 63 of CefSharp 6 months ago, but I can't get it to work with any recent versions (tried 67, 69 and now 71). I've seen all kinds of errors on different VMs (Windows server 1709, 1803, 1809 and Windows 10 with HyperV) on AWS as well as Azure.

This is the most common error after ~2 hours in both win10 and server 2016: https://pastebin.com/Vbk5fC2k
versions.ps1: https://pastebin.com/CCh9AP5p (I've seen it called versions.ps1, version.ps1 and version_src.ps1, so they all exist and are the same)
docker config of my latest win10 build: https://pastebin.com/qZ5UQQvv

Windows Defender and UAC are disabled. I don't think there were any errors until after applying patches to cef(?).

Caught an exception: Process docker run --memory=30g -v cefbuild_lcwgb:C:/code/chromium_git --name c_cefbuild_lcwgb_tmp cef_build_env exited with non zero code: 1 aborting!

Hello all. My first attempt to do the Docker build method and the build process seemed to be going smooth for a while so I stepped away. Upon return to check status I got the below error. Not sure what it means or is related to. I'm hoping for some guidance.

My goal is to build CefSharp for WinForms with the proprietary_codecs=true option set so the browser can goto YouTube and be able to play videos there.

Traceback (most recent call last):
  File "../../build/toolchain/win/tool_wrapper.py", line 31, in <module>
    import win32file    # pylint: disable=import-error
ImportError: No module named win32file
[30/34435] CXX obj/third_party/protobuf/protobuf_full/error_listener.obj
[31/34435] CXX obj/third_party/protobuf/protobuf_full/zero_copy_stream_impl.obj
[32/34435] CXX obj/third_party/protobuf/protobuf_full/coded_stream.obj
[33/34435] CXX obj/third_party/protobuf/protobuf_full/io_win32.obj
[34/34435] CXX obj/third_party/protobuf/protobuf_full/text_format.obj
ninja: build stopped: subcommand failed.
x64 build failed with 1
At C:\code\cef_build.ps1:101 char:2
+     throw "x64 build failed with $($px64.ExitCode)";
+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : OperationStopped: (x64 build failed with 1:Strin
   g) [], RuntimeException
    + FullyQualifiedErrorId : x64 build failed with 1

Caught an exception: Process docker run --memory=30g -v cefbuild_lcwgb:C:/code/chromium_git --name c_cefbuild_lcwgb_tmp cef_build_env exited with non zero code: 1 aborting!
        Exception Type: System.Management.Automation.RuntimeException
        Stack Trace: at RunProc, C:\CefSharpDockerfiles\functions.ps1: line 82
        at <ScriptBlock>, C:\CefSharpDockerfiles\build.ps1: line 85
        at <ScriptBlock>, <No file>: line 1

My version.ps1 used

$VAR_CHROME_BRANCH="3770";
$VAR_CEFSHARP_VERSION="79.1.360";
$VAR_CEFSHARP_BRANCH="cefsharp/79";
$VAR_BASE_DOCKER_FILE="mcr.microsoft.com/windows/servercore:1903-amd64";#mcr.microsoft.com/windows/servercore:1809-amd64
$VAR_DUAL_BUILD="0"; #set to 1 to build x86 and x64 together, mainly to speed up linking which is single threaded, note may need excess ram.
$VAR_GN_DEFINES="is_official_build=true proprietary_codecs=true ffmpeg_branding=Chrome";$VAR_DUAL_BUILD="0";
$VAR_CEF_BUILD_MOUNT_VOL_NAME=""; #force using this volume for building, allows resuming MUST BE LOWER CASE
$VAR_GN_ARGUMENTS="--ide=vs2019 --sln=cef --filters=//cef/*";
$VAR_GYP_DEFINES="";
$VAR_CEF_BUILD_ONLY=$false;#Only build CEF do not build cefsharp or the cef-binary.
$VAR_CEF_USE_BINARY_PATH=""; #If you want to use existing CEF binaries point this to a local folder where the cef_binary*.zip files are. It will skip the long CEF build step then but still must make the VS container for the cefsharp building.  Note will copy a dockerfile into this folder.
$VAR_REMOVE_VOLUME_ON_SUCCESSFUL_BUILD=$true;
$VAR_CEF_BINARY_EXT="zip"; #Can be zip,tar.bz2, 7z Generally do not change this off of Zip unless you are supplying your own binaries using $VAR_CEF_USE_BINARY_PATH above, and they have a different extension, will try to work with the other formats however
$VAR_CEF_SAVE_SOURCES="0"; #normally sources are deleted before finishing the CEF build step.  Set to 1 to create a /code/sources.zip archive that has them (note it is left in docker image, must use docker cp to copy it out, it is also around 30GB).
$VAR_CEF_VERSION_STR="auto"; #can set to "3.3239.1723" or similar if you have multiple binaries that Docker_cefsharp might find
$VAR_HYPERV_MEMORY_ADD="--memory=30g"; #only matters if using HyperV, Note your swap file alone must be this big or able to grow to be this big, 30G is fairly safe for single build will need 60G for dual build.
if ($false){ #Sample 65 overrides
	$VAR_CHROME_BRANCH="3770";
	$VAR_CEFSHARP_VERSION="79.1.360";
	$VAR_CEFSHARP_BRANCH="master";
}

Thank you!

Windows 11

Which base docker image can be used with process isolation and windows 11? Currently that is what I am running.

Compiling CefSharp failed with Spotify automated builds

First of all, cudos for a great idea: I went through compiling CEF Source manually the last week, and it took me a long time to get the environment and the GN Defines right. Mainly setting up VS 2017 with the right SDK and Toolchain took a long time.

Today I tried to compile CefSharp v67.0.0 against precompiled standard builds of CEF 3.3396 and run into an error:
Error report:

Running: docker build --memory=30g -f Dockerfile_cef_create_from_binaries -t cef . in G:\CEFBinaries
10/29/2018 21:42:39 CEF Build took 1.6 secs
Running: docker build --memory=30g --build-arg BINARY_EXT="zip" -f Dockerfile_cef_binary -t cef_binary . in G:\CefSharpDockerfiles
Process docker build --memory=30g --build-arg BINARY_EXT="zip" -f Dockerfile_cef_binary -t cef_binary . exited with non zero code: 1 aborting!
At G:\CefSharpDockerfiles\functions.ps1:40 char:9
+         throw "Process $proc $opts exited with non zero code: $($p.Ex ...
+         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : OperationStopped: (Process docker ...de: 1 aborting!:String) [], RuntimeException
    + FullyQualifiedErrorId : Process docker build --memory=30g --build-arg BINARY_EXT="zip" -f Dockerfile_cef_binary -t cef_binary . exited with non zero code: 1 abort 
   ing!

Versions.ps1:

$VAR_CHROME_BRANCH="3396";
$VAR_CEFSHARP_VERSION="67.0.90";
$VAR_CEFSHARP_BRANCH="cefsharp/67";
$VAR_BASE_DOCKER_FILE="microsoft/dotnet-framework:4.7.2-runtime-windowsservercore-1803"; #microsoft/dotnet-framework:4.7.1-windowsservercore-1709
$VAR_DUAL_BUILD="0"; #set to 1 to build x86 and x64 together, mainly to speed up linking which is single threaded, note may need excess ram.
$VAR_GN_DEFINES="";
$VAR_GYP_DEFINES="";
$VAR_CEF_BUILD_ONLY=$false;#Only build CEF do not build cefsharp or the cef-binary.
$VAR_CEF_USE_BINARY_PATH=".\..\CEFBinaries\"; #If you want to use existing CEF binaries point this to a local folder where the cef_binary*.zip files are. It will skip the long CEF build step then but still must make the VS container for the cefsharp building.  Note will copy a dockerfile into this folder.
$VAR_CEF_BINARY_EXT="zip"; #Do not change this off of Zip unless you are supplying your own binaries using $VAR_CEF_USE_BINARY_PATH above, and they have a different extension
$VAR_CEF_VERSION_STR="auto"; #can set to "3.3239.1723" or similar if you have multiple binaries that Docker_cefsharp might find
$VAR_HYPERV_MEMORY_ADD="--memory=30g"; #only matters if using HyperV, Note your swap file alone must be this big or able to grow to be this big, 30G is fairly safe for single build will need 60G for dual build.
if ($false){ #Sample 65 overrides
	$VAR_CHROME_BRANCH="3325";
	$VAR_CEFSHARP_VERSION="65.0.90";
	$VAR_CEFSHARP_BRANCH="master";

Docker settings:

{
  "registry-mirrors": [],
  "insecure-registries": [],
  "debug": true,
  "experimental": false,
  "data-root": "g:/docker",
  "storage-opts": [
    "size=250G"
  ]
}

Spotify standard build CEF Binaries in the G:\CEFBinaries folder :

cef_binary_3.3396.1785.ga27bbfa_windows64.zip
cef_binary_3.3396.1786.gd3e36d0_windows32.zip

I'd be grateful for suggestions what went wrong
Pete

hcsshim::ImportLayer - failed failed in Win32: The system cannot find the path specified. (0x3)

First of all, thank you for your effort.
I can see that amazing work has been done here.
Unfortunately, I'm not lucky to successfully build any version neither in Win 10 pro nor via Azure service.
I'm totally new to docker though.
Below I tried to follow the Azure auto deployment scripts as described to build CefSharp with h264 support.

How to reproduce:

  • Just follow the #Azure Auto Create Scripts
  • I had to run build.ps1 with -NoVS2019PatchCopy flag as sample_patches\cef_patch_find_vs2019_tools.diff is not found in the repo
  • Attached powershell console output is trying to compile CEF 81 version
  • I've attached all the files that I have modified in order to run:
  1. versions.ps1 changed rows:
$VAR_CHROME_BRANCH="4044";
$VAR_CEFSHARP_VERSION="81.0.90";
$VAR_CEFSHARP_BRANCH="cefsharp/81";
$VAR_BASE_DOCKER_FILE="mcr.microsoft.com/windows/servercore:1903-amd64";
  1. daemon.json changed rows:
    "data-root": "C:/docker_data"

  2. az_create.ps1
    changed rows:
    [String] $MACHINE_SIZE="Standard_F8s_v2",

Error:
hcsshim::ImportLayer - failed failed in Win32: The system cannot find the path specified. (0x3)
see PowerShellConsoleOutput

Include "proprietary" audio codec flags

Include the audio codec flags so that the build will include the "proprietary" audio codecs - or at least make it an easy set option.

Additionally - who is the contact to get it licensed and how do we convince them to stop being stingy about it given how universal these codecs are in this current millenia?

error: pathspec 'origin/3370' did not match any file(s) known to git

Thank you for sharing amazing build scripts!

It seems that 3370 branch is not found in Chromium repo for some reasons.

PS C:\build-cefsharp>> .\build.ps1
Warning when running this build command in a remote powershell session you will not see realtime output generated by commands run.  This is due to a limitation in remote powershell.  You can work around this by running the build.ps1 using remote desktop instead.  In general it is only helpful to see the output if there is an error.  The stdout and stderr will be captured and printed for remote sessions but only after a command finishes.

Confirm
Warning linking may take around 27 during linking.  Your machine may not have enough memory, make sure your page files
are working and can grow to allow it. (Disable this warning with -NoMemoryWarn flag). Do you want to proceed?
[Y] Yes  [N] No  [S] Suspend  [?] Help (default is "Y"):
11/25/2019 00:54:02 Starting took 2.6 secs
Running: docker pull mcr.microsoft.com/windows/servercore:1809-amd64 in C:\build-cefsharp
1809-amd64: Pulling from windows/servercore
Digest: sha256:64385c3c59e4c85862306505d486467d2e150174f21be373d5aab4c616a1dc72
Status: Image is up to date for mcr.microsoft.com/windows/servercore:1809-amd64
mcr.microsoft.com/windows/servercore:1809-amd64
11/25/2019 00:54:03 Pull base file took 0.4 secs
Running: docker build --memory=30g --build-arg BASE_DOCKER_FILE="mcr.microsoft.com/windows/servercore:1809-amd64" -f Dockerfile_vs -t vs . in C:\build-cefsharp
Sending build context to Docker daemon  112.6kB
Step 1/14 : FROM mcr.microsoft.com/windows/servercore:1809-amd64
 ---> 733821d00bd5
Step 2/14 : SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]
 ---> Running in 9b4f1e1bfe0d
Removing intermediate container 9b4f1e1bfe0d
Step 3/14 : RUN mkdir c:\code\automate;mkdir c:\temp\;mkdir c:\code\depot_tools;
 ---> cf34ff90bc40
 ---> Running in f9a3fa441ac7
    Directory: C:\code
Mode                LastWriteTime         Length Name
----                -------------         ------ ----
d-----       11/25/2019  12:54 AM                automate
    Directory: C:\
Mode                LastWriteTime         Length Name
----                -------------         ------ ----
d-----       11/25/2019  12:54 AM                temp
    Directory: C:\code
Mode                LastWriteTime         Length Name
----                -------------         ------ ----
d-----       11/25/2019  12:54 AM                depot_tools
Removing intermediate container f9a3fa441ac7
 ---> 2e9ff028d856
Step 4/14 : RUN Invoke-WebRequest 'https://aka.ms/vscollect.exe' -OutFile 'C:\TEMP\collect.exe';
 ---> Running in b3955bdeaafc
Removing intermediate container b3955bdeaafc
Step 5/14 : RUN Invoke-WebRequest 'https://dist.nuget.org/win-x86-commandline/v4.1.0/nuget.exe' -OutFile 'c:\code\depot_tools\;';
 ---> fde527a8c809
 ---> Running in f438273d5d4c
Removing intermediate container f438273d5d4c
 ---> cf4f80481d85
Step 6/14 : RUN Invoke-WebRequest 'https://www.7-zip.org/a/7z1801-x64.msi' -OutFile '/code/7zip.msi';
 ---> Running in 1dc4b4f81415
Removing intermediate container 1dc4b4f81415
 ---> c3ad3b125893
Step 7/14 : RUN Start-Process msiexec.exe -Wait -ArgumentList '/i c:\code\7zip.msi /quiet /norestart /L*v install.log'
 ---> Running in d68335f4522e
Removing intermediate container d68335f4522e
 ---> 4d03751f4969
Step 8/14 : WORKDIR "Program Files"
 ---> Running in f4ab8ad270b4
Removing intermediate container f4ab8ad270b4
 ---> 3ca3727297d3
Step 9/14 : RUN Remove-Item -Recurse -Force '.\WindowsPowerShell\Modules\PSReadLine'
 ---> Running in fc5d016f340f
Removing intermediate container fc5d016f340f
 ---> 970c834054f4
Step 10/14 : WORKDIR c:\\code\\depot_tools
 ---> Running in 693d873c9a14
Removing intermediate container 693d873c9a14
Step 11/14 : RUN Invoke-WebRequest https://go.microsoft.com/fwlink/?linkid=864422 -OutFile 'C:\code\winsdksetup.exe';
 ---> 6ba30aa3b619
 ---> Running in 4aea5ee8cdc1
Removing intermediate container 4aea5ee8cdc1
 ---> 31e7a0ddd04d
Step 12/14 : RUN $p = Start-Process -Wait -PassThru -FilePath C:\code\winsdksetup.exe -ArgumentList ' /features OptionId.WindowsDesktopDebuggers /quiet /Log #"%TEMP%\\winsdksetup.log /norestart'; if (($ret = $p.ExitCode) -and ($ret -ne 3010)) { throw ('Install failed with exit code 0x{0:x}' -f $ret) }
 ---> Running in 1a2f0b47f616
Removing intermediate container 1a2f0b47f616
 ---> 870258838507
Step 13/14 : RUN Invoke-WebRequest 'https://aka.ms/vs/15/release/vs_community.exe' -OutFile 'C:\code\vs_community.exe';
 ---> Running in c470434bea09
Removing intermediate container c470434bea09
 ---> 826e4564b6c9
Step 14/14 : RUN $p = Start-Process -Wait -PassThru -FilePath C:\code\vs_community.exe -ArgumentList ' --quiet --wait --norestart --nocache --add Microsoft.Net.Component.4.7.1.SDK --add Microsoft.VisualStudio.Component.Windows10SDK --add Microsoft.Net.Component.4.6.1.SDK --add Microsoft.VisualStudio.ComponentGroup.NativeDesktop.Win81 --add Microsoft.VisualStudio.Component.Windows81SDK --add Microsoft.Net.Component.4.5.2.TargetingPack --add Microsoft.Net.Component.4.6.2.TargetingPack --add Microsoft.Net.Component.4.6.2.SDK --add Microsoft.VisualStudio.Component.Windows10SDK.16299.Desktop --add Microsoft.VisualStudio.Component.Windows10SDK.17134 --add Microsoft.VisualStudio.Component.Git --add Microsoft.VisualStudio.Component.Windows10SDK.15063.Desktop --add Microsoft.VisualStudio.Workload.NativeDesktop --add Microsoft.VisualStudio.Component.VC.ATLMFC --includeRecommended --remove Microsoft.VisualStudio.Component.Windows10SDK.10240 --remove Microsoft.VisualStudio.Component.Windows10SDK.10586 --remove Component.Android.NDK.R12B --remove Component.Android.SDK23.Private --remove Component.MDD.Android --remove Component.Unreal.Android --remove Component.Android.NDK.R15C --remove Component.Android.SDK19 --remove Component.Android.SDK22 --remove Component.Android.SDK23 --remove Component.Android.SDK25 --remove Component.MDD.Android --remove Component.Android.NDK.R12B --remove Component.Android.NDK.R12B_3264 --remove Component.Android.NDK.R13B --remove Component.Android.NDK.R13B_3264 --remove Component.Android.NDK.R15C_3264 --remove Component.Google.Android.Emulator.API23.V2 --remove Component.Android.SDK25 --remove Component.Google.Android.Emulator.API25 --remove Component.Android.SDK23.Private --remove Component.Google.Android.Emulator.API23.Private --remove Component.Android.Emulator --remove Component.Android.NDK.R11C --remove Component.Android.NDK.R11C_3264 --remove Microsoft.VisualStudio.Component.Windows10SDK.14393 --remove Microsoft.VisualStudio.Component.Phone.Emulator.15254 --remove Microsoft.VisualStudio.Component.Phone.Emulator.15254 --remove Microsoft.VisualStudio.Component.Phone.Emulator --remove Microsoft.VisualStudio.Component.Phone.Emulator.15063 --remove Component.Anaconda3.x64 --remove Component.Anaconda2.x64 --remove Component.Anaconda2.x86 --remove Component.Anaconda3.x86 --remove Microsoft.VisualStudio.Component.Unity --remove Component.UnityEngine.x64 --remove Component.UnityEngine.x86 --remove Component.Incredibuild --remove Component.IncredibuildMenu --remove Microsoft.VisualStudio.Component.Sharepoint.Tools --remove Microsoft.VisualStudio.Component.TeamOffice --remove Component.Cocos;'; if (($ret = $p.ExitCode) -and ($ret -ne 3010)) { C:\TEMP\collect.exe; throw ('Install failed with exit code 0x{0:x}' -f $ret) }; Remove-Item -Recurse -Force 'c:\ProgramData\Package Cache\'
 ---> Running in 95b4cc93748d
Removing intermediate container 95b4cc93748d
 ---> af3f761d5fba
[Warning] One or more build-args [BASE_DOCKER_FILE] were not consumed
Successfully built af3f761d5fba
Successfully tagged vs:latest
11/25/2019 02:06:42 VSBuild took 4359.4 secs
Running: docker build --memory=30g --build-arg CEF_SAVE_SOURCES="0" --build-arg BINARY_EXT="zip" --build-arg DUAL_BUILD="0" --build-arg GN_DEFINES="is_official_build=true proprietary_codecs=true ffmpeg_branding=Chrome" --build-arg GYP_DEFINES="" --build-arg CHROME_BRANCH="3370" -f Dockerfile_cef -t cef . in C:\build-cefsharp
Sending build context to Docker daemon  112.6kB
Step 1/19 : FROM vs
 ---> af3f761d5fba
Step 2/19 : RUN $env:Path = 'c:/Program Files/Git/bin/;' + $env:Path;setx /M PATH $env:Path;
 ---> Running in 2c04ec89a541
SUCCESS: Specified value was saved.
Removing intermediate container 2c04ec89a541
 ---> 71e64eb63111
Step 3/19 : RUN Invoke-WebRequest 'https://storage.googleapis.com/chrome-infra/depot_tools.zip' -OutFile 'C:/code/depot_tools.zip';
 ---> Running in 280ed7696bc4
Removing intermediate container 280ed7696bc4
 ---> 16510ac44f49
Step 4/19 : RUN Expand-Archive C:/code/depot_tools.zip -DestinationPath "C:/code/depot_tools";
 ---> Running in 4f11e096faf2
Removing intermediate container 4f11e096faf2
Step 5/19 : RUN $env:Path = 'c:/code/depot_tools/;' + $env:Path;setx /M PATH $env:Path;
 ---> 51795efa13ba
 ---> Running in 08db973d2bf1
SUCCESS: Specified value was saved.
Removing intermediate container 08db973d2bf1
 ---> 1d61c188b252
Step 6/19 : ARG GN_DEFINES="is_debug=false"
 ---> Running in 8a7fef0b240c
Removing intermediate container 8a7fef0b240c
 ---> 1175318789da
Step 7/19 : ENV DEPOT_TOOLS_WIN_TOOLCHAIN 0
 ---> Running in a09d6e4b86ae
Removing intermediate container a09d6e4b86ae
 ---> b37572a7e392
Step 8/19 : ENV CEF_USE_GN 1
 ---> Running in 2a793ba920ec
Removing intermediate container 2a793ba920ec
 ---> 4c5382f267e8
Step 9/19 : ENV GYP_MSVS_VERSION 2017
 ---> Running in a94aa7b48b0c
Removing intermediate container a94aa7b48b0c
 ---> 7082cc4cf373
Step 10/19 : ARG DUAL_BUILD="0"
 ---> Running in 2ac0e3acbdb3
Removing intermediate container 2ac0e3acbdb3
Step 11/19 : ARG BINARY_EXT="zip"
 ---> 34574d371b62
 ---> Running in f932612e4aa7
Removing intermediate container f932612e4aa7
 ---> c30741593b92
Step 12/19 : ARG GYP_DEFINES="target_arch=x64 "
 ---> Running in 51604223ec78
Removing intermediate container 51604223ec78
Step 13/19 : RUN setX /M DEPOT_TOOLS_WIN_TOOLCHAIN 0;setX /M GYP_MSVS_VERSION 2017;setx /M GN_DEFINES "$env:GN_DEFINES";setx /M GYP_DEFINES "$env:GYP_DEFINES";setx /M DUAL_BUILD "$env:DUAL_BUILD";
 ---> 6e532256920a
 ---> Running in 43e87bf24836
SUCCESS: Specified value was saved.
SUCCESS: Specified value was saved.
SUCCESS: Specified value was saved.
ERROR: Invalid syntax.
Type "SETX /?" for usage.

SUCCESS: Specified value was saved.
Removing intermediate container 43e87bf24836
 ---> a32174d8c52b
Step 14/19 : ARG CHROME_BRANCH=3239
 ---> Running in f9360fabec46
Removing intermediate container f9360fabec46
Step 15/19 : ADD https://bitbucket.org/chromiumembedded/cef/raw/master/tools/automate/automate-git.py c:/code/automate/
 ---> 5f64b605af01
 ---> f47f8116d782
Step 16/19 : RUN cd c:/code/depot_tools/;update_depot_tools.bat;git checkout .\cipd.ps1;update_depot_tools.bat;
 ---> Running in 19dbfb1ec85d
Downloading CIPD client for windows-amd64 from https://chrome-infra-packages.appspot.com/client?platform=windows-amd64&version=git_revision:2a121dde003a3079db0fdf58195b52cbf486f6ba...
Updated 0 paths from the index
Removing intermediate container 19dbfb1ec85d
 ---> a055f12c07d1
Step 17/19 : ADD functions.ps1 cef_build.ps1 cef_patch.ps1 cef_patch_*.diff c:/code/
 ---> caf1d892bdfb
Step 18/19 : ARG CEF_SAVE_SOURCES
 ---> Running in 20bf2fed4d0a
Removing intermediate container 20bf2fed4d0a
 ---> 7b72688c69bd
Step 19/19 : RUN c:/code/cef_build.ps1
 ---> Running in f9297a4554aa
Running: c:/code/depot_tools/python.bat c:/code/automate/automate-git.py --download-dir=c:/code --branch=3370 --no-build --no-debug-build --no-distrib in C:\code\depot_tools
Cloning into 'c:\code\cef'...
Checking out files:  72% (1333/1844)
Checking out files:  73% (1347/1844)
Checking out files:  74% (1365/1844)
Checking out files:  75% (1383/1844)
Checking out files:  76% (1402/1844)
Checking out files:  77% (1420/1844)
Checking out files:  78% (1439/1844)
Checking out files:  79% (1457/1844)
Checking out files:  80% (1476/1844)
Checking out files:  81% (1494/1844)
Checking out files:  82% (1513/1844)
Checking out files:  83% (1531/1844)
Checking out files:  84% (1549/1844)
Checking out files:  85% (1568/1844)
Checking out files:  86% (1586/1844)
Checking out files:  87% (1605/1844)
Checking out files:  88% (1623/1844)
Checking out files:  89% (1642/1844)
Checking out files:  90% (1660/1844)
Checking out files:  91% (1679/1844)
Checking out files:  92% (1697/1844)
Checking out files:  93% (1715/1844)
Checking out files:  94% (1734/1844)
Checking out files:  95% (1752/1844)
Checking out files:  96% (1771/1844)
Checking out files:  97% (1789/1844)
Checking out files:  98% (1808/1844)
Checking out files:  99% (1826/1844)
Checking out files: 100% (1844/1844)
Checking out files: 100% (1844/1844), done.
error: pathspec 'origin/3370' did not match any file(s) known to git
--> Depot Tools Directory: c:\code\depot_tools
-------- Running "update_depot_tools.bat" in "c:\code\depot_tools"...
--> Updating depot_tools
--> CEF URL: https://bitbucket.org/chromiumembedded/cef.git
--> Download Directory: c:\code
--> CEF Source Directory: c:\code\cef
-------- Running "c:\code\depot_tools\git.bat rev-parse HEAD" in "c:\code\cef"...
-------- Running "c:\code\depot_tools\git.bat clone https://bitbucket.org/chromiumembedded/cef.git c:\code\cef" in "c:\code"...
--> CEF Branch: 3370
-------- Running "c:\code\depot_tools\git.bat rev-parse origin/3370" in "c:\code\cef"...
-------- Running "c:\code\depot_tools\git.bat checkout origin/3370" in "c:\code\cef"...
--> CEF Current Checkout: f9706f260aa9fd78c799c1456f0ac75d13f5e7ba
--> CEF Desired Checkout: origin/3370 (origin/3370)
  File "c:/code/automate/automate-git.py", line 1274, in <module>
Traceback (most recent call last):
    cef_dir, depot_tools_dir)
    args, cwd=working_dir, env=env, shell=(sys.platform == 'win32'))
  File "c:/code/automate/automate-git.py", line 61, in run
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['c:\\code\\depot_tools\\git.bat', 'checkout', 'origin/3370']' returned non-zero exit status 1
  File "c:\code\depot_tools\bootstrap-3_8_0b1_chromium_1_bin\python\bin\lib\subprocess.py", line 186, in check_call
1
Set-Location : Cannot find path 'C:\code\chromium\src\cef' because it does not
exist.
At C:\code\cef_build.ps1:28 char:1
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ Set-Location -Path c:/code/chromium/src/cef;
   ) [Set-Location], ItemNotFoundException
    + CategoryInfo          : ObjectNotFound: (C:\code\chromium\src\cef:String
    + FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.SetLo
   cationCommand


The command 'powershell -Command $ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue'; c:/code/cef_build.ps1' returned a non-zero code: 1
Caught an exception: Process docker build --memory=30g --build-arg CEF_SAVE_SOURCES="0" --build-arg BINARY_EXT="zip" --build-arg DUAL_BUILD="0" --build-arg GN_DEFINES="is_official_build=true proprietary_codecs=true ffmpeg_branding=Chrome" --build-arg GYP_DEFINES="" --build-arg CHROME_BRANCH="3370" -f Dockerfile_cef -t cef . exited with non zero code: 1 aborting!
        Exception Type: System.Management.Automation.RuntimeException
        Stack Trace: at RunProc, C:\build-cefsharp\functions.ps1: line 82
        at <ScriptBlock>, C:\build-cefsharp\build.ps1: line 70
        at <ScriptBlock>, <No file>: line 1
        at confirm, C:\build-cefsharp\functions.ps1: line 106
        at <ScriptBlock>, C:\build-cefsharp\build.ps1: line 43
        at <ScriptBlock>, <No file>: line 1
PS C:\build-cefsharp>>

Building CEF image fails

When I tried to build the current CefSharp branch with proprietary codecs the script failed building the CEF environment:
CEF.Build1.txt

versions.ps1:
versions.ps1.txt

I tried these steps to track the issue down:

  1. used a fresh installation of Win10x64 1803 to eliminate environment issues

  2. commented out 'RUN c:/code/cef_build.ps1' in dockerfile_cef
    Attached to cef container with remote powershell:
    Checked environment variables: ok
    Called 'c:/code/depot_tools/python.bat c:/code/automate/automate-git.py --download-dir=c:/code --branch=3396 --no-build --no-debug-build --no-distrib'
    --> automate-git.py failed in update_depot_tools
    Seems for some reason this is the culprit.

  3. As a workaround I disabled the update as of here: https://bitbucket.org/chromiumembedded/cef/wiki/BranchesAndBuilding#markdown-header-legacy-release-branches-unsupported
    by adding following lin to dockerfile_cef: ENV DEPOT_TOOLS_UPDATE 0

This builds the CEF image, but depot_tools are probably unsynced now to the correct branch: 3396

Chromium sources are currently loading, will take awhile.
[sry for editing: did have formatting problems]

consistent nuget restore error in cefsharp_set_versions_and_restore.ps1

Many thanks for providing this repo.
I have successfully used it to build CefSharp 83 12 months ago.

However now I am consistently getting the following error when building via azure. I am using recommended Standard_F32s_v2 (Windows Server 1903)

Step 18/21 : RUN ./cefsharp_set_versions_and_restore.ps1
 ---> Running in 369e6974d2e3

SUCCESS: Specified value was saved.
doing C:\code\cefsharp\CefSharp\CefSharp.csproj
doing C:\code\cefsharp\CefSharp\CefSharp.netcore.csproj
doing C:\code\cefsharp\CefSharp.Core\CefSharp.Core.csproj
doing C:\code\cefsharp\CefSharp.Core\CefSharp.Core.netcore.csproj
doing C:\code\cefsharp\CefSharp.Example\CefSharp.Example.csproj
doing C:\code\cefsharp\CefSharp.Example\CefSharp.Example.netcore.csproj
doing C:\code\cefsharp\CefSharp.OffScreen\CefSharp.OffScreen.csproj
doing C:\code\cefsharp\CefSharp.OffScreen\CefSharp.OffScreen.netcore.csproj
doing C:\code\cefsharp\CefSharp.OffScreen.Example\CefSharp.OffScreen.Example.csproj
Updated C:\code\cefsharp\CefSharp.OffScreen.Example\CefSharp.OffScreen.Example.csproj
doing C:\code\cefsharp\CefSharp.OffScreen.Example\CefSharp.OffScreen.Example.netcore.csproj
doing C:\code\cefsharp\CefSharp.Test\CefSharp.Test.csproj
Updated C:\code\cefsharp\CefSharp.Test\CefSharp.Test.csproj
doing C:\code\cefsharp\CefSharp.Test\CefSharp.Test.netcore.csproj
doing C:\code\cefsharp\CefSharp.WinForms\CefSharp.WinForms.csproj
doing C:\code\cefsharp\CefSharp.WinForms\CefSharp.WinForms.netcore.csproj
doing C:\code\cefsharp\CefSharp.WinForms.Example\CefSharp.WinForms.Example.csproj
Updated C:\code\cefsharp\CefSharp.WinForms.Example\CefSharp.WinForms.Example.csproj
doing C:\code\cefsharp\CefSharp.WinForms.Example\CefSharp.WinForms.Example.netcore.csproj
doing C:\code\cefsharp\CefSharp.Wpf\CefSharp.Wpf.csproj
doing C:\code\cefsharp\CefSharp.Wpf\CefSharp.Wpf.netcore.csproj
doing C:\code\cefsharp\CefSharp.Wpf.Example\CefSharp.Wpf.Example.csproj
Updated C:\code\cefsharp\CefSharp.Wpf.Example\CefSharp.Wpf.Example.csproj
doing C:\code\cefsharp\CefSharp.Wpf.Example\CefSharp.Wpf.Example.netcore.csproj
restore failed running 'C:\code\cefsharp\.\nuget\NuGet.exe restore -source
"C:/code/cef-binary/cef-binary-master/NuGet" -FallbackSource
https://api.nuget.org/v3/index.json CefSharp3.sln' with exit code 0x1
At C:\code\cefsharp\cefsharp_set_versions_and_restore.ps1:98 char:2
+     throw ("restore failed running '$nuget $args' with exit code 0x$r ...
+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : OperationStopped: (restore failed ...h exit code
    0x1:String) [], RuntimeException
    + FullyQualifiedErrorId : restore failed running 'C:\code\cefsharp\.\nuget
   \NuGet.exe restore -source "C:/code/cef-binary/cef-binary-master/NuGet" -F
  allbackSource https://api.nuget.org/v3/index.json CefSharp3.sln' with exit
  code 0x1

The command 'powershell -Command $ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue'; ./cefsharp_set_versions_and_restore.ps1' returned a non-zero code: 1
Caught an exception: Process docker build --memory=30g --build-arg CEFSHARP_BRANCH="cefsharp/93" --build-arg CEFSHARP_VERSION="93.1.140" --build-arg CEF_VERSION_STR="auto" --build-arg CHROME_BRANCH="4577" -f Dockerfile_cefsharp -t cefsharp . exited with non zero code: 1 aborting!
        Exception Type: System.Management.Automation.RuntimeException
        Stack Trace: at RunProc, C:\CefSharpDockerfiles\functions.ps1: line 82
        at <ScriptBlock>, C:\CefSharpDockerfiles\build.ps1: line 96
        at <ScriptBlock>, <No file>: line 1

from az_create.ps1

[CmdletBinding()]
Param(
	[Parameter(Mandatory=$true)]
	[PSCredential] $admin_creds,
	[String] $shutdown_email,
	[String] $RESOURCE_GROUP="CEFTest",
	[String] $LOCATION="West Europe",
	[String] $MACHINE_SIZE="Standard_F32s_v2",
	[String] $SHUTDOWN_TIME="04:30",
	[String] $RANDOM_STR=""
)
...

from versions_src.ps1

$VAR_CHROME_BRANCH="4606";
$VAR_CEFSHARP_VERSION="94.4.110";
$VAR_CEFSHARP_BRANCH="cefsharp/94";
$VAR_BASE_DOCKER_FILE="mcr.microsoft.com/windows/servercore:1903-amd64";#mcr.microsoft.com/windows/servercore:1903-amd64
$VAR_DUAL_BUILD="0"; #set to 1 to build all arches together, mainly to speed up linking which is single threaded, note may need excess ram.
$VAR_BUILD_ARCHES="x86 x64";
$VAR_GN_DEFINES="is_official_build=true proprietary_codecs=true ffmpeg_branding=Chrome";
$VAR_CEF_BUILD_MOUNT_VOL_NAME=""; #force using this volume for building, allows resuming MUST BE LOWER CASE
$VAR_GN_ARGUMENTS="--ide=vs2019 --sln=cef --filters=//cef/*";
$VAR_GYP_DEFINES="";
$VAR_CEF_BUILD_ONLY=$false;#Only build CEF do not build cefsharp or the cef-binary.
$VAR_CEF_USE_BINARY_PATH=""; #If you want to use existing CEF binaries point this to a local folder where the cef_binary*.zip files are. It will skip the long CEF build step then but still must make the VS container for the cefsharp building.  Note will copy a dockerfile into this folder.
$VAR_REMOVE_VOLUME_ON_SUCCESSFUL_BUILD=$true;
$VAR_CEF_BINARY_EXT="zip"; #Can be zip,tar.bz2, 7z Generally do not change this off of Zip unless you are supplying your own binaries using $VAR_CEF_USE_BINARY_PATH above, and they have a different extension, will try to work with the other formats however
$VAR_CEF_SAVE_SOURCES="0"; #normally sources are deleted before finishing the CEF build step.  Set to 1 to create a /code/sources.zip archive that has them (note it is left in docker image, must use docker cp to copy it out, it is also around 30GB).
$VAR_CEF_VERSION_STR="auto"; #can set to "3.3239.1723" or similar if you have multiple binaries that Docker_cefsharp might find
$VAR_HYPERV_MEMORY_ADD="--memory=30g"; #only matters if using HyperV, Note your swap file alone must be this big or able to grow to be this big, 30G is fairly safe for single build will need 60G for dual build.

I have tried running build 5 times and each time it fails on the above step.
It gives the same error when trying CefSharp 93
It looks like CEF is successfully built.

I have attached a fuller log which includes a larger tail of logging.
cefsharp_error.txt

Latest versions

Hey there!

Where can we find the list of the most current versions of CHROME_BRANCH and CEFSHARP_VERSION and CEFSHARP_BRANCH?

Currently Chromium is up to 108.0.5307.1 and CefSharp is up to 105.3.330.

What do we need to set in versions_src.ps1 to build on those versions?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.