尝试在 CentOS 6.x 上安装 tmux 失败并显示错误:'EVBUFFER_EOL_LF' undeclared

Sus*_*Pal 11 linux centos tmux

我尝试使用以下步骤编译 tmux:

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
Run Code Online (Sandbox Code Playgroud)

make命令失败,出现以下错误:

control.c:64:47: error: ‘EVBUFFER_EOL_LF’ undeclared (first use in this function)
Run Code Online (Sandbox Code Playgroud)

以下是安装的 ncurses-devel 和 libevent-devel 软件包的详细信息。

[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.
Run Code Online (Sandbox Code Playgroud)

在 CentOS 6.x 上安装 tmux 的正确方法是什么?

Sus*_*Pal 17

出现此问题是因为 yum 安装了 libevent 1.4 版,而 tmux 1.9 需要 libevent 2.0 版。解决方案是从源安装 libevent 2.0 版。

这是从头开始安装 tmux 的完整命令集。

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
Run Code Online (Sandbox Code Playgroud)

这里有三个命令块。

  1. yum 命令安装编译 tmux 所需的 ncurses-devel 包(如果它还没有)。
  2. 然后我们从源代码编译 libevent 2.0 版并安装它。
  3. 然后我们从源代码编译 tmux 2.1 版并安装它。这样做时,我们确保将 tmux 链接到我们安装在 /usr/local/lib 中的 libevent,否则会出现此错误:tmux: error while loading shared libraries: libevent-2.0.so.5: cannot open shared object file: No such file or directory

最后,执行tmux命令启动 tmux。

  • tmux 的配​​置也接受这些: export LIBEVENT_CFLAGS="-I/usr/local/include" export LIBEVENT_LIBS="-L/usr/local/lib -Wl,-rpath=/usr/local/lib -levent" rpath 将排除LD_LIBRAY_PATH 更改对您系统上的其他用户更方便。 (6认同)

kij*_*ong 9

安装libevent-devel 的libevent 2 -devel 即时

在我的 64 位机器上:

yum install libevent2-devel.x86_64
Run Code Online (Sandbox Code Playgroud)

如果您已经安装了 libevent-devel,请先卸载它。