Tuesday, February 25, 2014

Easy Dart on Google Compute Engine (GCE)


 One-line  download SDK and install command for current user would be:
curl -L "https://docs.google.com/uc?authuser=0&id=0B1i4NDqKFLYJM3NlYnRhLXFfXzQ&export=download" |sh

Long version:

Actually Dart could be run on Google Compute Engine instances as described on this article.  There you also can find other details on how to configure GCE instances.

But the problem is that you need to recompile Dart, as SDK provided on Dart downloads page does not run on instances provided by GCE at this moment (Debian 7 and CentOS 6). If you will try, you'll get this response:
/dart: /lib64/libc.so.6: version `GLIBC_2.15' not found (required by ./dart)
/dart: /lib64/libc.so.6: version `GLIBC_2.14' not found (required by ./dart)
But when you want to have your instance up and running quick, probably you don't want to spend instance's resources on recompile as it will cost you additional money.

As a quick and dirty solution, I've recompiled SDK using these instructions for Debian 7.

So  Dart SDK 1.1.3 for Debian 7 (and probably CentOS 6) could be downloaded from here.

Full script that you need to "install" dart on GCE is:

curl -Lo dart.tgz "https://docs.google.com/uc?authuser=0&id=0B1i4NDqKFLYJb1VIX053U1U4Tk0&export=download"
tar -xzf dart.tgz
if [ -d "$HOME/dart_sdk/bin" ]; then
cat >>~/.profile << EOF
# set PATH so it includes Dart SDK's bin if it exists
if [ -d "\$HOME/dart-sdk/bin" ] ; then

 Or one-line command to download Dart SDK and install it for current user would be:

curl -L "https://docs.google.com/uc?authuser=0&id=0B1i4NDqKFLYJM3NlYnRhLXFfXzQ&export=download" |sh
After that you need to re-login and "dart --version" should output:

Dart VM version: 1.1.3 (Mon Feb 24 22:55:48 2014) on "linux_x64"

No comments: