Chromiumソースのコンパイル


LinuxBuildInstructions  
Build instructions for Linux 
Linux
Updated 
Jan 30, 2012 by  [email protected]

Overview


Due mostly to its history and its complexity, Chromium uses a nonstandard set of custom tools to check out and build. Here's an overview of the steps you'll run:
gclient. A checkout involves pulling nearly 100 different SVN repositories of code. This process is managed with a tool called gclient.
gyp. The cross-platform build configuration system is called gyp, and on Linux it generates Makefiles. Running gyp is analogous to the./configure step seen in most other software.
make. The actual build itself uses GNU make.
We don't provide any sort of "install"step.

Getting a checkout


Prerequisites: what you need before you build
Get the Code: check out the source code
Linux users often prefer to use Git. We have a page on how to check out the main tree with Git, but note that you still will need to understand and run all of gclient and gyp anyway.

First Time Build Bootstrap


Make sure your dependencies are up to date by running the install-build-deps.sh script:
.../chromium/src  $ ./build/install-build-deps.sh 

Configuring


After gclient sync finishes, it will run gyp automatically to generate the Makefiles. You can re-run gyp yourself as build/gyp_chromium.
gyp supports a minimal amount of build configuration via the -D flag.
./build/gyp_chromium -Dflag1=value1 -Dflag2=value2

gcc warnings. By default we fail to build if there are any compiler warnings. If you're getting warnings, can't build because of that, but just want to get things done, you can specify -Dwerror= to turn that off.
ChromeOS. -Dchromeos=1 builds the ChromeOS version of Chrome. This is not all of ChromeOS (see the ChromiumOS page for full build instructions), this is just the slightly tweaked version of the browser that runs on that system. Its not designed to be run outside of ChromeOS and some features won't work, but compiling on your Linux desktop can be useful for certain types of development and testing.

Compilation


The weird "src/"directory is an artifact of gclient. Start with:
$ cd src

Build just chrome

$ make chrome

Faster builds


To do a parallel build, add -jX where X is the number of make processes to start up. This is useful for multiple-core machines or machines using distcc.

Build every tests

$ make

The above builds all libraries and tests in all components. It will take hours.
Specifying other target names to restrict the build to just what you're interested in. To build just the simplest unit test:
$ make base_unittests

Or you can specify the explicit file you want to build:
$ make out/Debug/chrome

GCC 4.6 is not supported yet. You may run into some build errors (and patches are welcome to fix them). Please see http://crbug.com/80071before you proceed.

Clang builds


Information about building with Clang can be found here.

Output


Executables are written in src/out/Debug/ for Debug builds, and src/out/Release/ for Release builds.

Release mode


Add BUILDTYPE=Release to the make invocation:
$ make BUILDTYPE=Release

Seeing the commands


If you want to see the actual commands that make is invoking, add V=1 to the make invocation.
$ make V=1

This is useful if, for example, you are debugging gyp changes, or otherwise need to see what make is actually doing.

Clean builds


All built files are put into the out/ directory, so to start over with a clean build, just:
rm -rf out

Troubleshooting


If you see make: *** No targets specified and no makefile found. Stop., you probably need to run gyp again. See the "Configuring"steps above.

Linker Crashes


If, during the final link stage:
  LINK(target) 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 11 [Segmentation fault], core dumped 

you are probably running out of memory when linking. Try one of:
Use the gold linker
Build on a 64-bit computer
Build in Release mode (debugging symbols require a lot of memory)
Build as shared libraries (note: this build is for developers only, and may have broken functionality)
Most of these are described on the  LinuxFasterBuilds page.

Advanced Features


Building frequently? See LinuxFasterBuilds.
Cross-compiling for ARM? See LinuxChromiumArm.
Want to use Eclipse as your IDE? See LinuxEclipseDev.

Next Steps


If you want to contribute to the effort toward a Chromium-based browser for Linux, please check out the Linux Development page for more information.