跳到主要内容

Ubuntu下编译lua源码

· 阅读需 1 分钟

lua是门非常小巧的脚本语言,官网:lua官网。下载其源码后,解压:

tar -zxvf lua-5.3.1.tar.gz

进入目录并make:

cd lua-5.3.1/
make linux

报错:

lua.c:80:31: fatal error: readline/readline.h: No such file or directory
#include <readline/readline.h>

安装缺少的依赖:

sudo apt-get install build-essential
sudo apt-get install libreadline-gplv2-dev

重新编译:

make linux
sudo make install

完成!

lua-5.3.1$ lua
Lua 5.3.1 Copyright (C) 1994-2015 Lua.org, PUC-Rio

附加说明

网上有很多说要安装libreadline5-dev,在尝试安装时提示:

Package libreadline5-dev is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
However the following packages replace it:
libreadline-gplv2-dev:i386 lib64readline-gplv2-dev:i386
libreadline-gplv2-dev

所以选择安装libreadline-gplv2-dev