I was eventually able to get a Dart enabled version of Chrome, affectionately known as "Dartium", working. For the most part, I followed the build instructions.
I did make one mistake—I skipped the step to configure "gyp" (Generate Your Project). Instead, I moved right along to grabbing the
gclient setup (manages SCM):~/repos $ mkdir dartium
~/repos $ cd !$
cd dartium
~/repos/dartium $ gclient config https://dart.googlecode.com/svn/branches/bleeding_edge/deps/dartium.deps
~/repos/dartium $ cat .gclient
solutions = [
{ "name" : "dartium.deps",
"url" : "https://dart.googlecode.com/svn/branches/bleeding_edge/deps/dartium.deps",
"deps_file" : "DEPS",
"managed" : True,
"custom_deps" : {
},
"safesync_url": "",
},
]And then attempted to sync up the various source repositories:~/repos/dartium $ gclient sync >________ running 'svn checkout https://dart.googlecode.com/svn/branches/bleeding_edge/deps/dartium.deps /home/cstrom/repos/dartium/dartium.deps --non-interactive --ignore-externals' in '/home/cstrom/repos/dartium' 1>A /home/cstrom/repos/dartium/dartium.deps/DEPS 1>Checked out revision 2877. 1>Syncing projects: 0% ( 0/ 3) 2>________ running 'svn checkout http://src.chromium.org/svn/trunk/src@115697 /home/cstrom/repos/dartium/src --revision 115697 --non-interactive --ignore-externals' in '/home/cstrom/repos/dartium' 2>A /home/cstrom/repos/dartium/src/media ...Nine hours and 7.5GB later, it finally completed. Then I attempted to build the darn thing. It compiled for a long while, but ultimately failed:
~/repos/dartium/src $ ./dartium_tools/build.py --mode=Release
['make', '-j8', 'BUILDTYPE=Release', 'dart', 'test_shell', 'DumpRenderTree', 'chrome']
CXX(target) out/Release/obj.target/libdart/dart/runtime/vm/dart_api_impl.o
CXX(target) out/Release/obj.target/libdart/dart/runtime/vm/debugger_api_impl.o
ACTION Generating /home/cstrom/repos/dartium/src/out/Release/obj/gen/builtin_gen.cc file. out/Release/obj/gen/builtin_gen.cc
....
CXX(target) out/Release/obj.target/webcore_remaining/third_party/WebKit/Source/WebCore/bindings/v8/custom/V8HTMLFrameElementCustom.o
CXX(target) out/Release/obj.target/webcore_remaining/third_party/WebKit/Source/WebCore/bindings/v8/custom/V8HTMLFrameSetElementCustom.o
make: *** [out/Release/obj.target/webcore_bindings/gen/webkit/bindings/DartDerivedSourcesAll.o] Error 1
make: *** Waiting for unfinished jobs....
Traceback (most recent call last):
File "./dartium_tools/build.py", line 66, in <module>
main()
File "./dartium_tools/build.py", line 63, in main
[target for (target, _) in targets])
File "/home/cstrom/repos/dartium/src/dartium_tools/utils.py", line 97, in runCommand
raise Exception('Failed to run command. return code=%s' % p.returncode)
Exception: Failed to run command. return code=2
I tried recompiling to no avail. Ultimately, I did realize that I had neglected to configure "gyp", so I created $HOME/.gyp/include.gypi:{
'variables': {
'target_arch': 'ia32',
'clang_use_chrome_plugins': 0,
}
}The Chrome/Dartium build does not have a "make distclean", so I used svn status to identify generated code:~/repos/dartium/src $ svn status ? dartium_tools ? dart ? media/cpu_features.target.mk ? media/tile_render_bench.target.mk ? media/yuv_convert_simd_arm.target.mk ? media/yuv_convert_simd_x86.target.mk ? media/yuv_convert.target.mk ? remoting/remoting_jingle_glue.target.mk ? remoting/remoting_simple_host.target.mk ...I then deleted it all in the hopes that I might get back to a pristine codebase (or at least pristine enough). In particular, I removed anything that ended with ".mk" or ".makefile":
~/repos/dartium/src $ find . -name *.mk -exec rm {} \; -print
find . -name *.Makefile -exec rm {} \; -printI also got rid of those seemingly generated dart thingies:rm -rf dartium_tools dartWith that, I re-ran
gclient sync and re-compiled:~/repos/dartium/src $ ~/repos/dartium/src $ ./dartium_tools/build.py --mode=Release ['make', '-j8', 'BUILDTYPE=Release', 'dart', 'test_shell', 'DumpRenderTree', 'chrome'] make: Nothing to be done for `dart'. ACTION Extracting last change to /home/cstrom/repos/dartium/src/out/Release/obj/gen/build/LASTCHANGE out/Release/obj/gen/build/LASTCHANGE.always RULE dart_generated_sources_dart_binding_356 out/Release/obj/gen/webcore/bindings/DartDOMWindowWebAudio.cpp RULE dart_generated_sources_dart_binding_366 out/Release/obj/gen/webcore/bindings/DartDOMWindowWebSocket.cpp AR(target) out/Release/obj.target/content/libcontent_renderer.a .... CXX(target) out/Release/obj.target/DumpRenderTree/third_party/WebKit/Tools/DumpRenderTree/chromium/WebPreferences.o CXX(target) out/Release/obj.target/DumpRenderTree/third_party/WebKit/Tools/DumpRenderTree/chromium/WebViewHost.o CXX(target) out/Release/obj.target/DumpRenderTree/third_party/WebKit/Source/WebKit/chromium/src/WebTestingSupport.o LINK(target) out/Release/chrome LINK(target) out/Release/test_shell LINK(target) out/Release/DumpRenderTree /usr/bin/ld: skipping incompatible /lib/libdbus-1.so when searching for -ldbus-1 /usr/bin/ld: skipping incompatible /lib/libgcrypt.so when searching for -lgcrypt /usr/bin/ld: skipping incompatible /lib/libgcrypt.a when searching for -lgcrypt LINK(target) out/Release/chrome: Finished /usr/bin/ld: skipping incompatible /lib/libdbus-1.so when searching for -ldbus-1 /usr/bin/ld: skipping incompatible /lib/libgcrypt.so when searching for -lgcrypt /usr/bin/ld: skipping incompatible /lib/libgcrypt.a when searching for -lgcrypt LINK(target) out/Release/test_shell: Finished /usr/bin/ld: skipping incompatible /lib/libdbus-1.so when searching for -ldbus-1 /usr/bin/ld: skipping incompatible /lib/libgcrypt.so when searching for -lgcrypt /usr/bin/ld: skipping incompatible /lib/libgcrypt.a when searching for -lgcrypt LINK(target) out/Release/DumpRenderTree: FinishedI am uncertain what the "incompatible" messages mean, but compilation completed successfully and I am able to run Dartium:
That is not all that exciting. It is just another Chrome / Chromium browser (that's soooooo 2011!). But hopefully I can throw some
<script type="application/dart"> at it. So I load up "dart.html", which I take from the build instructions:<html>
<body>
<script type="application/dart">
#import('dart:dom');
void main() {
final element = window.document.createElement('div');
element.innerHTML = 'Hello from Dart';
window.document.body.appendChild(element);
}
</script>
</body>
</html>
Only to find a very blank page:Oh no! Have I downloaded and compiled and re-downloaded and re-compiled for over 24 hours to no avail?!
Mercifully, a member of the Dart team posted the secret in a comment to the build instructions. Current Dartium needs some Javascript on the page before Dart interpretation will start (this is a very much a early stage build):
<html>
<script>{}</script>
<body>
<script type="application/dart">
#import('dart:dom');
void main() {
final element = window.document.createElement('div');
element.innerHTML = 'Hello from Dart';
window.document.body.appendChild(element);
}
</script>
</body>
</html>With that, I finally have Dart code executing in a browser environment:That was an adventure, but a necessary one. I cannot write a book on a web language without being able to demonstrate it in a browser. That is a good place to call it a night. Up tomorrow: back to exploring the language again. Unless something else strikes my fancy (or someone has a suggestion), I may play with a built-in feature like Futures.
Day #253



"script" {} "/script" (google doesn't let me post code in comments, :/)
ReplyDeleteThat would irk me, early stage build or not.
Bah! I just spent 24+ hours compiling the thing. I'm perfectly happy to pay a minor JS evaluation penalty :P
ReplyDelete