1 # Linux-specific build instructions
7 [Get the Code](http://dev.chromium.org/developers/how-tos/get-the-code). The
8 general instructions on the "Get the code" page cover basic Linux build setup
11 This page documents some additional Linux-specific build issues.
15 Due its complexity, Chromium uses a set of custom tools to check out and build.
16 Here's an overview of the steps you'll run:
18 1. **gclient**. A checkout involves pulling nearly 100 different SVN
19 repositories of code. This process is managed with a tool called `gclient`.
20 1. **GN** / **gyp**. Cross-platform build configuration systems (GYP is the
21 older one, GN is the one being transitioned to). It generates ninja build
22 files. Running `gn`/`gyp` is analogous to the `./configure` step seen in
24 1. **ninja**. The actual build itself uses `ninja`. A prebuilt binary is in
25 `depot_tools` and should already be in your path if you followed the steps
26 to check out Chromium.
27 1. We don't provide any sort of "install" step.
29 [use a chroot](http://code.google.com/p/chromium/wiki/UsingALinuxChroot) to
30 isolate yourself from versioning or packaging conflicts (or to run the
35 [Prerequisites](linux_build_instructions_prerequisites.md): what you need before
38 **Note**. If you are working on Chromium OS and already have sources in
39 `chromiumos/chromium`, you **must** run `chrome_set_ver --runhooks` to set the
40 correct dependencies. This step is otherwise performed by `gclient` as part of
45 The weird "`src/`" directory is an artifact of `gclient`. Start with:
51 See [Linux Faster Builds](linux_faster_builds.md)
57 The above builds all libraries and tests in all components. **It will take
60 Specifying other target names to restrict the build to just what you're
61 interested in. To build just the simplest unit test:
63 $ ninja -C out/Debug base_unittests
67 Information about building with Clang can be found [here](clang.md).
71 Executables are written in `src/out/Debug/` for Debug builds, and
72 `src/out/Release/` for Release builds.
76 Pass `-C out/Release` to the ninja invocation:
78 $ ninja -C out/Release chrome
80 ### Seeing the commands
82 If you want to see the actual commands that ninja is invoking, add `-v` to the
85 $ ninja -v -C out/Debug chrome
87 This is useful if, for example, you are debugging gyp changes, or otherwise need
88 to see what ninja is actually doing.
92 If you're using GN, you can clean the build directory (`out/Default` in this
97 This will delete all files except a bootstrap ninja file necessary for
100 If you're using GYP, do:
105 Ninja can also be used to clean a build with `ninja -C out/Debug -t clean` but
106 this will not be as complete as the above methods.
110 If, during the final link stage:
112 LINK(target) out/Debug/chrome
114 You get an error like:
117 collect2: ld terminated with signal 6 Aborted terminate called after throwing an
118 instance of 'std::bad_alloc'
120 collect2: ld terminated with signal 11 [Segmentation fault], core dumped
122 you are probably running out of memory when linking. Try one of:
124 1. Use the `gold` linker
125 1. Build on a 64-bit computer
126 1. Build in Release mode (debugging symbols require a lot of memory)
127 1. Build as shared libraries (note: this build is for developers only, and may
128 have broken functionality)
130 Most of these are described on the [Linux Faster Builds](linux_faster_builds.md)
135 * Building frequently? See [LinuxFasterBuilds](linux_faster_builds.md).
136 * Cross-compiling for ARM? See [LinuxChromiumArm](linux_chromium_arm.md).
137 * Want to use Eclipse as your IDE? See
138 [LinuxEclipseDev](linux_eclipse_dev.md).
139 * Built version as Default Browser? See
140 [LinuxDevBuildAsDefaultBrowser](linux_dev_build_as_default_browser.md).
144 If you want to contribute to the effort toward a Chromium-based browser for
145 Linux, please check out the [Linux Development page](linux_development.md) for