0

Update build instructions for Linux and Windows.

Removes redundant instructions from the platform-specific plages and the main "get the code" page on the sites page. The platform pages should have only non-redundant platform-specific information.

When I did this the Linux page was basically empty with a link the the prerequistes page, so I consolidated these two pages, leaving a placeholder in the old prerequisites page for now to avoid breaking links.

There was a lot of out-of-date information removed.

Review-Url: https://codereview.chromium.org/2014753002
Cr-Commit-Position: refs/heads/master@{#396071}
This commit is contained in:
brettw
2016-05-25 18:11:52 -07:00
committed by Commit bot
parent f16e174c0b
commit c25693b300
5 changed files with 164 additions and 326 deletions

@ -33,10 +33,8 @@ Build: `ninja -C out/Debug chrome`
## Reverting to gcc on linux
We don't have bots that test this, but building with gcc4.8+ should still work
on Linux. If your system gcc is new enough, use this to build with gcc if you
don't want to build with clang:
GYP_DEFINES=clang=0 build/gyp_chromium
on Linux. If your system gcc is new enough, run `gn args` and add `is_clang =
false`.
## Mailing List
@ -62,7 +60,7 @@ To test the FindBadConstructs plugin, run:
../../../../third_party/llvm-build/Release+Asserts/lib/libFindBadConstructs.so)
To run [other plugins](writing_clang_plugins.md), add these to your
`GYP_DEFINES`:
`GYP_DEFINES` (this is not currently set up in GN):
* `clang_load`: Absolute path to a dynamic library containing your plugin
* `clang_add_plugin`: tells clang to run a specific PluginASTAction

@ -1,133 +1,152 @@
# Linux-specific build instructions
[TOC]
## Common checkout instructions
## Get the code
[Get the Code](https://www.chromium.org/developers/how-tos/get-the-code). The
general instructions on the "Get the code" page cover basic Linux build setup
and configuration.
This page documents some additional Linux-specific build issues.
This page covers Linux-specific setup and configuration. The
[general checkout
instructions](http://dev.chromium.org/developers/how-tos/get-the-code) cover
installing depot tools and checking out the code via git.
## Overview
Due its complexity, Chromium uses a set of custom tools to check out and build.
Here's an overview of the steps you'll run:
Due its complexity, Chromium uses a set of custom tools to check out and build
rather than configure/make like most projects. You _must_ use gclient and
ninja, and there is no "install" step provided.
1. **gclient**. A checkout involves pulling nearly 100 different SVN
repositories of code. This process is managed with a tool called `gclient`.
1. **GN**. Cross-platform build configuration system. It generates ninja
build files. Running `gn` is analogous to the `./configure` step seen in
most other software.
1. **ninja**. The actual build itself uses `ninja`. A prebuilt binary is in
`depot_tools` and should already be in your path if you followed the steps
to check out Chromium.
1. We don't provide any sort of "install" step.
1. You may want to
[use a chroot](using_a_linux_chroot.md) to
isolate yourself from versioning or packaging conflicts (or to run the
layout tests).
### System requirements
## Getting a checkout
* **64-bits**: x86 builds are not supported on Linux.
* **Memory**: >16GB is highly recommended.
* **Disk space**: Expect a full checkout and build to take nearly 100GB.
* **Distribution**: You should be able to build Chromium on any reasonably modern Linux
distribution, but there are a lot of distributions and we sometimes break
things on one or another. Internally, our development platform has been a
variant of Ubuntu 14.04 (Trusty Tahr); we expect you will have the most
luck on this platform.
[Prerequisites](linux_build_instructions_prerequisites.md): what you need before
you build.
## Software setup
**Note**. If you are working on Chromium OS and already have sources in
`chromiumos/chromium`, you **must** run `chrome_set_ver --runhooks` to set the
correct dependencies. This step is otherwise performed by `gclient` as part of
your checkout.
Non-Ubuntu distributions are not officially supported for building and the
instructions below might be outdated.
## Compilation
### Ubuntu
The "`src/`" directory is an artifact of `gclient`. Start with:
Once you have checked out the code, run
[build/install-build-deps.sh](/build/install-build-deps.sh) The script only
supports current releases as listed on https://wiki.ubuntu.com/Releases.
This script is used to set up the canonical builders, and as such is the most
up to date reference for the required prerequisites.
$ cd src
### Debian
### Faster builds
Follow the Ubuntu instructions above. If you want to install the build-deps
manually, note that the original packages are for Ubuntu. Here are the Debian
equivalents:
See [Linux Faster Builds](linux_faster_builds.md)
* libexpat-dev -> libexpat1-dev
* freetype-dev -> libfreetype6-dev
* libbzip2-dev -> libbz2-dev
* libcupsys2-dev -> libcups2-dev
### Build every test
Additionally, if you're building Chromium components for Android, you'll need to
install the package: lib32z1
$ ninja -C out/Debug
### openSUSE
The above builds all libraries and tests in all components. **It will take
hours.**
For openSUSE 11.0 and later, see
[Linux openSUSE Build Instructions](linux_open_suse_build_instructions.md).
Specifying other target names to restrict the build to just what you're
interested in. To build just the simplest unit test:
### Fedora
$ ninja -C out/Debug base_unittests
Recent systems:
### Clang builds
su -c 'yum install subversion pkgconfig python perl gcc-c++ bison flex \
gperf nss-devel nspr-devel gtk2-devel glib2-devel freetype-devel atk-devel \
pango-devel cairo-devel fontconfig-devel GConf2-devel dbus-devel \
alsa-lib-devel libX11-devel expat-devel bzip2-devel dbus-glib-devel \
elfutils-libelf-devel libjpeg-devel mesa-libGLU-devel libXScrnSaver-devel \
libgnome-keyring-devel cups-devel libXtst-devel libXt-devel pam-devel httpd \
mod_ssl php php-cli wdiff'
Information about building with Clang can be found [here](clang.md).
The msttcorefonts packages can be obtained by following the instructions
present [here](http://www.fedorafaq.org/#installfonts). For the optional
packages:
### Output
* php-cgi is provided by the php-cli package
* wdiff doesn't exist in Fedora repositories, a possible alternative would be
dwdiff
* sun-java6-fonts doesn't exist in Fedora repositories, needs investigating
Executables are written in `src/out/Debug/` for Debug builds, and
`src/out/Release/` for Release builds.
### Arch Linux
### Release mode
Most of these packages are probably already installed since they're often used,
and the parameter --needed ensures that packages up to date are not reinstalled.
Pass `-C out/Release` to the ninja invocation:
sudo pacman -S --needed python perl gcc gcc-libs bison flex gperf pkgconfig \
nss alsa-lib gconf glib2 gtk2 nspr ttf-ms-fonts freetype2 cairo dbus \
libgnome-keyring
$ ninja -C out/Release chrome
For the optional packages on Arch Linux:
### Seeing the commands
* php-cgi is provided with pacman
* wdiff is not in the main repository but dwdiff is. You can get wdiff in
AUR/yaourt
* sun-java6-fonts do not seem to be in main repository or AUR.
If you want to see the actual commands that ninja is invoking, add `-v` to the
ninja invocation.
### Mandriva
$ ninja -v -C out/Debug chrome
urpmi lib64fontconfig-devel lib64alsa2-devel lib64dbus-1-devel \
lib64GConf2-devel lib64freetype6-devel lib64atk1.0-devel lib64gtk+2.0_0-devel \
lib64pango1.0-devel lib64cairo-devel lib64nss-devel lib64nspr-devel g++ python \
perl bison flex subversion gperf
This is useful if, for example, you are debugging gyp changes, or otherwise need
to see what ninja is actually doing.
* msttcorefonts are not available, you will need to build your own (see
instructions, not hard to do, see
[mandriva_msttcorefonts.md](mandriva_msttcorefonts.md)) or use drakfont to
import the fonts from a windows installation
* These packages are for 64 bit, to download the 32 bit packages,
substitute lib64 with lib
* Some of these packages might not be explicitly necessary as they come as
dependencies, there is no harm in including them however.
### Clean builds
### Gentoo
You can clean the build directory (`out/Default` in this example):
emerge www-client/chromium
gn clean out/Default
This will delete all files except a bootstrap ninja file necessary for
recreating the build.
Ninja can also be used to clean a build with `ninja -C out/Debug -t clean` but
this will not be as complete as the above methods.
## Troubleshooting
### Linker Crashes
If, during the final link stage:
LINK(target) out/Debug/chrome
LINK out/Debug/chrome
You get an error like:
```
collect2: ld terminated with signal 6 Aborted terminate called after throwing an
instance of 'std::bad_alloc'
collect2: ld terminated with signal 6 Aborted terminate called after throwing an
instance of 'std::bad_alloc'
collect2: ld terminated with signal 11 [Segmentation fault], core dumped
```
you are probably running out of memory when linking. Try one of:
collect2: ld terminated with signal 11 [Segmentation fault], core dumped
1. Use the `gold` linker
1. Build on a 64-bit computer
1. Build in Release mode (debugging symbols require a lot of memory)
1. Build as shared libraries (note: this build is for developers only, and may
have broken functionality)
you are probably running out of memory when linking. You *must* use a 64-bit
system to build. Try the following build settings (see [GN build
configuration](https://www.chromium.org/developers/gn-build-configuration) for
setting):
Most of these are described on the [Linux Faster Builds](linux_faster_builds.md)
page.
* Build in release mode (debugging symbols require more memory).
`is_debug = false`
* Turn off symbols. `symbol_level = 0`
* Build in component mode (this is for developers only, it will be slower and
may have broken functionality). `is_component_build = true`
## Advanced Features
## More links
* Want to use the (in development) GN build workflow? See
[GN Quick Start](../tools/gn/docs/quick_start.md).
* Building frequently? See [LinuxFasterBuilds](linux_faster_builds.md).
* [Faster builds on Linux](linux_faster_builds.md)
* Information about [building with Clang](clang.md).
* You may want to
[use a chroot](using_a_linux_chroot.md) to
isolate yourself from versioning or packaging conflicts (or to run the
layout tests).
* Cross-compiling for ARM? See [LinuxChromiumArm](linux_chromium_arm.md).
* Want to use Eclipse as your IDE? See
[LinuxEclipseDev](linux_eclipse_dev.md).

@ -1,161 +1,7 @@
# Linux Build Instructions Prerequisites
# Linux Build Instructions Prerequisites
This page describes system requirements for building Chromium on Linux.
The contents of this page have been folded into the
[Linux build instructions](linux_build_instructions.md).
[TOC]
This file will be deleted in the future, please update your links.
## System Requirements
### Linux distribution
You should be able to build Chromium on any reasonably modern Linux
distribution, but there are a lot of distributions and we sometimes break things
on one or another. Internally, our development platform has been a variant of
Ubuntu 14.04 (Trusty Tahr); we expect you will have the most luck on this
platform, although directions for other popular platforms are included below.
### Disk space
It takes about 10GB or so of disk space to check out and build the source tree.
This number grows over time.
### Memory space
It takes about 8GB of swap file to link chromium and its tests. If you get an
out-of-memory error during the final link, you will need to add swap space with
swapon. It's recommended to have at least 4GB of memory available for building a
statically linked debug build. Dynamic linking and/or building a release build
lowers memory requirements. People with less than 8GB of memory may want to not
build tests since they are quite large.
### 64-bit Systems
Chromium can be compiled as either a 32-bit or 64-bit application. Chromium
requires several system libraries to compile and run. While it is possible to
compile and run a 32-bit Chromium on 64-bit Linux, many distributions are
missing the necessary 32-bit libraries, and will result in build or run-time
errors.
### Depot tools
Before setting up the environment, make sure you install the
[depot tools](http://dev.chromium.org/developers/how-tos/depottools) first.
## Software Requirements
### Ubuntu Setup
Run [build/install-build-deps.sh](/build/install-build-deps.sh) The script only
supports current releases as listed on https://wiki.ubuntu.com/Releases.
Building on Linux requires software not usually installed with the
distributions.
The script attempts to automate installing the required software. This script is
used to set up the canonical builders, and as such is the most up to date
reference for the required prerequisites.
### Other distributions
Note: Other distributions are not officially supported for building and the
instructions below might be outdated.
#### Debian Setup
Follow the Ubuntu instructions above.
If you want to install the build-deps manually, note that the original packages
are for Ubuntu. Here are the Debian equivalents:
* libexpat-dev -> libexpat1-dev
* freetype-dev -> libfreetype6-dev
* libbzip2-dev -> libbz2-dev
* libcupsys2-dev -> libcups2-dev
Additionally, if you're building Chromium components for Android, you'll need to
install the package: lib32z1
#### openSUSE Setup
For openSUSE 11.0 and later, see
[Linux openSUSE Build Instructions](linux_open_suse_build_instructions.md).
#### Fedora Setup
Recent systems:
```shell
su -c 'yum install subversion pkgconfig python perl gcc-c++ bison \
flex gperf nss-devel nspr-devel gtk2-devel glib2-devel freetype-devel \
atk-devel pango-devel cairo-devel fontconfig-devel GConf2-devel \
dbus-devel alsa-lib-devel libX11-devel expat-devel bzip2-devel \
dbus-glib-devel elfutils-libelf-devel libjpeg-devel \
mesa-libGLU-devel libXScrnSaver-devel \
libgnome-keyring-devel cups-devel libXtst-devel libXt-devel pam-devel'
```
The msttcorefonts packages can be obtained by following the instructions present
here: http://www.fedorafaq.org/#installfonts
For the optional packages:
* php-cgi is provided by the php-cli package
* wdiff doesn't exist in Fedora repositories, a possible alternative would be
dwdiff
* sun-java6-fonts doesn't exist in Fedora repositories, needs investigating
su -c 'yum install httpd mod_ssl php php-cli wdiff'
#### Arch Linux Setup
Most of these packages are probably already installed since they're often used,
and the parameter --needed ensures that packages up to date are not reinstalled.
```shell
sudo pacman -S --needed python perl gcc gcc-libs bison flex gperf pkgconfig \
nss alsa-lib gconf glib2 gtk2 nspr ttf-ms-fonts freetype2 cairo dbus \
libgnome-keyring
```
For the optional packages on Arch Linux:
* php-cgi is provided with pacman
* wdiff is not in the main repository but dwdiff is. You can get wdiff in
AUR/yaourt
* sun-java6-fonts do not seem to be in main repository or AUR.
For a successful build, add `'remove_webcore_debug_symbols': 1,` to the
variables-object in include.gypi. Tested on 64-bit Arch Linux.
TODO: Figure out how to make it build with the WebCore debug symbols. `make V=1`
can be useful for solving the problem.
#### Mandriva setup
```shell
urpmi lib64fontconfig-devel lib64alsa2-devel lib64dbus-1-devel \
lib64GConf2-devel lib64freetype6-devel lib64atk1.0-devel lib64gtk+2.0_0-devel \
lib64pango1.0-devel lib64cairo-devel lib64nss-devel lib64nspr-devel g++ python \
perl bison flex subversion gperf
```
*** note
Note 1: msttcorefonts are not available, you will need to build your own (see
instructions, not hard to do, see
[mandriva_msttcorefonts.md](mandriva_msttcorefonts.md)) or use drakfont to
import the fonts from a windows installation
***
*** note
Note 2: these packages are for 64 bit, to download the 32 bit packages,
substitute lib64 with lib
***
*** note
Note 3: some of these packages might not be explicitly necessary as they come as
dependencies, there is no harm in including them however.
***
#### Gentoo setup
emerge www-client/chromium

@ -6,6 +6,16 @@ This list is sorted such that the largest speedup is first; see
[TOC]
## General configuration
The [GN build configuration](https://www.chromium.org/developers/gn-build-configuration)
page discusses a number of options that will speed up your build. In particular:
is_component_build = true
enable_nacl = false
symbol_level = 0
remove_webcore_debug_symbols = true
## Use goma
If you work at Google, you can use goma for distributed builds; this is similar
@ -24,70 +34,31 @@ build processes with `-jX` where `X` is the number of processes to start.
central scheduler to share build load. Currently, many external contributors use
it. e.g. Intel, Opera, Samsung.
When you use Icecc, you need to set some gyp variables.
When you use Icecc, you need to [set some GN variables](https://www.chromium.org/developers/gn-build-configuration).
linux_use_bundled_binutils=0**
linux_use_bundled_binutils = false
`-B` option is not supported.
The `-B` option is not supported.
[relevant commit](https://github.com/icecc/icecream/commit/b2ce5b9cc4bd1900f55c3684214e409fa81e7a92)
linux_use_debug_fission=0
linux_use_debug_fission = false
[debug fission](http://gcc.gnu.org/wiki/DebugFission) is not supported.
[bug](https://github.com/icecc/icecream/issues/86)
clang=0
is_clang = false
Icecc doesn't support clang yet.
use_sysroot=0
use_sysroot = false
Icecc doesn't work with sysroot.
linux_use_bundled_gold=0
Using the system linker is necessary when using glibc 2.21 or newer. See
[related bug](https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=808181).
## Build only specific targets
If you specify just the target(s) you want built, the build will only walk that
portion of the dependency graph:
cd $CHROMIUM_ROOT/src
ninja -C out/Debug base_unittests
## Linking
### Dynamically link
We normally statically link everything into one final executable, which produces
enormous (nearly 1gb in debug mode) files. If you dynamically link, you save a
lot of time linking for a bit of time during startup, which is fine especially
when you're in an edit/compile/test cycle.
Add the flag `is_component_build=true` in your build args (to edit build args
run `gn args out/foo` where `out/foo` is your build directory).
See the
[component build page](http://www.chromium.org/developers/how-tos/component-build)
for more information.
### Linking using gold
The experimental "gold" linker is much faster than the standard BFD linker.
On some systems (including Debian experimental, Ubuntu Karmic and beyond), there
exists a `binutils-gold` package. Do not install this version! Having gold as
the default linker is known to break kernel / kernel module builds.
The Chrome tree now includes a binary of gold compiled for x64 Linux. It is used
by default on those systems.
On other systems, to safely install gold, make sure the final binary is named
`ld` and then set `CC/CXX` appropriately, e.g.
`export CC="gcc -B/usr/local/gold/bin"` and similarly for `CXX`. Alternatively,
you can add `/usr/local/gold/bin` to your `PATH` in front of `/usr/bin`.
Previously these instructions listed the linux_use_bundled_gold GYP variable
which no longer exists. If you know about this, please update or delete this
section.
## WebKit

@ -1,5 +1,12 @@
# Windows Build Instructions
## Common checkout instructions
This page covers Windows-specific setup and configuration. The
[general checkout
instructions](http://dev.chromium.org/developers/how-tos/get-the-code) cover
installing depot tools and checking out the code via git.
## Setting up Windows
You must set your Windows system locale to English, or else you may get
@ -13,11 +20,7 @@ supported.
You must have Windows 7 x64 or later. x86 OSs are unsupported.
## Step 1: Getting depot_tools
Get [depot\_tools](http://commondatastorage.googleapis.com/chrome-infra-docs/flat/depot_tools/docs/html/depot_tools_tutorial.html#_setting_up).
## Step 2: Getting the compiler toolchain
## Getting the compiler toolchain
Follow the appropriate path below:
@ -48,8 +51,7 @@ authentication instructions. **Note that you must authenticate with your
@google.com credentials**, not @chromium.org. Enter "0" if asked for a
project-id.
Once you've done this, the toolchain will be installed automatically for
you in Step 3, below (near the end of the step).
Run: `gclient sync` again to download and install the toolchain automatically.
The toolchain will be in `depot_tools\win_toolchain\vs_files\<hash>`, and windbg
can be found in `depot_tools\win_toolchain\vs_files\<hash>\win_sdk\Debuggers`.
@ -57,31 +59,35 @@ can be found in `depot_tools\win_toolchain\vs_files\<hash>\win_sdk\Debuggers`.
If you want the IDE for debugging and editing, you will need to install
it separately, but this is optional and not needed to build Chromium.
## Step 3: Getting the Code
## Using the Visual Studio IDE
Follow the steps to [check out the
code](https://www.chromium.org/developers/how-tos/get-the-code) (largely
`fetch chromium`).
If you want to use the Visual Studio IDE, use the `--ide` command line
argument to `gn gen` when you generate your output directory (as described on
the [get the code](http://dev.chromium.org/developers/how-tos/get-the-code)
page):
## Step 4: Building
Build the target you are interested in.
```shell
ninja -C out\Debug chrome
```gn gen --ide=vs out\Default
devenv out\Default\all.sln
```
Alternative (Graphical user interface): Open a generated .sln
file such as chrome.sln, right-click the chrome project and select build.
This will invoke the real step 4 above. Do not build the whole solution
since that conflicts with ninja's build management and everything will
explode.
Substitute the build directory given to `-C` with `out\Debug_x64` for
[64-bit
builds](https://www.chromium.org/developers/design-documents/64-bit-support)
in GYP, or whatever build directory you have configured if using GN.
GN will produce a file `all.sln` in your build directory. It will internally
use Ninja to compile while still allowing most IDE functions to work (there is
no native Visual Studio compilation mode). If you manually run "gen" again you
will need to resupply this argument, but normally GN will keep the build and
IDE files up-to-date automatically when you build.
### Performance tips
The generated solution will contain several thousand projects and will be very
slow to load. Use the `--filters` argument to restrict generating project files
for only the code you're interested in, although this will also limit what
files appear in the project explorer. A minimal solution that will let you
compile and run Chrome in the IDE but will not show any source files is:
```gn gen --ide=vs --filters=//chrome out\Default```
There are other options for controlling how the solution is generated, run `gn
help gen` for the current documentation.
## Performance tips
1. Have a lot of fast CPU cores and enough RAM to keep them all busy.
(Minimum recommended is 4-8 fast cores and 16-32 GB of RAM)
@ -89,11 +95,9 @@ in GYP, or whatever build directory you have configured if using GN.
antivirus and indexing software.
3. Store the build tree on a fast disk (preferably SSD).
4. If you are primarily going to be doing debug development builds, you
should use the component build:
- for [GYP](https://www.chromium.org/developers/gyp-environment-variables)
set `GYP_DEFINES=component=shared_library`
- for [GN](https://www.chromium.org/developers/gn-build-configuration),
set the build arg `is_component_build = true`.
should use the component build. Set the [build
arg](https://www.chromium.org/developers/gn-build-configuration)
`is_component_build = true`.
This will generate many DLLs and enable incremental linking, which makes
linking **much** faster in Debug.