Installing Rust nightly builds on Ubuntu 10.04 Lucid
Rust is a systems programming language designed around speed and
safety. It sits roughly halfway between Go and Haskell. In
particular, it combines precise, safe control over memory with
high-level functional programming. Haskell programmers, for example, will
notice that Rust’s and_then
works much like bind
in Haskell’s Maybe
monad:
use std::os::getenv;
use std::io::net::ip::Port;
/// Look up our server port number in PORT.
fn get_server_port() -> Port {
getenv("PORT")
.and_then(|s| from_str::<Port>(s.as_slice()))
.unwrap_or(8080)
}
Anyway, I spent this morning trying to get Rust working on Ubuntu 10.04
Lucid, as part of a larger effort to deploy a Rust application on Heroku.
(More on that soon.) On Ubuntu 10.04, rustc
fails looking for
libstdc++.so.6
:
rustc: /usr/lib/libstdc++.so.6: version `GLIBCXX_3.4.15' not found
Chris Morgan provided several key hints on IRC. It turns out that the
nightly builds work just fine as long as they have access to
libstdc++.so.6.0.18
. If have root access, you can configure
ubuntu-toolchain-r/test
and install things normally from there:
sudo sh -c 'echo "deb http://ppa.launchpad.net/ubuntu-toolchain-r/test/ubuntu lucid main\ndeb-src http://ppa.launchpad.net/ubuntu-toolchain-r/test/ubuntu lucid main\n" > /etc/apt/sources.list.d/toolchain.list'
gpg --keyserver wwwkeys.pgp.net --recv-keys 1E9377A2BA9EF27F
gpg --armor --export 1E9377A2BA9EF27F | sudo apt-key add -
sudo apt-get update
sudo apt-get install libstdc++6
curl -O http://static.rust-lang.org/dist/rust-nightly-x86_64-unknown-linux-gnu.tar.gz
tar xzf rust-nightly-x86_64-unknown-linux-gnu.tar.gz
cd rust-nightly-x86_64-unknown-linux-gnu/
sudo ./install.sh
If you don’t have root access, all you need to do is add
libstdc++.so.6.0.18
(and a symlink to it from libstdc++.so.6
) to
LD_LIBRARY_PATH
, and run rustc
directly from wherever you untarred it:
curl -O http://static.rust-lang.org/dist/rust-nightly-x86_64-unknown-linux-gnu.tar.gz
tar xzf rust-nightly-x86_64-unknown-linux-gnu.tar.gz
curl -O https://s3.amazonaws.com/rust-builds/rust-support.tar.gz
tar xzvf rust-support.tar.gz
export LD_LIBRARY_PATH=~/lib
PATH=~/rust-nightly-x86_64-unknown-linux-gnu/bin:$PATH
What about Heroku? See my post Deploying Rust applications to Heroku with Rustful for step-by-step instructions.
Want to contact me about this article? Or if you're looking for something else to read, here's a list of popular posts.