|
MacBuildInstructions
Build instructions for Chromium on Mac OS X
Prerequisites
Getting the codeCheck out the source code using the direct svn checkout method if you plan on staying current with the project. As the tarball may not be svn 1.4 compatible, updating it per the instructions probably won't work and you're left with a half-updated tree that doesn't build. Before checking out, go to the waterfall and check that the source tree is open (to avoid pulling a broken tree). The path to the build directory should not contain spaces (e.g. not "~/Mac OS X/chromium"), as this will cause the build to fail. BuildingChromium can be built using several build systems: Xcode 3.6.2 or 4.x with the UI or xcodebuild, make, and ninja. If you can't live without an IDE, use Xcode. Else, use ninja, since it has by far the lowest build times. See instructions for building on Mac using ninja and make. XCode 4See Xcode4Tips for required steps to make it work. Even when using ninja. Using XCode UIThe Xcode project files are generated from GYP files. Running gclient sync will bring the source code up-to-date and will automatically generate the project files. You can also (re-)generate the project files by calling gclient runhooks at any time. To build all of the targets, open ~/chromium/src/build/all.xcodeproj and build the All target. Assuming the waterfall is green, building the All target should not produce any errors and will generate both TestShell and Chromium applications. If you want just the browser, build target chrome. When you work on the browser, you usually open just src/chrome/chrome.xcodeproj, which makes Xcode a bit more responsive that working with all.xcodeproj. If you have problems building, join us in #chromium on irc.freenode.net and ask there. As mentioned above, be sure that the waterfall is green and the tree is open before checking out. This will increase your chances of success. Letting the build not kill your Macxcode will run many ld processes in parallel, each taking > 1 GB of RAM. http://groups.google.com/a/chromium.org/group/chromium-dev/browse_thread/thread/54cf7662fc3ea251/a782d309b03eed79 has instructions on how you can limit the number of ld processes if your machine becomes unresponsive during linking. Do this. (This is not required if you build with ninja or make: They do this automatically.) (An old version of this page also recommended setting PBXNumberOfParallelBuildSubtasks, but as of Chrome r76000 this is no longer necessary. You can run defaults delete com.apple.Xcode PBXNumberOfParallelBuildSubtasks to make sure all your cores are used when building.) Building from the command line with xcodebuildIf want to build from the command line, you almost certainly want to use ninja instead, see above. But it's possible with xcodebuild, too: To build just chrome using the Debug configuration (Release is the other option): cd ~/chromium/src/chrome xcodebuild -project chrome.xcodeproj -configuration Debug -target chrome In addition, to make the build output less spammy and more readable, you can pipe it through build/sanitize-mac-build-log.sh. Faster buildsFull rebuilds are about the same speed in Debug and Release, but linking is a lot faster in Release builds. Run GYP_DEFINES=fastbuild=1 build/gyp_chromium to disable debug symbols altogether, this makes both full rebuilds and linking faster (at the cost of not getting symbolized backtraces in gdb). You might also want to install ccache to speed up the build. RunningAll build output is located in the xcodebuild directory (in the example above, ~/chromium/src/xcodebuild), or out if you use ninja or make. You can find the applications at {Debug|Release}/TestShell.app and {Debug|Release}/Chromium.app, depending on the selected configuration. Unit TestsWe have several unit test targets that build, and tests that run and pass:
When these tests are built, you will find them in the xcodebuild/{Debug|Release} directory. You can run them from the command line. Note that when running from the command line you'll need to specify a full path to the executable, like this: `pwd`/unit_tests CodingAccording to the Chromium style guide code is not allowed to have whitespace on the ends of lines. Xcode loves adding whitespace to the ends of lines which can make editing in Xcode more painful than it should be. The GTM Xcode Plugin adds a preference panel to Xcode that allows you to strip whitespace off of the ends of lines on save. Documentation on how to install it is here. DebuggingGood debugging tips can be found here. ContributingOnce you’re comfortable with building Chromium, check out Contributing Code for information about writing code for Chromium and contributing it. Building on 10.5This is unsupported and currently doesn't work out of the box. If you want to do serious chrome/mac development, you should use 10.6. For debug builds, you need to get a 64-bit linker. This thread describes how. The linker needs to be at least the version of ld bundled with Xcode 3.2.3, else it'll crash when linking unit tests. You need to use the make build, since Xcode 3.1 (the last Xcode supported on 10.5) can't handle how we invoke clang. |
I check out the whole source code, but I could not build it... There are lots of errors.
@Takano Naoki: make sure the tree is open when you do a checkout. If you just want to have a look at the state of things, you can find TestShell? builds here.
Thank you, mavink. Now I can build on my environment ;-)
Is there a way to get around building webkit every time? Could I just install the upstream nightly build and set up xcode to use some of the prebuilt webkit rather than all of the webkit source from chromium? This question applies for the other third party libraries too, like libxslt. I have many of these installed through macports and yet xcode seems to build the chromium-sourced version every time.
"To build all of the targets, open ~/chromium/src/build/all.xcodeproj and build the All target"
There is no all.xcodeproj after a fresh sync.
"To work on TestShell? directly, open src/webkit/tools/test_shell/mac/TestShell?.xcodeproj in XCode and build the TestShell? target."
Nor is there a TestShell?.xcodeproj file....
I have a problem building Chrome. A time.h in chrome is getting included instead of the system one when, in pthread.h (system), I have #include <time.h>
Example: CompileC ../xcodebuild/base.build/Debug/base.build/Objects-normal/i386/prtime.o /Users/filcab/dev/stuff/google/src/base/third_party/nspr/prtime.cc normal i386 c++ com.apple.compilers.gcc.4_2
In file included from /Developer/SDKs/MacOSX10.5.sdk/usr/include/pthread.h:60, ./time.h:213: error: 'time_t' has not been declared ./time.h:214: error: 'time_t' does not name a typeThe time.h that gets included is in src/base/base/time.h
I've posted a pre-built version on my website as well as the build instructions I used. It seems that you have to use "gclient sync" to generate the Xcode project files (all.xcodeproj).
http://www.bluestatic.org/chromium/
Thanks for the link... But even if I follow those instructions, I get the same error... somehow the src/base directory is getting included in the include search path... and time.h is getting ingluded when the system's pthread.h includes <time.h>...
Any clues?
It would be great to have some binary downloadable at some point like Webkit nightly provide.
In Tiger, it won't run ?
Try reading the second section called "Prerequisites." Leopard only.
Hi! I'm having a problem with syncing gclient. The process as I can see in the terminal goes well, but when the files stop downloading there is neither /src/build/all.xcodeproj file, nor src/webkit/tools/test_shell/TestShell?.xcodeproj one. Can anyone help me with this? The waterfall at the moment of syncing was green. Thanks!
Would it be possible to add Sparkle (http://sparkle.andymatuschak.org/) to Chrome so that it is easy for testers to update automatically rather than manually?
Nikita: Do you have a src/chrome/chrome.xcodeproj?
muhammadk: They'll probably use Google Update eventually. That's a lower priority, though.
rsesek: I'm running into the same problems as Nikita, no All.xcodeproj, no chrome.xcodeproj either.
I have tried both downloading and unarchiving the tarball and using gclient to checkout the source code directly. (using SVN 1.5.6, so no issues there either). In both cases, the .xcodeproj files are MIA.
It seems like both .xcodeproj files have been removed from the trunk at some point in the past.
Yep same problem here of course. No All.xcodeproj and no chrome.xcodeproj please advise.
in 2.0.x the all.xcodeproj seems to be replaced by all.gyp. The latest release with the all.xcodeproj is 1.0.145.65. I haven't found a copy of chrome.xcodeproj in any of the sources.
The Xcode projects are generated from the gyp files on checkout. If for some reason that step didn't run for you, you can generate them with 'gclient runhooks --force'
Thanks, I pulled it again normally using gclient. It converted the files. I'm compiling now.
I pulled the source (with a green waterfall), and found no .xcodeproj files. I ran 'gclient runhooks --force', and it gave no output, yet no Xcode projects were made. Am I doing something wrong?
I'm having a similar issue. No .xcodeproj files. The output of gclient runhooks --force is below:
Getting subversion via MacPorts?:
sudo port install subversion
I'm just wondering... why we can't just get a binary file and avoid all the compiling stuff?
@jonatan@bylinebreak.com: you should go to http://www.google.com/chrome
Just in case it confuses someone else, the depot_tools and newly created src directory should be at the same level in your working directory:
After it tried to gclient sync the src tree from Subversion, I came back and re-read the instructions to see what I had done wrong, and only then did I have the ah-ha moment.
I hope this helps someone else, and hope Those In Charge(tm) can update the wiki.
Does the Debug version offer more information about what links a user clicked on or what a user typed into a text field? If so, where can I see this information?
Thanks, Silviu
Note that even Volume labels should not contain spaces! I'd edit the wiki page, but apparently it won't let me now...
It seems that gclient sync work well!
but i have to rename a directory in src to whatever!
Everything with the download/unpacking seemed to go well, and the compilation...but the linking process for me seems to hang on pdfsqueeze (37/241) when trying to build just chrome. I know the entire process should take a while, but it was actually making significant progress until that one (seemingly innocuous) step. I ran the script to limit the number of parallel ld processes, in case that matters. Any thoughts?
I am building Chromium on Mac OS X 10.7 Lion. Although it is not recommended to build it on Mac OS X 10.5, the build scripts always complaining about not founding 10.5 SDK. In addition, when I opened the project files in Xcode, all projects seem to be configured to use 10.5 SDK.
Here is an error message I get when I try to build it from the command line:
BUILD NATIVE TARGET protobuf_full_do_not_use OF PROJECT protobuf WITH CONFIGURATION Release Check dependencies BEROR?error: There is no SDK with the name or path '/Users/elmas/Repository/Research/ParLab??/JavaScript??/chromium/src/chrome/macosx10.5'
BUILD FAILED
@tayfunelmas, see: http://code.google.com/p/chromium/wiki/Xcode4Tips#Lion
Chromium build hangs in a loop:
I stopped the compile process, but bash was still hanging, so had to force-stop this; cannot find anything of shlock, please help!
BUILD AGGREGATE TARGET webkit_system_interface Support OF PROJECT WebCore? WITH CONFIGURATION Release
Check dependencies
PhaseScriptExecution? "Action \"Adjust Visibility\"" "../../../../../xcodebuild/WebCore?.build/Release/webkit_system_interface Support.build/Script-C2FA7E609918094ADF85F31E.sh"
shlock: USAGE: shlock -f file -p pid [-d][-u] /Developer/usr/bin/ld: line 6: -f: command not found /Developer/usr/bin/ld: line 8: [: missing `]' /Developer/usr/bin/ld: line 9: -eq: command not found shlock: USAGE: shlock -f file -p pid [-d][-u] /Developer/usr/bin/ld: line 6: -f: command not found /Developer/usr/bin/ld: line 8: [: missing `]' /Developer/usr/bin/ld: line 9: -eq: command not found … and so on...Chromiun is the best browser but i want to compile it in 64 bits mac os x
1> running 'svn update /Volumes/MacData?/Dependencies/chromium/trunk --non-interactive --accept postpone --ignore-externals' in '/Volumes/MacData?/Dependencies/chromium' 1>Updating 'trunk': 1>At revision 114937. Syncing projects: 50% (1/2), done.k
why always 50percent and run gclient runhooks --force none xcodeproj generate.
ccmatoMacBook-Pro:build xxxx$ GYP_DEFINES='mac_sdk=10.6' gclient runhooks --force .gclient file in parent directory /Volumes/MacData?/Dependencies/chromium/trunk/src might not be the file you want to use c