Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Dart throwing errors on linux: GLIBC_2.14 GLIBC_2.15 not found

Tags:

linux

dart

I'm running Debian 7.2 on Google Compute Engine (Though I suspect Centos, Red Hat, and Amazon Linux AMI all have the same problem). After downloading the 64-bit Linux version of the Dart SDK from this page, any dart command I run, for example, dart --version, will output the following error:

./editor/dart/dart-sdk/bin/dart: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.15' not found (required by ./editor/dart/dart-sdk/bin/dart)
./editor/dart/dart-sdk/bin/dart: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.14' not found (required by ./editor/dart/dart-sdk/bin/dart)
like image 402
plowman Avatar asked Mar 03 '14 20:03

plowman


1 Answers

Update: October 2014: Dart can now be installed on Debian with apt-get:

Instructions summarized from the dart website:

# 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

Instructions for building the binary yourself:

This problem appears to be caused by Google compiling against an edge version of GLIBC (>= 2.15) which is not generally supported on Linux outside of Ubuntu 12 (Precise Pangolin).

First of all, do not attempt to download an experimental version of GLIBC or EGLIBC. I was able to get dart to work using that method, but the rest of my machine fell apart. Updating GLIBC is a recipe for madness.

Instead, the best solution is building dart from source. Despite the GLIBC version requirements of the binary, the source itself has no such requirements. There are wiki pages for installing from source on debian, centos/fedora/red hat/amazon, ubuntu, and other linux versions.

Here is an overview of those steps, which I can confirm works on Debian 7.2. The centos/fedora/redhat steps appear to be the same except they use yum instead of apt-get.

  1. Install subversion and the required build tools:

    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
    
  2. Check out google's depot tools and add gclient to your path

    svn co http://src.chromium.org/svn/trunk/tools/depot_tools
    export PATH=$PATH:`pwd`/depot_tools
    
  3. Download the dart source at the desired branch.

    • Replace 1.2 with whatever branch you wish to build. You can see a list of available versions here. In general, the latest numbered branch is best.

      gclient config http://dart.googlecode.com/svn/branches/1.2/deps/all.deps
      gclient sync
      gclient runhooks
      
  4. Move into the new dart directory

    cd dart
    
  5. Do only A or B below:

    • Note: For 32bit, use the --arch=ia32 flag instead.

    • A. Build the entire Dart SDK including pub, dart2js, dart, etc.:

      tools/build.py --mode=release --arch=x64 create_sdk
      
    • B. Build just the dart executable:

      tools/build.py --mode=release --arch=x64 runtime
      
  6. The dart executable is now at either out/ReleaseX64/dart or out/ReleaseX64/dart-sdk/bin/dart you can do a smoke test by printing the version

    dart/out/ReleaseX64/dart --version
    

    The output should be something like Dart VM version: 1.2.0 (Mon Mar 3 03:06:20 2014) on "linux_x64".

How to help fix this issue

This was much more painful than it needed to be, since the binary clearly doesn't need to be built using GLIBC >= 2.15. If you wish to draw attention to this issue, please star this dart bug.

like image 92
plowman Avatar answered Sep 30 '22 15:09

plowman