轉自:http://121.199.54.6/wordpress/?p=1156html
原始地址:http://www.chromium.org/developers/how-tos/build-instructions-windows#TOC-Building-Chromiumpython
This page has detailed information on building Chromium on Windows, including tips for troubleshooting and for speeding up the build.git
Build environment
Setting up the environment for Visual Studio 2013github
You must have Windows 7 x64 or later. x86 OSs are unsupported.web
If you’re primarily going to be doing debug dev builds, you’ll want to set GYP_DEFINES=component=shared_library, which uses a DLL build and incremental linking, which makes linking much faster in Debug.chrome
No IDE is installed, however windbg is available in depot_tools\win_toolchain\vs2013_files\win8sdk\Debuggers\x86.shell
Details:windows
The toolchain script does not modify the system environment in any way, so can be side-by-side installed with VS2013 or any older versions if desired.api
The toolchain files are stored in depot_tools\win_toolchain\vs2013_files . It is not expected that this toolchain is suitable for building anything other than Chromium and its tools. The contents of that directory are tracked by SHA1.app
If you do a system install of VS2013, you can use it for editing and debugging. ninja will still use the depot_tools version to build. This is preferred as it’s automatically kept up-to-date as build requirements change. If you would like to use your own toolchain to build, you can disable this behavior by setting DEPOT_TOOLS_WIN_TOOLCHAIN=0 in the environment . If you disable the default behavior, you’ll likely need to do some of the steps below in the VS2010 section, at least setting GYP_MSVS_VERSION=2013.
Setting up the environment for Visual Studio 2010
: If you install the SDK in a path different than C:\Program Files (x86)\Windows Kits\8.0 you need to set the following following environment variable:
GYP_DEFINES=windows_sdk_path="path to sdk"
: For Googlers, this patch has already been applied to your SDK, everything should Just Work.
Setting up the environment for building with Visual C++ 2010 Express or Windows 7.1 SDK
echo. > "C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\ammintrin.h"
: If you install the SDK in a path different than C:\Program Files (x86)\Windows Kits\8.0 you need to set the following following environment variable:
GYP_DEFINES=windows_sdk_path="path to sdk"
Index: asyncinfo.h
===================================================================
— asyncinfo.h
+++ asyncinfo.h
@@ -63,7 +63,7 @@
#pragma once
#ifdef __cplusplus
namespace ABI { namespace Windows { namespace Foundation {
-enum class AsyncStatus {
+enum /*class*/ AsyncStatus {
Started = 0,
Completed,
Canceled,
This patch should be applied to the file "Include\winrt\asyncinfo.h" located in your Windows 8 SDK directory. If this patch is not applied, the parts of Chromium that use the Winrt headers will not compile.
: By default the Windows 8 SDK will install to C:\Program Files (x86)\Windows Kits\8.0\. This directory will require admin privileges to write to. Easiest way to do apply this patch is to start an administrative command prompt, cd to C:\Program Files (x86)\Windows Kits\8.0\Include\winrt\, run notepad.exe asyncinfo.h and comment out or delete the word "class" on line 66.
Note: For Googlers, this patch has already been applied to your SDK, everything should Just Work.
WDK_DIR
via Run…->SystemPropertiesAdvanced->Environment Variables…->New…(in System variables), with the name of WDK_DIR and the location you installed the WDK (e.g. C:\WinDDK\7600.16385.1).GYP_MSVS_VERSION=2010e
Automatic simplified toolchain setup
These instructions are deprecated. They are here only for reference if you want to build an old revision.
This method is an automated version of the one above. It installs the compiler, SDKs, and patches automatically, but does not install any IDE.
You can only build with ninja using these steps.
If you have Visual Studio installed, you can still use it to debug, but not to build.
Prerequisite software:
Building Chromium
Then use
ninja to build:
ninja -C out\Debug chrome
(ninja should come with the depot_tools), and run the result:
out\Debug\chrome.exe
Building in Visual Studio
set GYP_GENERATORS=msvs-ninja,ninja
and then
gclient runhooks
to build a wrapper Visual Studio solution that shells to the ninja build to accomplish the actual build. This solution can be useful for browsing.
Building (natively) in Visual Studio
You can attempt to build in Visual Studio. This configuration is untested and definitely does not work to build all of chrome. Some small sub-targets may work. This is also useful just for browsing if you prefer Visual Studio, but generally building does not work.
set GYP_GENERATORS=msvs
set GYP_DEFINES=component=shared_library
gclient runhooks –force
Accelerating the build
Be prepared: the build of whole solution can take hour(s) longer if not configured correctly.
In decreasing order of speedup:
Official/WPO/LTCG build:
To enable whole program optimization / link-time code generation, make sure to set the environment variable:
The WPO configuration settings are defined in
release_impl_official.gypi.
Unit tests Some unit tests (such as gfx_unittests) require at least Vista/2008 with
Platform Update installed or Windows 7 to execute all of the tests completely.
Other tricks
Blog post on setting a right-hand print margin
Running Chromium
The chrome.exe executable can be found at src/out/Debug/chrome.exe or src/out/Release/chrome.exe, depending on the selected build configuration.
Because of Chromium’s unique architecture, there are a number of special challenges associated with development. See Debugging Chromium for more information.
Once you’re comfortable with building Chromium, read the Contributing Code page for information about writing code for Chromium and contributing it.
Packaging If you want to package your build into a zip file, do the following:
cd /path/to/src
./chrome/tools/build/win/make_zip.sh build/Release my-chromium
This will create my-chromium.zip . You can change Release to Debug if you want to zip up the debug build instead.
Installing a built version of Chromium
To install a built version of Chromium, build ‘setup’ and ‘mini_installer’ then run ‘setup.exe':
ninja -C out/Release chrome setup mini_installer
out\Release\setup.exe –chrome –multi-install
Running in Windows 8 mode
In order to switch to Windows 8 mode (‘Relaunch Chrome in Windows 8 mode’ from the Browser menu), you need to have your build version of Chromium installed as described above.
Troubleshooting
Build failures on Vista If you build on Vista, watch out for security issues. Make sure that the folder where you checked out your files is writable for users and not only for admins.
Compilation failures
These are probably only relevant for previous-to-VS2013 toolchains and builds.
Some common things to think about when you have weird compilation failures:
3>c:\program files (x86)\microsoft directx sdk (june 2010)\include\d3d11shader.h(35) : error C2146: syntax error : missing ‘;’ before identifier ‘D3D11_RESOURCE_RETURN_TYPE’
3>c:\program files (x86)\microsoft directx sdk (june 2010)\include\d3d11shader.h(35) : error C4430: missing type specifier – int assumed. Note: C++ does not support default-int
3>c:\program files (x86)\microsoft directx sdk (june 2010)\include\d3d11shader.h(37) : error C2146: syntax error : missing ‘;’ before identifier ‘D3D11_CBUFFER_TYPE’
Then make sure the DirectX headers appear first in the include search path (MSVC|Tools|Options|Projects and Solutions|VC++ Directories). After making the change the retrying the build without clobber should work.
If it still doesn’t work, repeating this process probably won’t help.
Cygwin access control issues
If, while building JavaScriptCore, you see errors like:
3>Error in tempfile() using /tmp/dftables-XXXXXXXX.in: Parent directory (/tmp/) is not writable
3> at /cygdrive/c/b/slave/WEBKIT~1/build/webkit/third_party/JavaScriptCore/pcre/dftables line 236
3>make: *** [chartables.c] Error 255…it’s because the Cygwin installation included in the Chromium source is having trouble mapping the NT ACL to POSIX permissions. This seems to happen when Chromium is checked out into a directory for which Cygwin can’t figure out the permissions in the first place, possibly when the directory is created from within a Cygwin environment before running mkpasswd. Cygwin then imposes its own access control, which is incorrectly restrictive. As a workaround, do one of the following:
- Edit the NT permissions on third_party\cygwin\tmp to allow Modify and Write actions for Everyone and machine\Users. Cygwin is able to figure this out. Or,
- Figure out what went wrong with your checkout and try again – try doing the checkout from cmd instead of from a Cygwin shell, then verify that the permissions aren’t completely blank in your Cygwin installation. Or,
- Bypass Cygwin’s access control (NT’s will still be in effect) by editing webkit\build\JavaScriptCore\prebuild.bat and webkit\build\WebCore\prebuild.bat to include the following line before invoking anything that uses Cygwin:
Note: the nontsec option is not supported in cygwin 1.7 and greater.
- Edit the cygwin file /etc/fstab and add the noacl option
none /cygdrive cygdrive binary,posix=0,user,noacl 0 0
Only one of these solutions should be needed.
Native Client Doesn’t Run
If you get this error when building chrome_nacl_win64:
LINK : fatal error LNK1104: cannot open file ‘atlsd.lib’
It means that you didn’t install the 64-bit compiler and tools as described at the top of the page.
First run of gclient fails to install python
If the first run of gclient produces the error:
svn: Can’t move ‘C:\Users\username\depot_tools\python_bin\tcl\Tix8.4.3\.svn\tmp\entries’ to ‘C:\Users\rhashimoto\depot_tools\python_bin\tcl\Tix8.4.3\.svn\entries': The file or directory is corrupted and unreadable.
… Failed to checkout python automatically.
Please visit http://python.org to download the latest python 2.x client before continuing.
You can also get the "prebacked" version used at http://src.chromium.org/chrome/trunk/tools/third_party/
See
this link for instructions on turning off Windows Indexing.
Manually registering the Platform SDK