How to compile Google Chrome with Visual C++ 2008 Express Edition

08Nov09

Despite numerous reports of failed attempts, I was able to compile and run the Google Chrome browser code using Visual C++ 2008 Express Edition.

Here is my recipe :

1. Install Visual C++ 2008 Express Edition with SP1.

2. To be on par with the official Chrome Windows build instructions, you need to install the following patches:

Mandatory:

  1. KB967631
  2. KB960075
  3. and KB957912

Optional:

  1. KB956420
  2. and KB958357

3. Install the Microsoft Windows 7 SDK.

4. Install the Windows Driver Kit (WDK) Version 7.0.0 which contains the ATL 7.1 headers.

Note: Earlier versions of the WDK will work too (e.g. I used WDK 6001.18002). The important thing is to get the ATL headers.

5. Register the Windows SDK with Visual C++ 2008 Express.

6. Add the ATL 7.1 include directory (e.g. C:\WinDDK\6001.18002\inc\crt\atl71) to Visual C++ 2008 Express.

7. Apply this patch to atlstdthunk.h found under the ATL 7.1 include directory. See here for the rationale.

8. Get the Google Chrome source code by following these instructions.

9. Apply this patch to your Chrome source tree. This will remove the “Treat Warnings As Errors” directive (i.e. /WX) from the following projects: browser, browser_tests_dll, chrome, plugin_tests, unit_tests, views and disable incremental linking (i.e. /INCREMENTAL:NO) from the sync_unit_tests project.

10. Set GYP_MSVS_VERSION=2008e in your environment variables and run gclient runhooks ––force after this change to regenerate your solution file (.sln).

11. Open the chrome/chrome.sln solution file in Visual C++ 2008 Express. When all projects are loaded, you will get a dialog with the following message: “Some of the properties associated with the solution could not be read“. Click “Ok” to dismiss it.

12. Start building the solution and go to sleep. Seriously if you didn’t buy your PC in the last 1-2 years and have less than 2GB of RAM, expect the compilation to take the night. The official build instructions talk about “10 minutes to 2 hours. More likely 1 hour” but on my P4 2.80GHz with 1GB it took way mooooore time. I’ve since upgraded to 4GB of RAM and it is much more bearable. 🙂

13. You should end up with a fatal error LNK1104 in the mini_installer project but this should not bother unless you want to hack in this particular project. Now select the chrome project as the starting project, cross your fingers and press F5.

chrome_alive

It's alive!!

Note that your mileage may vary. Do not hesitate to contact me if you have problems, I will see what I can do. Also let me know if some of the steps are wrong or missing.

Happy Chrome hacking!

Share



32 Responses to “How to compile Google Chrome with Visual C++ 2008 Express Edition”

  1. 1 Jocko

    When I try and install KB958842, I get a message “None of the products that are addressed by this software update are installed on this computer. Click Cancel to exit the setup.” I’m just going to skip this one and hope the build still works.

    • 2 Dominic Jodoin

      Hey Jocko!

      You are correct, this was an error from my part where I did a copy-paste of the required hotfixes from Chromium website and forgot to delete those that where not applicable to VC++ Express.

      I have updated my post to reflect you findings. Note that I also added a patch that modifies some GYP files in such a way that you won’t have to manually “play” with the project settings in order to compile without errors.

      Thank you very much for your feedback.

  2. 3 PhistucK

    OK, so I am trying with Visual C++ 2005 Express. After working around most of the errors, I got one left.
    fatal error LNK1104: cannot open file ‘atl.lib’ chrome_dll

    The last error that I resolved before that, was almost the same, but “atlz” instead of “atl” in the file name.
    So I went to the chrome_dll properties and chose to dynamically link ATL and it worked. But then I got the above error and I am at a lost.

    Any ideas?

  3. Hello Dominic, thnks for posting this guide. It worked quite well for me. I have installed this on pretty clean Vista laptop. Everything went more or less straightforward, but I got few troubles, which were more or less trivial. Compilation took several hours on my laptop (2ghz core2duo, 4gig ram). Problems I got were related to patch not working, and PATH variable, I have described it in more details here: http://www.nextpoint.se/?p=182. Thanks for making this guide, it is really great help.

    • 5 Dominic Jodoin

      Thanks arthur! Glad you were able to compile with not too much hassle. 🙂

  4. 6 Andykn

    How do you “Add the ATL 7.1 include directory (e.g. C:\WinDDK\6001.18002\inc\crt\atl71) to Visual C++ 2008 Express”? The “Help” doesn’t.

    And how do you apply the patches to atlstdthunk.h and the chromium source tree?

    • 7 Dominic Jodoin

      Hey Andykn!

      1. To add ATL 7.1 include directory to VC++ Express, you need to goto Tools -> Options… -> Projects and Solutions -> VC++ Directories -> Show directories for: Includes Files and add it there.
      2. I would suggest you to use TortoiseSVN’s nifty Apply Patch context menu item by right-clicking the src directory of the Chromium source tree. Another option is GNU Patch for Windows.

      Do not hesitate to contact me again if you still have problems.

  5. 8 Sourajit Basak

    I am unsure of the branding of Microsoft’s C++ development tools. I installed something that says “Microsoft Developer Studio 4.20.x” and the Additional Information section shows Visual C++ 4.0 Enterprise Edition. Unfortunately I cannot attach the version information in this post. Is it the same when you mention Visual C++ 2008 Express Edition ?

  6. 10 Angler

    I try to Compile Chrome with visual Studio 2005 On Windows 7,but the results are lots of errors. My question is whether chrome can be compiled on Windows 7。

  7. Great post. Thanks!
    Will contact you if I run into any issues.

    • 13 Dominic Jodoin

      Sounds good divya! Please take note that some of the patches are not up to date as Chrome’s source code layout has changed since when I wrote this post. I hope to get around fixing it someday… Cheers!

      • Yeah I noticed that. I dint apply your patch, but all I did was added the line to disable “Treat Warning As Errors” in release_impl_official.gypi. That did the trick, but some nacl related projects did not inherit the setting. All other projects did. Is there no global location to make the setting for the entire solution? Also, why do you turn off incremental linking?

      • 15 Dominic Jodoin

        Not sure if there is a global location for this.

        At the time, only the sync_unit_tests project needed to have incremental linking disabled else it wouldn’t link.

  8. 16 Howard B

    Just a quick note to mention that even adding the extra line to release_impl_official.gypi wasn’t quite enough. I had to manually change the build config of default_plugin as well to disable this setting. Butonce that was done, I managed to get a successful build. Thanks for all the help, Dominic and everyone else!

  9. 17 Luis

    Hi Dominic,

    I just compile with Windows Vista Desktop Standard Edition.

    Processor: AMD Antlon ™ 64 Processor
    3800t 2. 40ghz

    Memory Ram : 1.00GB

    System type: 32 Bit operating System

    Gotta love it! Great job with this post thank you and please don’t ever take down. You made it possible for me to compile when others said that it was not possible.

    only one problem being new to C++ took me 2 days to figure out how to register sdk with c++ found the answer in the original directions:

    Manually registering the Platform SDK

    Open Visual Studio, Tools > Options… > Projects and Solutions > VC++ Directories

    Assuming your base SDK directory is C:\Program Files\Microsoft SDKs\Windows\v7.0, remove any existing entries v6.0 and v6.1 and add the following:

    In Executable Files, insert on top C:\Program Files\Microsoft SDKs\Windows\v7.0\bin

    In Include Files, insert on top C:\Program Files\Microsoft SDKs\Windows\v7.0\Include and C:\Program Files\Microsoft SDKs\Windows\v7.0\Include\gl

    In Library Files, insert on top C:\Program Files\Microsoft SDKs\Windows\v7.0\lib

    In Exclude directories, insert on top C:\Program Files\Microsoft
    SDKs\Windows\v7.0\Include and C:\Program Files\Microsoft SDKs\Windows\v7.0\Include\gl

    • 18 Dominic Jodoin

      Hey Luis!

      What a great way to start the New Year!!

      Thanks for the additional info on how to register the sdk with Visual Studio.

      Cheers!

  10. 19 Utpal Kumar

    I am getting the following error while building sel project (\chromium\src\native_client\src\trusted\service_runtime)
    fatal error C1083: Cannot open compiler intermediate file: ‘G:\Temp1\_CL_14491f7bin’: Permission denied

    Here G:\Temp1 is the path specified in the TMP environment variable.

    Do I have to have to apply any more hotfixes? Please help

    • 20 Utpal Kumar

      I finally managed to solve the issue. It was because of AVG antivirus. Removing it solved the issue.

  11. 21 Dave

    Dominic, I tried to apply the chrome.gyp patch but TortoiseMerge is telling me there are unresolved conflicts. I’m not sure what to do. Views.gyp seems to be fine. Any advice?

    Dave

    • 22 Dominic Jodoin

      Hey Dave!

      Sorry for the delay. What happen is that Chrome’s source code is really moving fast and my patch is now out of sync.

      You can try to follow Divya’s workaround which should do the same.

      Good luck!

  12. Thanks for this. Finding the google doc to be a bit.. hard to read and lacking. I mistakenly thought the Windows DDK was the Windows SDK (I thought they renamed it to Windows SDK?! so confusing).
    I had almost given up. Cheers =)

  13. Hi All,

    After downloading the source code “chrome.sln” is missing for getting that external file i am using the command “gclient sync” from the chrome source extracted folder. But i am getting following error. Can any one help me to resolve this .

    Thanks in advance

    [-] XMLHTTP 80072ee7: Cannot make HTTP request (The server name or address could
    not be resolved

    … Failed to checkout svn automatically.
    Please visit http://subversion.tigris.org to download the latest subversion clie
    nt
    before continuing.
    You can also get the “prebacked” version used at http://src.chromium.org/svn/tru
    nk/tools/third_party/

  14. Hi Dominic,

    I resolved the above error. Even after following build instruction, i got this error so,i started investigating on gclient tool. and i found “it is an issue with AJAX object”.

    I am having WindowsXP with SP3 environment. In this configuration it is trying to create an ajax object with “MSXML2.ServerXMLHTTP” (this is not there in my browser/system). So, I replaced this with “Microsoft.XMLHTTP” object.

    I did a modification in the file “depot_tools\bootstrap\win\get_file.js”.

    Instead of
    “xml_http = new ActiveXObject(“MSXML2.ServerXMLHTTP”);”
    changed to
    “xml_http = new ActiveXObject(“Microsoft.XMLHTTP”);”

    Now it is working fine for me.

    I thank you for support.and this post.

    • 27 Dominic Jodoin

      Great work Stephen!

      Thanks for sharing your solution.

  15. Thank you very much. After tinkering here and there for 9 months, today I finally compiled and executed my first successfull Chromium.exe browser using this guide and a few others (mainly atl header edits), in VS 2008 Express!

  16. 29 hercules

    why not make a video about this?


  1. 1 Tweets that mention How to compile Google Chrome with Visual C++ 2008 Express Edition « Coding On The Shoulders Of Giants -- Topsy.com
  2. 2 uberVU - social comments
  3. 3 BreakPoint » Chromium compiles with VS Express

Leave a reply to divya Cancel reply