更新:2014 年 10 月:Dart 现在可以使用 apt-get 安装在 Debian 上:
指令总结自飞镖网站 https://www.dartlang.org/tools/debian.html:
# Enable HTTPS for apt.
sudo apt-get update
sudo apt-get install apt-transport-https
# Get the Google Linux package signing key.
sudo sh -c 'curl https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add -'
# Set up the location of the stable repository.
sudo sh -c 'curl https://storage.googleapis.com/download.dartlang.org/linux/debian/dart_stable.list > /etc/apt/sources.list.d/dart_stable.list'
sudo apt-get update
# Finally, install the dart package!
sudo apt-get install dart
自行构建二进制文件的说明:
此问题似乎是由 Google 针对 GLIBC 的边缘版本(>= 2.15)进行编译引起的,除了 Ubuntu 12(Precise Pangolin)之外的 Linux 上通常不支持该版本。
首先,不要尝试下载 GLIBC 或 EGLIBC 的实验版本。我能够使用这种方法让 dart 工作,但是我的机器的其余部分崩溃了。更新 GLIBC 会导致疯狂。
相反,最好的解决方案是从源代码构建 dart。尽管二进制文件有 GLIBC 版本要求,但源代码本身没有这样的要求。有 wiki 页面用于从源代码安装debian https://code.google.com/p/dart/wiki/BuildingOnDebian, centos/fedora/红帽/亚马逊 https://code.google.com/p/dart/wiki/BuildingOnCentOS, ubuntu https://code.google.com/p/dart/wiki/BuildDartSDKOnUbuntu10_04, and 其他Linux版本 https://code.google.com/p/dart/wiki/Building.
以下是这些步骤的概述,我可以确认这些步骤适用于 Debian 7.2。 centos/fedora/redhat 的步骤似乎是相同的,只是它们使用 yum 而不是 apt-get。
-
安装 subversion 和所需的构建工具:
sudo apt-get -y update
sudo apt-get -y install subversion
sudo apt-get -y install make
sudo apt-get -y install g++
sudo apt-get -y install openjdk-6-jdk
-
查看 google 的 depot 工具并将 gclient 添加到您的路径中
svn co http://src.chromium.org/svn/trunk/tools/depot_tools
export PATH=$PATH:`pwd`/depot_tools
-
在所需的分支下载 dart 源代码。
-
移动到新的 dart 目录
cd dart
-
仅执行以下 A 或 B:
注意:对于 32 位,请使用--arch=ia32
代替标志。
-
A.构建整个Dart SDK,包括pub、dart2js、dart等:
tools/build.py --mode=release --arch=x64 create_sdk
-
B.仅构建 dart 可执行文件:
tools/build.py --mode=release --arch=x64 runtime
-
dart 可执行文件现在位于 out/ReleaseX64/dart 或 out/ReleaseX64/dart-sdk/bin/dart 您可以通过打印版本来进行冒烟测试
dart/out/ReleaseX64/dart --version
输出应该是这样的Dart VM version: 1.2.0 (Mon Mar 3 03:06:20 2014) on "linux_x64"
.
如何帮助解决此问题
这比需要的要痛苦得多,因为二进制文件显然不需要使用 GLIBC >= 2.15 来构建。如果您希望引起人们对这个问题的关注,请加注星标这个飞镖虫。 https://code.google.com/p/dart/issues/detail?id=11880