Monday, January 16, 2012

Dart VM Install?.... Yes!

Firstly, allow me to comment that I have been corrected in how Dartboard works. In my post That's a Type of what?, I made mention that I believed that the Dartboard sends code to the server and is executed in the DartVM and the results are displayed back. I have found out that this is incorrect and in actuality the code is sent to the server which is compiled into JavaScript and then sent back to be executed client side. This is what results in the type confusions.

So to circumvent this confusion going forward I am going to work on today on downloading and compiling the dart VM. I will keep information throughout the day on how this process goes and any issues I may run into.
  • Step one: Install the the 32-bit libraries on my 64-bit machine. Following the automated setup instructions (very handy I might add). Running the install-build-deps.sh script is pretty quick and extremely handy. Though the initial question about installing the debugging symbols is a little poorly worded. I wasn't sure if I was being prompted to install the debugging symbols or all the packages. Hitting "N" I receive the message that it will not install the debugging symbols and starts to proceed with the installation of other packages (after asking me for a sudo password).
  • Step one (b): I'm prompted if I want to install the gold linker, which is apparently 5x faster than regular ld.. yeah sure why not. Lots of building and such occurs. No errors encountered that I notice. I wonder will the system detect this is installed automatically or will I have to pass that as an optional parameter myself? We'll see..
  • Step one (c): I'm prompted if I want to install the 32-bit dev libraries to build a 32-bit chrome on a 64-bit system that it will need to download a large number of debs then will extract the files it requires, create new debs and install them (and, one assumes, will remove the larger and more numerous original debs)... wait I thought this is what I was doing already anyways? Re-reading the Preparing Your Machine wiki again says that you may need to install the 32-bit libraries on a 64-bit system. Better hit yes just to be on the safe side
  • Righty, all done that... I notice it left a binutils-2.21.1 directory there... might need to get rid of that later. On to the next part, check out the code. Copy and paste.... and done. And export the path.. Oo no compiling this time yay.
  • Okay, now onto Getting the Source. Now I'm stuck with a choice... do I get 'everything' or do I get the standalone VM? I already have the Dart Editor installed. A little confused as to what additional packages there are to install. Does this install Dartium too? I kinda assume frogc was part of the VM package... well I've got a fair bit of space to install... might as well go ahead and do 'everything', to save me from having to come back and look for them after the fact if I did decide I wanted something else.
  • gclient sync ran into an issue... exited with a non-zero status code. I see a notice that I can't download DumpRenderTree. I'm advised to run a script gsutil config... yeah okay. Enter in the authorization code... blank project-id.. Okay done now...? Well lets try running gclient sync again. Uhm... ends saying Syncing projects: 85% done. I dunno did this work or not? Well only one way to find out. Time to try and build.
  • Building everything: Alright... into the dart directory and run the build... odd that I have to specify my arch as a 32 bit system. A quick groups search shows me that the 64-bit system isn't yet implemented. Hopefully that will change in the future, particularly as server side code starts rolling out. Looks like this may take a while. So I'm going to grab some lunch. -- Back from lunch and it appears that the build failed. Getting an error "Unable to locate tools.jar. Expected to find it in /usr/lib/jvm/java-6-openjdk/lib/tools.jar" A quick google search shows I'm missing the openjdk-6-jdk package. I look where it expected to find the file and it only shows jre directory and such no lib directory. Quick apt-get install openjdk-6-jdk installs this for me. I double check and the file is where it expects. Still... odd though that it wasn't detected with the build deps.
    And bang, another error... This one a little more complex. Lots of information on the screen but it really boils down to this line: "runtime/vm/dart_api_impl_test.cc:1432:15: error: variable ‘result’ set but not used [-Werror=unused-but-set-variable]" Doing some looking around I see a few similar errors though not specifically that file/line. I double check the file and see the declaration and assignment to that variable but not used after that. Not passed or returned apparently. Odd. I double check the source online in both trunk and bleeding_edge. Both are showing the same thing. Looks like I have resort to the work around. I know right away that the work around will fix that error as the work around makes warnings just warnings and stops them from being errors. The work around is comment 8 as seen here.
  • Building has finished apparently, though I can't seem to see the Dartium build in there anywhere. But in anycase lets start with the testing... Oh look an error doesn't like the Chromium testing. Okay we'll just drop that part. Progressing VERY slowly for these tests. A few of them have timed out so far, haven't reached the results yet. Starting to think about if I really need the "All" option. Doesn't appear to have compiled the editor either (which isn't a big deal since I already have that downloaded from the dartlang page anyways.)
  • Eventually my tests finally complete (well over an hour). And I, for reasons I'm still not 100% sure of, decide in my infinite wisdom, decide "No, I only want the standalone VM". So I remove all the sources and start basically from the beginning. First I check out the "standalone.deps" and sync.
  • Now to build again. This time however I also make note to build as a release instead of as debug which is the default. Now to go through the similar steps to build (such as disabling warnings as errors on the compiler). Build is pretty quick. Now tests... wow much faster as well. None time out this time either.
Alright, so now that I have that downloaded and compiled lets give it a try right quick. Yep a simple "hello world" works exactly as expected from the command line. However when I try to run a test in the Dart Editor it just wants to compile it doesn't want to use the VM even after specifying the path.

Upon investigation I do see that there is a new Dart editor release available. I was previously using 3101. Latest build number shows 3331. I try downloading the latest stable release and sure enough it's the 3331 release. One really nice enhancement is that it allows you to decide when making an app if the application type is Web or a script. Choosing script, and having the VM path set automatically runs the examples in the console as well! Success!

In addition. Running the small little script from my previous post gives the following results:
true
true
false
false
false
false

Exactly what we would expect to see. Phew. So now as I progress learning the language I can use the dart VM directly as opposed to running in dartboard all the time. Should help my work flow as well.

Current I only have the dart VM running and did not bother with the compiler, Dartium, etc. I am curious for those of you familiar. Since Frog is written in Dart, does it require the compiler aspect to be compiled or will it work with just the VM as is?
Also for the Dartium build.. the Wiki instructions show to use bleeding_edge repository as opposed to using the trunk. Thoughts on this?

No comments:

Post a Comment