Building old Chromium

I'm open to making changes if anyone encounters an issue. Let me know in the comments if something doesn't work.

Recently I became interested in building old versions of Chromium for Windows XP. There is a project called Advanced Chrome that does that already but I wanted to work on my own XP-compatible fork. Using archive.org's Wayback Machine, I was able to find Chromium build instructions from 2015, before they dropped XP support. Here are the steps to follow if you want to build an old version of Chromium.

Requirements:

  • Windows 7 or higher, x64 only
  • Visual Studio 2013, Update 4 or 5
  • The following Windows SDK's:
    • (Maybe) Windows 8 (installer version 8.100.26936.0)
    • Windows 10 (10.0.26624)
    • Windows 10 (10.1.10586.212, installer version 10.0.10586.212)
  • A fast computer with many CPU cores and a lot of RAM
    • I use an Intel Core 2 Quad and 8 GB RAM
  • An SSD is highly recommended, although I initially built Chromium on a magnetic drive
    • Be aware that the repo has roughly 350,000 files, most of them very small, and much time will be wasted waiting for a magnetic drive's arm to swing back and forth.

TortoiseGit is optional but recommended. It will need a separate Git installation.
It wouldn't hurt to install Python 2.7 even though a copy of Python will be downloaded by depot_tools.
You should probably find a copy of Visual Studio and start downloading it now.

1. Visit this URL in the Wayback Machine

Even though I'm going to explain everything, you should read these instructions just to get familiar with how the build process works.

2. Install build tools

Install Visual Studio 2013 Community. The Chromium page says,
You can deselect the default options if you want, but you must make sure to install "Microsoft Foundation Classes for C++".
Also install the 2 Windows 10 SDK's listed earlier. You can skip the Windows 8 SDK for now but if you encounter errors you might try installing it.

Always install Visual Studio and the Windows SDK's to the default folders! Preferably the C drive!
If you don't, you may not be able to compile Chromium and could end up making a mess that would require you to restore your computer from a backup.

2. Get the depot_tools

"depot_tools" is a set of Google utilities that download the Chromium repository and install some of the build tools. You cannot use the latest version because a lot has changed since 2015. Fortunately, the Wayback Machine cached a copy from 2015, but you can't just download and use it because it tries to download the tools from URL's that no longer exist. The downloads are still available at different URL's so I was able to fix it and I committed the changes to a private repo (linked below).

You need to download my custom 2015 depot_tools. Extract it to C:\workspace, and add C:\workspace\depot_tools\ to your PATH environment variable.


You don't need the PGP signature unless you want to verify that the custom depot_tools came from me.

After extracting the 7-zip file and adding the new folder to PATH, you'll need to set up your Git configuration as shown under "Bootstrapping Configuration" in this link.

3. Set up the depot_tools and download the repo

  1. Make a new folder on a drive where you would like to store the Chromium source. You'll need about 45-50 GiB of free space for the repo, I think, and at least 70 GiB by the time it's fully compiled. I created mine on an SSD with the letter F:.
  2. Open a command prompt and change to the folder you just created, in my case F:\chromium2015.
  3. Run "gclient" and wait for it to finish.
  4. Close as many programs as possible (to free up RAM) and run "fetch --nohooks chromium". It can fail if it runs out of memory so try not to have too many other things open during this step. This command will acquire the entire Chromium source code, and all history going back to the beginning, so it will take a long time. It will also extract all the (mostly small) files, which is why we should be using an SSD. In my case, it downloaded about 14 GiB in 3 hours and then spent 1 hour extracting everything. My log for this command
  5. Run "gclient sync -r src@16659538bfb5de7212c3b97d1ce5e2ea03fc7b2a". The long hex string is the ID of the last commit submitted on May 12, 2015. This command basically says that we want to roll back the code to what it looked like on May 12, 2015 at about 11:53 PM. I used TortoiseGit to find this. Since I found it already, TortoiseGit is optional for you. My log for this command
  6. Run "gclient runhooks" My log for this command
  7. Run "cd src" to change to the src folder.
  8. Run "git clean -ffd" My log for this command
  9. Run "python ./build/gyp_chromium -Dcomponent=shared_library" My log for this command
"-Dcomponent=shared_library" is something to do with debugging. It compiles faster but you cannot copy or move your finished build.

"-Dtarget_arch=x64" Use this if you plan to build for 64-bit. You cannot build 32-bit if this is set, nor can you build 64-bit without it. Thanks to users "torne" and "thakis_" on the #chromium IRC channel for pointing this out. More info: https://bugs.chromium.org/p/chromium/issues/detail?id=178207

4. Fix minor code mistakes

You now have the complete Chromium source from May 12, 2015 but there are a couple of minor mistakes that will keep it from compiling. One of the errors was addressed in this forum post and I'm including fixes here so you don't have to read it. Here are the 3 changes you need to make:
  • In [chosen source folder]/src/ui/gl/gl_bindings.h, add "#define GL_CONTEXT_LOST_KHR               0x0507" (without quotes) on line 283, which should be empty. If it's not empty by some chance, perhaps add it at the top.
  • In [chosen source folder]/src/third_party/swiftshader/include/egl/eglext.h, add "typedef EGLAttribKHR EGLAttrib;" (without quotes) below line 62. Also add "typedef EGLSyncKHR EGLSync;" (without quotes) below what is now line 64.
Save the files if you haven't already.

5. Compile the code

Make sure your command prompt is still in the src folder and run "ninja -C out/Release chrome". This process will probably take many hours. The good news is that when you compile again after making changes, it will be much faster because it only re-compiles changes.

If this step fails, it may be because the linker ran out of memory while compiling the last few DLL's.

If you've compiled before, re-compiling should look like this:



As you can see, memory usage ramps up during the final link step.


Here is what this version will look like when it runs for the first time.



5 comments:

  1. Hello your information is great.
    Any ideas for "error: RPC failed; HTTP 400 curl 22 The requested URL returned error: 400" ? after fetch --nohooks chromium?
    I can provide the logs and specs.

    Thanks in advance

    ReplyDelete
    Replies
    1. It sounds like it's trying to reach a URL that doesn't exist anymore. Please provide the logs so I can troubleshoot. If I can't help, you might try the unofficial Chromium Discord server or the #chromium IRC channel on Freenode.

      Delete
    2. Thanks for your reply, i am providing the logs

      ====gclint sync -r src@16659538bfb5de7212c3b97d1ce5e2ea03fc7b2a======
      =====================================================================

      $PATH$>gclient sync -r src@16659538bfb5de7212c3b97d1ce5e2ea03fc7b2a
      gclient_eval(452) _MergeDepsOs:Ignoring 'src/chrome/test/data/perf/canvas_bench':{'url': None, 'dep_type': 'git'} in 'ios' deps_os
      gclient_eval(452) _MergeDepsOs:Ignoring 'src/chrome/test/data/perf/frame_rate/content':{'url': None, 'dep_type': 'git'} in 'ios' deps_os
      gclient_eval(452) _MergeDepsOs:Ignoring 'src/native_client':{'url': None, 'dep_type': 'git'} in 'ios' deps_os
      gclient_eval(452) _MergeDepsOs:Ignoring 'src/third_party/ffmpeg':{'url': None, 'dep_type': 'git'} in 'ios' deps_os
      gclient_eval(452) _MergeDepsOs:Ignoring 'src/third_party/hunspell_dictionaries':{'url': None, 'dep_type': 'git'} in 'ios' deps_os
      gclient_eval(452) _MergeDepsOs:Ignoring 'src/third_party/webgl':{'url': None, 'dep_type': 'git'} in 'ios' deps_os
      48>WARNING: subprocess '"git" "-c" "core.deltaBaseCacheLimit=2g" "fetch" "origin" "cae696156f1e60006e39821e79a1811ae1933c69" "--no-tags"' in $PATH$\src\third_party\opus\src failed; will retry after a short nap...
      48>WARNING: subprocess '"git" "-c" "core.deltaBaseCacheLimit=2g" "fetch" "origin" "cae696156f1e60006e39821e79a1811ae1933c69" "--no-tags"' in $PATH$\src\third_party\opus\src failed; will retry after a short nap...
      48>WARNING: subprocess '"git" "-c" "core.deltaBaseCacheLimit=2g" "fetch" "origin" "cae696156f1e60006e39821e79a1811ae1933c69" "--no-tags"' in $PATH$\src\third_party\opus\src failed; will retry after a short nap...
      48>WARNING: subprocess '"git" "-c" "core.deltaBaseCacheLimit=2g" "fetch" "origin" "cae696156f1e60006e39821e79a1811ae1933c69" "--no-tags"' in $PATH$\src\third_party\opus\src failed; will retry after a short nap...
      Syncing projects: 100% (75/75) src/third_party/opus/src

      src/third_party/opus/src (ERROR)
      ----------------------------------------
      [0:00:04] Started.
      [0:00:04] Finished running: git config remote.origin.url
      [0:00:04] Finished running: git rev-list -n 1 HEAD
      [0:00:04] Finished running: git rev-parse --abbrev-ref=strict HEAD
      error: RPC failed; HTTP 400 curl 22 The requested URL returned error: 400
      [0:00:07] fatal: the remote end hung up unexpectedly
      [0:00:08] error: RPC failed; HTTP 400 curl 22 The requested URL returned error: 400
      [0:00:08] fatal: the remote end hung up unexpectedly
      [0:00:10] error: RPC failed; HTTP 400 curl 22 The requested URL returned error: 400
      [0:00:10] fatal: the remote end hung up unexpectedly
      [0:00:12] error: RPC failed; HTTP 400 curl 22 The requested URL returned error: 400
      [0:00:12] fatal: the remote end hung up unexpectedly
      ----------------------------------------
      Error: Command 'git -c core.deltaBaseCacheLimit=2g fetch origin cae696156f1e60006e39821e79a1811ae1933c69 --no-tags' returned non-zero exit status 128 in $PATH$\src\third_party\opus\src
      ==============================================================

      Delete
    3. The "fetch --nohooks chromium" command worked exactly as the logs provided by the author.

      Delete
    4. This error seems to be related to Opus. I can't tell what's wrong based on this. Maybe an online resource related to Opus no longer exists.

      Delete