Tmux is great … (but how to build on Lucid Lynx?)

… only a few troubles to get it to build on Ubuntu 10.04 LTS 😉

Basically you’ll want libevent2, which doesn’t come in the package repos, so fetch it from here. Then you obviously fetch the tmux source via tmux.sourceforge.net and then it’s easy (until you try to run the resulting binary 😉 ).

Assume you have the two files in a sub folder of your home folder, called tmux.

$ ls
libevent-2.0.21-stable.tar.gz  tmux-1.7.tar.gz
$ tar -xzf tmux-1.7.tar.gz && tar -xzf libevent-2.0.21-stable.tar.gz
$ ( cd libevent-2.0.21-stable/ && ./configure && make && sudo make install )
# loads of output ...
$ ( cd tmux-1.7/ && ./configure && make && sudo make install )
# loads of output ...

Now you’ll notice the man page is installed properly, but trying to run tmux fails like this:

$ tmux
tmux: error while loading shared libraries: libevent-2.0.so.5: cannot open shared object file: No such file or directory

Why is that?

$ locate libevent-2.0.so.5
/home/oliver/libevent-2.0.21-stable/.libs/libevent-2.0.so.5
/home/oliver/libevent-2.0.21-stable/.libs/libevent-2.0.so.5.1.9
/usr/local/lib/libevent-2.0.so.5
/usr/local/lib/libevent-2.0.so.5.1.9

So the files are there, why does tmux not find them? The most likely reason is that ld.so, the dynamic loader, doesn’t know where to look for it. So let’s check:

$ grep -R local /etc/ld.so.conf*
/etc/ld.so.conf.d/libc.conf:/usr/local/lib

So it does know about the folder. And it certainly should be able to find the correct file. No conflicts about the bitness used for either one either:

$ file $(readlink -f /usr/local/lib/libevent-2.0.so.5)
/usr/local/lib/libevent-2.0.so.5.1.9: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, not stripped
file $(which tmux)
/usr/local/bin/tmux: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.15, not stripped

I’m still puzzled about why I can explicitly tell the dynamic loader to look in /usr/local/lib via LD_LIBRARY_PATH but it ignores the default setting in /etc/ld.so.conf.d/libc.conf. However, the workaround to get it to run was for me:

$ LD_LIBRARY_PATH=/usr/local/lib tmux

My final solution, however, is to statically link tmux using the following ./configure line and make to build a tmux binary:

$ ( cd tmux-1.7/ && CC='gcc -static' ./configure --enable-static && make && sudo make install )

That does the job.

// Oliver

This entry was posted in EN, Linux, Programming, Software, Unix and unixoid and tagged . Bookmark the permalink.

4 Responses to Tmux is great … (but how to build on Lucid Lynx?)

  1. Colin Mollenhour says:

    Thank You Oliver!

  2. J G Miller says:

    Any thoughts on tmux-powerline — the customization/theming of the tmux statusbar? ❓

  3. Oliver says:

    I looked at it, but I prefer my own frugal version instead:

    https://vcs.assarbad.net/mercurial/bashrc/file/tip/.tmux.conf

  4. Oliver says:

    Odd, I thought they even didn’t have a fully-automated version back in the years of the cold war.

Leave a Reply

Your email address will not be published. Required fields are marked *