Attempting to install tmux on CentOS 6.x fails with error: ‘EVBUFFER_EOL_LF’ undeclared

I tried compiling tmux using the following steps:

yum -y install ncurses-devel libevent-devel
wget http://downloads.sourceforge.net/tmux/tmux-1.9a.tar.gz
tar -xvzf tmux-1.9a.tar.gz
cd tmux-1.9a
./configure
make

The make command failed with the following error:

control.c:64:47: error: ‘EVBUFFER_EOL_LF’ undeclared (first use in this function)

Here are the details of ncurses-devel and libevent-devel packages installed.

[root@rigel ~]# yum info ncurses-devel.x86_64 libevent-devel.x86_64
Loaded plugins: fastestmirror, refresh-packagekit, security
Loading mirror speeds from cached hostfile
 * base: centosmirror.go4hosting.in
Installed Packages
Name        : libevent-devel
Arch        : x86_64
Version     : 1.4.13
Release     : 4.el6
Size        : 421 k
Repo        : installed
From repo   : base
Summary     : Header files, libraries and development documentation for libevent
URL         : http://monkey.org/~provos/libevent/
License     : BSD
Description : This package contains the static libraries documentation for libevent.
            : If you like to develop programs using libevent, you will need
            : to install libevent-devel.

Name        : ncurses-devel
Arch        : x86_64
Version     : 5.7
Release     : 3.20090208.el6
Size        : 1.7 M
Repo        : installed
From repo   : base
Summary     : Development files for the ncurses library
URL         : http://invisible-island.net/ncurses/ncurses.html
License     : MIT
Description : The header files and libraries for developing applications that use
            : the ncurses terminal handling library.
            :
            : Install the ncurses-devel package if you want to develop applications
            : which will use ncurses.

What is the right way to install tmux on CentOS 6.x?


The issue occurs because yum installs libevent version 1.4 whereas tmux 1.9 requires libevent version 2.0. The solution is to install libevent version 2.0 from the source.

Here is the complete set of commands to install tmux from scratch.

yum -y install ncurses-devel

wget https://github.com/libevent/libevent/releases/download/release-2.0.22-stable/libevent-2.0.22-stable.tar.gz
tar -xvzf libevent-2.0.22-stable.tar.gz
cd libevent-2.0.22-stable
./configure
make -j 4
make install
cd ..

wget https://github.com/tmux/tmux/releases/download/2.1/tmux-2.1.tar.gz
tar -xvzf tmux-2.1.tar.gz
cd tmux-2.1
./configure LDFLAGS="-Wl,-rpath,/usr/local/lib"
make -j 4
make install

There are three blocks of commands here.

  1. The yum command installs the ncurses-devel package (if it is not already present) required to compile tmux.
  2. Then we compile libevent version 2.0 from source and install it.
  3. Then we compile tmux version 2.1 from source and install it. While doing so, we ensure that we link tmux to libevent that we installed in /usr/local/lib, otherwise would get this error: tmux: error while loading shared libraries: libevent-2.0.so.5: cannot open shared object file: No such file or directory.

Finally, execute the tmux command to launch tmux.


Install libevent2-devel instant of libevent-devel

on my 64bit machine:

yum install libevent2-devel.x86_64

If you already have libevent-devel installed, uninstall it first.


Configure and make started working after I executed:

sudo yum erase libevent-devel

sudo yum install libevent2-devel

Note the first one removes the old version ( 1) and the second one has an explicit '2' added . Also the type of the machine is luckily resolved automatically.