如果不想影响全局,可以直接把包或者软件安装在自己的根目录。
wget https://github.com/tmux/tmux/releases/download/2.8/tmux-2.8.tar.gz # 这里以tmux2.8版本为例
wget https://github.com/libevent/libevent/releases/download/release-2.0.22-stable/libevent-2.0.22-stable.tar.gz
wget http://ftp.gnu.org/gnu/ncurses/ncurses-6.0.tar.gz
# 安装libevent
cd libevent-2.0.22-stable
./configure --prefix=$HOME/.local --disable-shared
make
make install
#安装ncurses
cd ncurses-6.0
./configure --prefix=$HOME/.local
make
make install
In file included from ../ncurses/curses.priv.h:283:0,
from ../ncurses/lib_gen.c:19:
_46863.c:835:15: error: expected ‘)’ before ‘int’
../include/curses.h:1594:56: note: in definition of macro ‘mouse_trafo’
#define mouse_trafo(y,x,to_screen) wmouse_trafo(stdscr,y,x,to_screen) ^
Makefile:790: recipe for target '../objects/lib_gen.o' failed
make[1]: *** [../objects/lib_gen.o] Error 1
–>解决办法:
cd ncurses-6.0/include
vim curses.tail
大约是在104行,去除104行后面的注释。即:删除/* generated */
103 extern NCURSES_EXPORT(bool) wmouse_trafo (const WINDOW*, int*, int*, bool);
104 extern NCURSES_EXPORT(bool) mouse_trafo (int*, int*, bool); /* generated */
然后使用命令:make clean
,再重新使用命令make
balabala
#tmux
cd tmux-2.8
./configure CFLAGS="-I$HOME/.local/include -I$HOME/.local/include/ncurses" LDFLAGS="-L$HOME/.local/lib -L$HOME/.local/include/ncurses -L$HOME/.local/include" CPPFLAGS="-I$HOME/.local/include -I$HOME/.local/include/ncurses" LDFLAGS="-static -L$HOME/.local/include -L$HOME/.local/include/ncurses -L$HOME/.local/lib"
make
cp tmux $HOME/.local/bin
#将下面的语句添加到.bashrc中
export PATH="$HOME/.local/bin:$PATH"
#重载环境
source ~/.bashrc