Home » Compiling and Installing tmux on SmartOS.

Compiling and Installing tmux on SmartOS.

Update: The SmartOS repository starting at 2012Q1 has Tmux1.6 that can be installed by simply running: pkgin in tmux. Here’s a link to the documentation on how to upgrade to 2012Q1.

Since SmartOS was released I’ve been meaning to take it for a spin and see if I like it. Over the weekend I used the Joyent Cloud to spin up a SmartOS64 instance and play with some configuration. The list of packages is OK but not incredible and some of them are pretty outdated. The version of pkgin that comes with SmartOS is missing the provides command which is a real pain in the ass when trying to compile from source.

I, honestly, wouldn’t have ever finished the install without the help of my co-worker Ryan S who, it seems, is really good at tracking down dependencies that are failing and all sorts of other Unix problems.

To install tmux on SmartOS you’ll need to compile some things yourself. You’ll need to compile and manually install:

  • zlib
  • libevent
  • tmux

The versions of zlib and libevent that come with the pkg repo Joyent provides DO NOT work to compile tmux because they’ve been compiled with the wrong ELFCLASS and you’ll just get this error:

ld: fatal: file /opt/local/lib/libz.so: wrong ELF class: ELFCLASS64

There are some packages that you’ll need to install before you can compile and install these modules:

  • python27
  • openssl
  • gcc-compiler
  • gcc-tools
  • gmake
  • gtar
  • gzip
  • libtool-base
  • ncurses

After those are installed you need to install zlib, libevent, and finally tmux:

Installing zlib:

  • wget http://zlib.net/zlib-1.2.6.tar.gz
  • tar xvf zlib-1.2.6.tar.gz
  • cd zlib-1.2.6
  • CPPFLAGS='-I/opt/local/include' LDFLAGS='-L/opt/local/lib' ./configure --prefix=/opt/local
  • make && make install

Installing libevent:

  • wget https://github.com/downloads/libevent/libevent/libevent-2.0.17-stable.tar.gz
  • tar xvf libevent-2.0.17
  • cd libevent-2.0.17
  • CPPFLAGS='-I/opt/local/include' LDFLAGS='-L/opt/local/lib' ./configure --prefix=/opt/local
  • make && make install

Installing tmux:

  • wget http://downloads.sourceforge.net/tmux/tmux-1.6.tar.gz
  • tar xvf tmux-1.6.tar.gz
  • cd tmux-1.6
  • CPPFLAGS='-I/opt/local/include' LDFLAGS='-L/opt/local/lib -levent' ./configure --prefix=/opt/local
  • make && make install

You may run into a problem when doing the make step that looks like this:

In file included from /usr/include/sys/types.h:33:0,
from arguments.c:19:
/opt/local/lib/gcc/i386-pc-solaris2.11/4.6.1/include-fixed/sys/feature_tests.h:362:2: error: #error "Compiler or options invalid for pre-UNIX 03 X/Open applications and pre-2001 POSIX applications"
make: *** [arguments.o] Error 1

If you get that error just edit the Makefile and remove the -std=c99 line and run make again.

Now run tmux and you should have a fully functioning tmux installation.