编译 zsh

编译 zsh

  1. 安装依赖 ncurses

    sudo yum install ncurses-devel
    
  2. zsh.sourceforge.io 下载源码

  3. 编译:

    ./configure --prefix=$HOME/.local
    make -j$(nproc)
    make install  # 如果安装到系统目录则要使用 sudo
    

Troubleshooting

No terminal handling library was found on your system

configure: error: in `/usr/local/src/zsh-5.9':
configure: error: "No terminal handling library was found on your system.
This is probably a library called 'curses' or 'ncurses'.  You may
need to install a package called 'curses-devel' or 'ncurses-devel' on your
system."
See `config.log' for more details

需要编译 ncurses 库,并将库安装路径添加到 LDFLAGS 环境变量:

export LDFLAGS="-L$HOME/.local/lib $LDFLAGS"

conflicting types for ‘boolcodes’

termcap.c:45:14: error: conflicting types for ‘boolcodes’; have ‘char *[]’
   45 | static char *boolcodes[] = {
      |              ^~~~~~~~~
In file included from ../../Src/zshterm.h:1,
                 from ../../Src/zsh_system.h:932,
                 from ../../Src/zsh.mdh:15,
                 from termcap.mdh:15,
                 from termcap.c:38:
/data2/lx/.local/include/term.h:783:56: note: previous declaration of ‘boolcodes’ with type ‘const char * const[]’
  783 | extern NCURSES_EXPORT_VAR(NCURSES_CONST char * const ) boolcodes[];
      |                                                        ^~~~~~~~~
make[3]: *** [Makefile:230: termcap.o] Error 1

这是我在 CentOS 7 服务器上遇到的问题,这个问题我没能解决。后来想出了一个 workaround:建立一个本地的 CentOS 7 虚拟机,在虚拟机上编译并安装 zsh,然后将安装目录上传到服务器即可。

posted @ 2024-10-31 01:43  Undefined443  阅读(7)  评论(0编辑  收藏  举报