My favorites | Sign in
Project Home Wiki Issues Source
Search
for
Building  
How to build and test the Dart project
Updated Mar 5, 2012 by jacobr@google.com

Setting up your machine

Follow the instructions in the PreparingYourMachine page.

Building everything

Follow the steps in GettingTheSource to retrieve everything (use all.deps). You will end up with a tree that looks like this:

   dart/
     client/
     compiler/
     corelib/
     language/
     runtime/
     tools/
     ...

Then, from the dart directory use the build.py script under tools/:

$ cd dart
$ ./tools/build.py --arch=ia32

We recommend that you use a local file system at least for the output of the builds. If your code is in some NFS partition, you can link the out directory to a local directory:

$ cd dart/
$ mkdir -p /usr/local/dart-out/
$ ln -s -f /usr/local/dart-out/ out

Testing

All tests are executed using the test.py script under tools/. You can run all tests as follows:

$ ./tools/test.py --arch=ia32 --component=vm,frog,frogium

You can run a specific test by specifying its full name or a prefix. For instance, the following runs only tests from the core libraries:

$ ./tools/test.py --arch=ia32 --component=vm,frog,frogium corelib

The following runs a single test:

$ ./tools/test.py --arch=ia32 --component=vm,frog,frogium corelib/ListTest

Troubleshooting and tips for browser tests

  1. If a test fails, run it again individually, passing also -v --keep_temporary_files.
  2. To probe the test failure with a debugger, grab the URL printed by the test, load it in Chrome, and go at it with Dev Tools.
    • Note: The generated html test is deleted unless you specify --keep_temporary_files when running test.py.
    • Tip: In the Scripts tab's lower left is a "stop sign" icon you can use to break on any exceptions in your test.

Some common problems you might get when running tests for the first time:

  • Some fonts are missing. Chromium tests use DumpRenderTree, which needs some sets of fonts. See LayoutTestsLinux for instructions in how to fix it.
  • No display is set (e.g. running tests from an ssh terminal). DumpRenderTree is a nearly headless browser. Even though it doesn't open any GUI, it still must have an X session available. There are several ways to work around this:
    • Use xvfb:
    • xvfb-run ./tools/test.py --arch=ia32 --component=frogium ...
    • Other options include using ssh X tunneling (ssh -Y), NX, VNC, setting up xhost and exporting the DISPLAY environment variable, or simply running tests locally.

Building the standalone VM

Follow the steps in GettingTheSource to retrieve the standalone VM (use standalone.deps). You will end up with a tree that looks like this:

   dart/
     corelib/
     language/
     runtime/
     standalone.deps/
     tests/
     third_party/
     tools/

Then, from the runtime directory use the build.py script under tools/:

$ cd dart/runtime
$ ../tools/build.py --arch=ia32

We recommend that you use a local file system at least for the output of the builds.

Testing

All tests are executed using the test.py script under tools/. You can run all tests as follows from the runtime directory:

$ ../tools/test.py --arch=ia32 --component=vm

By default the build and test scripts select the debug binaries. You can build and test the release version of the VM by specifying --mode=release or both debug and release by specifying --mode=all on the respective build.py and test.py command lines.

Comment by emrahatilkan, Oct 10, 2011

exciting, waiting.

Comment by jgpru...@gmail.com, Oct 10, 2011

I know this just came out today, but at some point can we PLEASE get a binary distribution? I don't want to spend 2 hours setting up a bunch of dependencies to check this out. Lower the barrier to entry.

Comment by jesper@jesperhansen.net, Oct 10, 2011

It does not currently build with gcc 4.5, if you are on ubuntu, installing gcc 4.4 might work: sudo aptitude install gcc-4.4 g++-4.4 g++-4.4-multilib CXX=g++-4.4 CC=gcc-4.4 ./tools/build.py --arch=ia32

Comment by ric...@gmail.com, Oct 10, 2011

I encountered some java errors building on Lion:

http://pastie.org/2672433

Comment by lyagu...@gmail.com, Oct 10, 2011

Has anybody been able to build it?

This is the error I got on Lion....

$./tools/build.py --arch=ia32

xcodebuild -project dart.xcodeproj -target All -parallelizeTargets -configuration Debug_ia32 SYMROOT=/Developer/dart/dart/xcodebuild
Build settings from command line:
    SYMROOT = /Developer/dart/dart/xcodebuild

=== BUILD AGGREGATE TARGET js2c OF PROJECT v8 WITH CONFIGURATION Debug_ia32 ===
Check dependencies

PhaseScriptExecution "Action \"js2c\"" /Developer/dart/dart/xcodebuild/v8.build/Debug_ia32/js2c.build/Script-65883A0FF6CD34C4B88C9154.sh
    cd /Developer/dart/dart/third_party/v8/tools/gyp
    /bin/sh -c /Developer/dart/dart/xcodebuild/v8.build/Debug_ia32/js2c.build/Script-65883A0FF6CD34C4B88C9154.sh


=== BUILD NATIVE TARGET v8_base OF PROJECT v8 WITH CONFIGURATION Debug_ia32 ===
** BUILD FAILED **
Comment by MLowi...@gmail.com, Oct 10, 2011

http://batsuev.com/2011/10/building-google-dart-on-os-x-lion-with-xcode-4/ - solution for mysterious "BUILD FAILED" on Lion

Comment by vils...@gmail.com, Oct 10, 2011

I created a Linode Ubuntu LTS server and used the following modified commands to successfully get Dart installed. The Chromium information is out of date in the documentation here!

http://pastebin.com/NU8kn4AC

Comment by chrisbuc...@gmail.com, Oct 10, 2011

Building successfully on Ubuntu 11.10, thanks to the comments from jesper@jesperhansen.net above Make sure you have a jdk installed first. http://dartwatch.com/?p=20

Don't forget to take a look in the dart/editor/docs/README.txt for instructions on building and installing the eclipse ide plugin.

Comment by droi...@gmail.com, Oct 10, 2011

I had some trouble building the standalone VM on CentOS 5.7 and had to patch the gyp files:

Index: third_party/jscre/jscre.gypi
===================================================================
--- third_party/jscre/jscre.gypi        (revision 321)
+++ third_party/jscre/jscre.gypi        (working copy)
@@ -4,7 +4,7 @@
   # Needed for compilation with g++ 4.5.
   'conditions': [
     [ 'OS=="linux"', { 'variables' : {
-      'common_gcc_warning_flags': [ '-Wno-conversion-null', ], }, } ],
+      'common_gcc_warning_flags': [  ], }, } ],
   ],
   'includes': [
     '../../../tools/gyp/xcode.gypi',
Index: dart-runtime.gyp
===================================================================
--- dart-runtime.gyp    (revision 321)
+++ dart-runtime.gyp    (working copy)
@@ -3,6 +3,9 @@
 # BSD-style license that can be found in the LICENSE file.

 {
+  'target_defaults': {
+    'cflags!' : [ '-Werror',  ],
+  },
   'includes': [
     'vm/vm.gypi',
     'bin/bin.gypi',

Then I regenerated the project files before attempting to build again:

../tools/generate_projects.py runtime

After the build completed I was able to run the hello world example successfully:

[Debug_ia32]$ ./dart_bin hello.dart
Hello, World!
Comment by krheb...@gmail.com, Oct 10, 2011

when i try to run the test, i am getting bellow message. however build BUILD SUCCEEDED for me in previous steps

./tools/test.py --arch=ia32,dartc,chromium Traceback (most recent call last):

File "./tools/test.py", line 1512, in <module>
sys.exit(Main())
File "./tools/test.py", line 1488, in Main
context):
File "./tools/test.py", line 743, in RunTestCases?
progress = PROGRESS_INDICATORSprogress?(cases_to_run, context)
File "./tools/test.py", line 355, in init
super(MonochromeProgressIndicator?, self).init(cases, context, templates)
File "./tools/test.py", line 292, in init
super(CompactProgressIndicator?, self).init(cases, context)
File "./tools/test.py", line 68, in init
raise Exception(msg)
Exception: Can't find command /Developer/dart/client/tests/drt/DumpRenderTree?.app/Contents/MacOS/DumpRenderTree? (Did you build first? Are you running in the correct directory?)

Comment by JayYoung...@gmail.com, Oct 10, 2011
=== BUILD NATIVE TARGET libdart_vm OF PROJECT dart-runtime WITH CONFIGURATION Debug_x64 ===
CompileC /devel/dart/xcodebuild/dart-runtime.build/Debug_x64/libdart_vm.build/Objects-normal/x86_64/assert.o vm/assert.cc normal x86_64 c++ com.apple.compilers.gcc.4_2
    cd /devel/dart/runtime
    setenv LANG en_US.US-ASCII
    /Developer/usr/bin/gcc-4.2 -x c++ -arch x86_64 -fmessage-length=0 -pipe -Wno-trigraphs -fno-exceptions -fno-rtti -O0 -Werror -Wnon-virtual-dtor -DDEBUG -isysroot /Developer/SDKs/MacOSX10.7.sdk -mmacosx-version-min=10.7 -gdwarf-2 -fvisibility=hidden -fvisibility-inlines-hidden -iquote /devel/dart/xcodebuild/dart-runtime.build/Debug_x64/libdart_vm.build/dart_vm-generated-files.hmap -I/devel/dart/xcodebuild/dart-runtime.build/Debug_x64/libdart_vm.build/dart_vm-own-target-headers.hmap -I/devel/dart/xcodebuild/dart-runtime.build/Debug_x64/libdart_vm.build/dart_vm-all-target-headers.hmap -iquote /devel/dart/xcodebuild/dart-runtime.build/Debug_x64/libdart_vm.build/dart_vm-project-headers.hmap -I/devel/dart/xcodebuild/Debug_x64/include -I. -I/devel/dart/xcodebuild/dart-runtime.build/Debug_x64/libdart_vm.build/DerivedSources/x86_64 -I/devel/dart/xcodebuild/dart-runtime.build/Debug_x64/libdart_vm.build/DerivedSources -Wall -Wextra -Wno-unused-parameter -Wall -Wextra -Wno-unused-parameter -Wtrigraphs -Wall -Wextra -Wno-unused-parameter -Wall -Wextra -Wno-unused-parameter -Wtrigraphs -F/devel/dart/xcodebuild/Debug_x64 -c /devel/dart/runtime/vm/assert.cc -o /devel/dart/xcodebuild/dart-runtime.build/Debug_x64/libdart_vm.build/Objects-normal/x86_64/assert.o


** BUILD FAILED **
Comment by nicolas....@gmail.com, Oct 10, 2011

Hello! Trying to build dart on a MBP5,3 with Lion. I followed the link posted above for solving the SDK problem in 10.7, and now I find myself with the issue that the build script is trying to use the iOS 5 beta SDK version of macosx10.6.

Is there any way to tell it to look for the correct one? I tried dissecting the build.py script but my python-fu is pretty nonexistant :(

Here's the verbose output of the build.py run

~/src/google/dart % ./tools/build.py --arch=x64 --verbose                                                                                                            R1 - 2011-10-11 02:58:58 - triforce
xcodebuild -sdk macosx10.6 -project dart.xcodeproj -target All -parallelizeTargets -configuration Debug_x64 SYMROOT=/Users/nico/src/google/dart/xcodebuild
Build settings from command line:
    SDKROOT = macosx10.6
    SYMROOT = /Users/nico/src/google/dart/xcodebuild

=== BUILD AGGREGATE TARGET js2c OF PROJECT v8 WITH CONFIGURATION Debug_x64 ===
Check dependencies
2011-10-11 02:59:04.701 xcodebuild[12883:1d03] error: Error Domain=NSPOSIXErrorDomain Code=2 "Non-zero exit code 127 returned from shell command: /Developer5/usr/bin/gcc-4.2 -v -E -dM -arch x86_64 -isysroot /Developer5/SDKs/MacOSX10.6.sdk -x c++ -c /dev/null 2>&1" UserInfo=0x4024a4600 {NSLocalizedDescription=Non-zero exit code 127 returned from shell command: /Developer5/usr/bin/gcc-4.2 -v -E -dM -arch x86_64 -isysroot /Developer5/SDKs/MacOSX10.6.sdk -x c++ -c /dev/null 2>&1, NSLocalizedFailureReason=No such file or directory}
2011-10-11 02:59:04.701 xcodebuild[12883:1d03] Warning:  Couldn't discover the 'gcc-4.2' compiler's built-in search paths and preprocessor definitions for language dialect 'c++'.
Compiler: /Developer5/usr/bin/gcc-4.2
Reason:   /Developer5/usr/bin/gcc-4.2 -v -E -dM -arch x86_64 -isysroot /Developer5/SDKs/MacOSX10.6.sdk -x c++ -c /dev/null 2>&1


=== BUILD NATIVE TARGET v8_base OF PROJECT v8 WITH CONFIGURATION Debug_x64 ===
Check dependencies
2011-10-11 02:59:04.840 xcodebuild[12883:3c03] error: Error Domain=NSPOSIXErrorDomain Code=2 "Non-zero exit code 127 returned from shell command: /Developer5/usr/bin/gcc-4.2 -v -E -dM -arch x86_64 -isysroot /Developer5/SDKs/MacOSX10.6.sdk -x c -c /dev/null 2>&1" UserInfo=0x400183fa0 {NSLocalizedDescription=Non-zero exit code 127 returned from shell command: /Developer5/usr/bin/gcc-4.2 -v -E -dM -arch x86_64 -isysroot /Developer5/SDKs/MacOSX10.6.sdk -x c -c /dev/null 2>&1, NSLocalizedFailureReason=No such file or directory}
2011-10-11 02:59:04.841 xcodebuild[12883:3c03] Warning:  Couldn't discover the 'gcc-4.2' compiler's built-in search paths and preprocessor definitions for language dialect 'c'.
Compiler: /Developer5/usr/bin/gcc-4.2
Reason:   /Developer5/usr/bin/gcc-4.2 -v -E -dM -arch x86_64 -isysroot /Developer5/SDKs/MacOSX10.6.sdk -x c -c /dev/null 2>&1
Unsupported compiler 'GCC 4.2' selected for architecture 'x86_64'


=== BUILD AGGREGATE TARGET d8_js2c OF PROJECT d8 WITH CONFIGURATION Debug_x64 ===

=== BUILD NATIVE TARGET v8_nosnapshot OF PROJECT v8 WITH CONFIGURATION Debug_x64 ===

** BUILD FAILED **


The following build commands failed:
	Check dependencies
(1 failure)
BUILD FAILED

Any ideas? Thanks!

Comment by rjkub...@gmail.com, Oct 11, 2011

krheb...They mention the DumpRenderTree? issue and the fix. More clearly, it is that you need these fonts:

sudo apt-get install apache2 wdiff php5-cgi ttf-indic-fonts \

msttcorefonts ttf-dejavu-core ttf-kochi-gothic ttf-kochi-mincho \ ttf-thai-tlwg

Comment by von...@gmail.com, Oct 12, 2011

+1 for binary distro, I want to play with it but don't really want to build it myself!

Comment by godfrey...@gmail.com, Oct 12, 2011

I tried to build in Ubuntu 11.10 following this guild http://dartwatch.com/index.php/2011/10/setting-up-a-dart-build-environment-on-xubuntu-11-04/

but install-build-deps.sh does not support 11.10, I go ahead and do the build anyway and get the following error. Do I have to run this script?

I also do sudo apt-get install gcc-4.4 g++-4.4 g++-4.4-multilib export CXX=g++-4.4 CC=gcc-4.4

Any idea?

./tools/build.py --arch=ia32 make -j 2 BUILDTYPE=Debug_ia32 all

CXX(host) out/Debug_ia32/obj.host/v8_base/third_party/v8/src/ia32/cpu-ia32.o CXX(host) out/Debug_ia32/obj.host/v8_base/third_party/v8/src/ia32/full-codegen-ia32.o
third_party/v8/src/ia32/cpu-ia32.cc: In static member function ‘static void v8::internal::CPU::FlushICache(void, size_t)’: third_party/v8/src/ia32/cpu-ia32.cc:70:3: error: variable ‘qzz_res’ set but not used [-Werror=unused-but-set-variable] third_party/v8/src/ia32/full-codegen-ia32.cc: In member function ‘virtual void v8::internal::FullCodeGenerator?::VisitCompareOperation?(v8::internal::CompareOperation?)’: third_party/v8/src/ia32/full-codegen-ia32.cc:4085:12: error: variable ‘strict’ set but not used [-Werror=unused-but-set-variable] cc1plus: all warnings being treated as errors

make: [out/Debug_ia32/obj.host/v8_base/third_party/v8/src/ia32/cpu-ia32.o] Error 1 make: Waiting for unfinished jobs.... cc1plus: all warnings being treated as errors

make: [out/Debug_ia32/obj.host/v8_base/third_party/v8/src/ia32/full-codegen-ia32.o] Error 1 BUILD FAILED

Comment by TacticalGenius230, Oct 12, 2011

Just wanted to say I've successfully build dart on Debian Unstable. Can't wait to get playing around with it.

Comment by godfrey...@gmail.com, Oct 13, 2011

After I do this Workaround: Remove -Werror from dart/tools/gyp/configurations_make.gypi I can be able to build dart.

Again I am using Kubuntu 11.10 32 bit, and just follow the instructions to build dart. I also build it using gcc-4.6 which comes with 11.10, this time, and works.

Comment by mp6...@gmail.com, Oct 13, 2011

I have successfully built the dart standalone VM on Ubuntu 11.04 using gcc-4.5. I ran all tests with success. I had to install g++-multilib and openssl-dev.

Comment by ccxia...@gmail.com, Oct 15, 2011

I have successfully build art VM on Ubuntu 10.10 using gcc version 4.4.5 (Ubuntu/Linaro 4.4.4-14ubuntu5).

./tools/test.py --arch=ia32,dartc

test passed.

Comment by ccxia...@gmail.com, Oct 15, 2011

./tools/test.py --arch=ia32,dartc,chromium

Failed.

" Exception: Can't find command /Developer/dart/client/tests/drt/DumpRenderTree??.app/Contents/MacOS/DumpRenderTree?? (Did you build first? Are you running in the correct directory?)"

Do I need to checkout the whole Chromium?

Comment by ccxia...@gmail.com, Oct 15, 2011

Follow the link to fix the DumpRenderTree? issue: http://dartwatch.com/index.php/2011/10/setting-up-a-dart-build-environment-on-xubuntu-11-04/

Specificly need the oauth2 id by following the web link generated from this: dart/third_party/gsutil/20110627/gsutil config

Comment by ladi...@gmail.com, Oct 16, 2011

I put my instructions for building Dart on 64-bit Debian testing here: https://gist.github.com/1289466

The single most important thing is -- you DON'T need all those crazy dependencies from Chromium, this install-build-deps.sh script is totally unnecessary!

Comment by clements...@gmail.com, Oct 21, 2011

Running Ubuntu 11.10, installing g++-multilib seemed to make it build after install-build-deps.sh kept crashing.

Comment by longhong...@gmail.com, Oct 25, 2011

Running Ubuntu 11.04, failed to build Dart x64...

Comment by DeShawn.B.Williams, Oct 28, 2011

If your build is failing for Ubuntu try: http://code.google.com/p/dart/issues/detail?id=162#c9

(If your getting the "full-codegen-ia32.o? Error 1 BUILD FAILED" error)

Comment by MikeTGa...@gmail.com, Oct 29, 2011

Binary distro for Windows please. Can't get this to build without errors.

Comment by sunwan...@gmail.com, Nov 12, 2011

openssl missed under windows

Comment by snigdha....@gmail.com, Nov 18, 2011

Trying to run ./tools/test.py --arch=ia32 --component=vm,dartc,chromium from inside dart folder on mac os lion.

Couple of warnings and Traceback and then Exception: Can't find command /dart/client/tests/drt/DumpRenderTree?.app/Contents/MacOS/DumpRenderTree? (Did you build first? Are you running in the correct directory?)

Any solution for this please ???

Comment by cfbai...@gmail.com, Nov 19, 2011

The 99% can't compile the Dart VM. Google, work faster and let us in! :)

Comment by kisst...@gmail.com, Jan 31, 2012

Trying to run the build.py on my win32 machine and get: WindowsError?: 3? The system cannot find the path specified

in the subprocess.py

What dependencies have I missed?


Sign in to add a comment
Powered by Google Project Hosting