Following Chromium compilation guidelines always fails because main branch is unstable

574 views
Skip to first unread message

Omar Shawky

unread,
Mar 13, 2024, 8:25:16 AM3/13/24
to Chromium GSoC
# How to compile chromium from source code?
The following are the steps I followed until I faced the "unsolvable bug"
1. Installed depot_tools.
2. Got the code:
 1- `mkdir ~/chromium && cd ~/chromium`
 2- `fetch --nohooks --no-history chromium`
3. Created a docker container (file available upon request)
4. From container: `cd /chromium/src`
5. `./build/install-build-deps.sh`
6. `gclient runhooks``
7. `mkdir out && cd out && mkdir Default && cd ..`
8. `gn gen out/Default` but I receive the following error:
```
# gn gen out/Default
ERROR at //third_party/angle/BUILD.gn:860:16: Could not read file.
    git_dirs = exec_script("src/commit_id.py", [ "get_git_dirs" ], "list lines")
               ^---------------------------------------------------------------
I resolved this to "/HEAD".
See //BUILD.gn:737:9: which caused the file to be included.
        "//third_party/angle:libANGLE",
        ^-----------------------------
```
9. Tried:
 1- `git rebase-update``
 2- `gclient sync`
 3- `gn gen out/Default` but failed like before
10. The reason is that main branch does not contain `commit_id.py` file as shown here: https://chromium.googlesource.com/chromium/src.git/+/refs/heads/main (my origin repo)

Please help, ever since GSoC Started I was trying relentlessly to just clone the project for 18 days straight but couldn't because cloning a project does not resume in cases of network failure and it restarts. I really downloaded ~400GB, not to mention using docker or any preqs!

Thanks in advance
 
# Resources
https://chromium.googlesource.com/chromium/src/+/main/docs/linux/build_instructions.md#run-the-hooks

Sreeja Kamishetty

unread,
Mar 14, 2024, 4:11:21 PM3/14/24
to Chromium GSoC, ipower...@gmail.com
Hi,

I am very soorry about Chromium build issues. To help you with build can you let me know what platform are your building chromium on?

What project are you looking to contribute this year and if you have any project related issues please don't hesitate to file a bug as listed in the project doc as some projects don't require you to build chromium.

I know that building chromium on personal machines is hassale, due to resource constraints we will be providing the selected contributors with GCP instances once the program starts.

- Sreeja

Omar Shawky

unread,
Mar 14, 2024, 4:17:52 PM3/14/24
to Chromium GSoC, Sreeja Kamishetty, ipower...@gmail.com
Hi,

I am looking to contribute to Chromium. I wanted to build first before I can start any starter bug. I will check the projects which do not require any compilation.

This is my docker file: (I install the dependencies when I run container and commit the image for later use)
# Use an official Ubuntu base image with Docker already installed
```
FROM ubuntu:20.04

# Set environment variables
ENV DEBIAN_FRONTEND=noninteractive

# Install curl (if not already installed)
RUN apt-get update && \
    apt-get install -y curl git lsb-release python3 vim git sudo && \
    rm -rf /var/lib/apt/lists/*

# MOUNT the Chromium directory from the host
#VOLUME /home/Desktop/GSoC/depot_tools:/depot_tools #This is to persist data after closing container not to mount dirs

# Export depot_tools path
ENV PATH="/depot_tools:${PATH}"

# Configure git for safe.directory
RUN git config --global --add safe.directory /depot_tools

# MOUNT the Chromium directory from the host
#VOLUME /home/Desktop/GSoC/chromium:/chromium #This is to persist data after closing container not to mount dirs

# Set the working directory to the existing Chromium source directory
WORKDIR /chromium/src

# Expose any necessary ports (if needed)
#EXPOSE 8080

# Start Chromium (modify this command as needed)
#CMD ["echo", "Chromium build environment is ready. You can now build the project."]
CMD ["bash"]
```

Also, is there any channel for mentor communication that I better use than the mailing list?

Feras Aldahlawi

unread,
Mar 14, 2024, 5:07:56 PM3/14/24
to Omar Shawky, Chromium GSoC, Sreeja Kamishetty
Hey Omar,

I don't think we support building Chromium in a docker image. To get Chromium development specific help, you can use chromi...@chromium.org mailing list.

Best,
F.A.

--
You received this message because you are subscribed to the Google Groups "Chromium GSoC" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-gso...@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/chromium-gsoc/bba94378-eb5e-4aa1-9522-73d5788cd58cn%40chromium.org.

Omar Shawky

unread,
Mar 14, 2024, 7:26:29 PM3/14/24
to Chromium GSoC, Feras Aldahlawi, Chromium GSoC, Sreeja Kamishetty, Omar Shawky
Hello Feras,

Thanks for your great help!

Could you please guide me as a first time contributor?

I wanted to contribute to chromium as a long-term maintainer, but the documentation alone was hard for me to get things working, and I found that GSoC is a great opportunity to achieve it. (Documentation is at the end of the email)


Before I emailed mentors, I read and wanted to test things without altering my OS. I used Docker to manage all dependencies and OS versions, especially in case I missed a configuration or anything.
Also, I was afraid of corrupting my own OS as I don't understand a lot of things in documents (like REAPI) and there was no active mentor, so I "figured things out on my own.".
  1. I read the necessary documentation before asking, and they explicitly wrote that I need "working Chromium checkout and build" in Contributing to Chromium.
  2. I asked a lot of previous contributors, and they said the same.
  3. I Tried to find any active members or mentors here, but to no avail.

Since March 6th, I have been trying to clone and build the project, but to no avail (the network caused `git` to re-clone each time from the start, and I ended up downloading 450GB! and so on). I persisted in cloning and building it until I realized that I spent 10 days straight but still didn't build it, and I might miss other real good projects that I was checking and submitting a merged PR such as Checkstyle, PostgreSQL, and MariaDB.

I want to contribute to chromium. But in case there are no clear guidelines for starters, I have no other option but to seek out other organizations. So please just let me know where I should start, because apparently documentation is too much hassle for a starter.

Some of the official resources I fully or half-read:
  1. Chromium Docs
    1. Contributing to Chromium
    1. Linux Build
    3. Chromium Project For Developers
    1. Getting Around the Chromium Source Code Directory Structure
    4. Projects Docs
    1. Chromium GSoC FAQs .

Best Regards,

Feras Aldahlawi

unread,
Mar 15, 2024, 11:06:25 AM3/15/24
to Omar Shawky, bsh...@chromium.org, Chromium GSoC, Sreeja Kamishetty
Hi Omar,

Sorry that you are experiencing trouble getting started with Chromium. I am not sure what is going on with your setup. I am not familiar with working in a docker container.

bsh...@chromium.org, am I missing something obvious here? Could you help Omar with his question?

Omar Shawky

unread,
Mar 17, 2024, 3:16:54 PM3/17/24
to Chromium GSoC, Feras Aldahlawi, Chromium GSoC, Sreeja Kamishetty, Omar Shawky, bsh...@chromium.org
For anyone who might be interested, the solution is either use chroot (check documents) or map your current user to a user in the container.
I.e., add this to the dockerfile: RUN useradd -u 1000
Run your docker with user parameter `-u $(id -u):$(id -g)`

After 12 Days, I have successfully built it. 

Tejal Kadam

unread,
Mar 17, 2024, 9:36:17 PM3/17/24
to Omar Shawky, Chromium GSoC
Hello, 
I am getting similar error after running - gn gen out/Default

Traceback (most recent call last):
  File "C:\chromium\src\build\toolchain\win\setup_toolchain.py", line 328, in <module>
    main()
  File "C:\chromium\src\build\toolchain\win\setup_toolchain.py", line 274, in main
    env = _LoadToolchainEnv(cpu, toolchain_root, win_sdk_path, target_store)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\chromium\src\build\toolchain\win\setup_toolchain.py", line 190, in _LoadToolchainEnv
    return _ExtractImportantEnvironment(variables)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\chromium\src\build\toolchain\win\setup_toolchain.py", line 68, in _ExtractImportantEnvironment
    raise Exception(
Exception: Path "C:\Program Files (x86)\Windows Kits\10\\include\10.0.22621.0\\um" from environment variable "include" does not exist. Make sure the necessary SDK is installed.
ERROR at //build/toolchain/win/win_toolchain_data.gni:9:7: Script returned non-zero exit code.
      exec_script("//build/toolchain/win/setup_toolchain.py",
      ^----------
Current dir: C:/chromium/src/out/Default/
Command: C:/src/Depot_tools/bootstrap-2@3_11_6_chromium_30_bin/python3/bin/python3.exe C:/chromium/src/build/toolchain/win/setup_toolchain.py "C:\Program Files/Microsoft Visual Studio/2022/Community" "C:\Program Files (x86)\Windows Kits\10" "C:\WINDOWS\System32;C:\WINDOWS\SysWOW64;Arm64Unused" win x86 environment.x86
Returned 1.
See //build/toolchain/win/toolchain.gni:14:1: whence it was imported.
import("//build/toolchain/win/win_toolchain_data.gni")
^----------------------------------------------------
See //base/BUILD.gn:40:1: whence it was imported.
import("//build/nocompile.gni")
^-----------------------------
See //BUILD.gn:502:9: which caused the file to be included.
        "//base:base_i18n_perftests",
        ^---------------------------

Please let me know what to do to resolve the error. 


Thank you. 

--
You received this message because you are subscribed to the Google Groups "Chromium GSoC" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-gso...@chromium.org.

Brian Sheedy

unread,
Mar 18, 2024, 12:41:51 PM3/18/24
to Omar Shawky, Chromium GSoC, Feras Aldahlawi, Sreeja Kamishetty
AFAIK building Chromium in Docker is not officially supported. The documentation here that is attributed to me is information from some other contributor that I added for posterity - I've never actually used Docker for building myself. Feel free to update the documentation with your findings.
Message has been deleted
Message has been deleted

Feras Aldahlawi

unread,
Mar 19, 2024, 12:02:48 PM3/19/24
to Omar Shawky, Chromium GSoC, Brian Sheedy, Sreeja Kamishetty
Spoke offline with Omar, He needed to create a gerrit account and his problem is solved https://www.chromium.org/developers/gerrit-guide/

On Tue, Mar 19, 2024 at 5:28 AM Omar Shawky <ipower...@gmail.com> wrote:
Hello Brian, Feras

As per requested, I edited the documentation and want to commit them. However, I am facing some issues while uploading cl. Could you please help? Moreover, I don't know whom and how to add a reviewer as in the guide here:https://chromium.googlesource.com/chromium/src/+/refs/heads/main/docs/contributing.md#Related-resources
```shell
$ git cl upload
Found change with 1 commit...
Credentials for the following hosts are required:
  chromium-review.googlesource.com
  chromium.googlesource.com
These are read from /home/omar/.gitcookies (or legacy /home/omar/.netrc)
You can (re)generate your credentials by visiting https://chromium.googlesource.com/new-password
```
Reply all
Reply to author
Forward
0 new messages