编译nginx/tengine 提示LuaJIT 2.0 not found

checking for LuaJIT 2.x ... not found ./configure: error: unsupported LuaJIT version; ngx_http_lua_module requires LuaJIT 2.x.

这个错误是因为需要安装 LuaJIT 2.x。以下是安装步骤

1. 首先安装必要的编译工具和依赖

Ubuntu/Debian:

apt-get install build-essential

CentOS 9 :

# 安装开发工具组
dnf groupinstall "Development Tools"

# 安装必要的依赖
dnf install pcre-devel zlib-devel openssl-devel gcc make \
    perl-IPC-Cmd perl-Getopt-Long perl-Data-Dumper \
    luajit-devel luajit

2.设置环境变量

# 设置 LuaJIT 路径
export LUAJIT_LIB=/usr/lib64
export LUAJIT_INC=/usr/include/luajit-2.1

# 添加到系统配置文件以持久化
echo "export LUAJIT_LIB=/usr/lib64" >> /etc/profile.d/luajit.sh
echo "export LUAJIT_INC=/usr/include/luajit-2.1" >> /etc/profile.d/luajit.sh
source /etc/profile

3. 重新配置 Nginx/Tengine


./configure \
--prefix=/usr/local/nginx \
--user=www \
--group=www \
--with-http_ssl_module \
--with-http_v2_module \
--with-http_flv_module \
--with-http_stub_status_module \
--with-http_gzip_static_module \
--with-pcre \
--with-http_realip_module \
--with-http_gunzip_module \
--with-http_secure_link_module \
--with-stream \
--with-stream_ssl_module \
--with-stream_sni \
--with-syslog \
--with-ld-opt="-Wl,-rpath,/usr/lib64" \
--with-luajit-lib=/usr/lib64 \
--with-luajit-inc=/usr/include/luajit-2.1

如果还是不成功,可以尝试手动编译 LuaJIT

# 下载并解压 LuaJIT
cd /usr/local/src
wget https://github.com/openresty/luajit2/archive/refs/tags/v2.1-20231117.tar.gz
tar -zxf v2.1-20231117.tar.gz
cd luajit2-2.1-20231117

# 编译安装
make
make install PREFIX=/usr

# 更新系统库缓存
ldconfig

然后重新设置环境变量并配置 Tengine。

如果仍然遇到问题,可以检查:

  1. 验证 LuaJIT 安装:

    
    # 检查 LuaJIT 版本
    luajit -v
  2. 检查库文件
    ls -l /usr/lib64/libluajit*
    ls -l /usr/include/luajit-2.1/

  3. 检查环境变量:

    echo $LUAJIT_LIB
    echo $LUAJIT_INC
  4. 如果出现其他错误,可以查看配置日志:

    cat objs/autoconf.err
暂无评论

发送评论 编辑评论


				
|´・ω・)ノ
ヾ(≧∇≦*)ゝ
(☆ω☆)
(╯‵□′)╯︵┴─┴
 ̄﹃ ̄
(/ω\)
∠( ᐛ 」∠)_
(๑•̀ㅁ•́ฅ)
→_→
୧(๑•̀⌄•́๑)૭
٩(ˊᗜˋ*)و
(ノ°ο°)ノ
(´இ皿இ`)
⌇●﹏●⌇
(ฅ´ω`ฅ)
(╯°A°)╯︵○○○
φ( ̄∇ ̄o)
ヾ(´・ ・`。)ノ"
( ง ᵒ̌皿ᵒ̌)ง⁼³₌₃
(ó﹏ò。)
Σ(っ °Д °;)っ
( ,,´・ω・)ノ"(´っω・`。)
╮(╯▽╰)╭
o(*////▽////*)q
>﹏<
( ๑´•ω•) "(ㆆᴗㆆ)
😂
😀
😅
😊
🙂
🙃
😌
😍
😘
😜
😝
😏
😒
🙄
😳
😡
😔
😫
😱
😭
💩
👻
🙌
🖕
👍
👫
👬
👭
🌚
🌝
🙈
💊
😶
🙏
🍦
🍉
😣
Source: github.com/k4yt3x/flowerhd
颜文字
Emoji
小恐龙
花!
上一篇
下一篇