1. luajit2-2.1-20201027.tar.gz
  2. lua-nginx-module-0.10.19.tar.gz
  3. nginx-1.18.0.tar.gz
  4. ngx_devel_kit-0.3.1.tar.gz

echo $LUAJIT_LIB
/usr/local/LuaJIT/lib
echo $LUAJIT_INC
/usr/local/LuaJIT/include/luajit-2.1

编译报错.

adding module in /usr/local/src/ngx_devel_kit-0.3.1
 + ngx_devel_kit was configured
adding module in /usr/local/src/lua-nginx-module-0.10.19
checking for LuaJIT 2.x ... not found
    ./configure: error: unsupported LuaJIT version; ngx_http_lua_module requires LuaJIT 2.x.

nginx + ngx_http_lua_module 编译失败有人遇到过吗? (树莓派\WSL2都失败)

    麻烦加上 export LUA_INCLUDE_DIR=$LUAJIT_INC 试试

    14 days later

    xiaocang
    echo $LUA_INCLUDE_DIR

    /usr/local/LuaJIT/include/luajit-2.0

    还是不行.

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

      LuaJIT 我是这样安装的,不知道有没有问题/

      cd LuaJIT-2.0.5
      make install PREFIX=/usr/local/LuaJIT

      /usr/local/LuaJIT$ ls
      bin include lib share

        #define LUAJIT_VERSION "LuaJIT 2.0.5"
        #define LUAJIT_VERSION_NUM 20005 /* Version 2.0.5 = 02.00.05. */
        #define LUAJIT_VERSION_SYM luaJIT_version_2_0_5

          我看到你用的 luajit2-2.1-20201027.tar.gz 这个源码包,但是 $LUA_INCLUDE_DIR 的输出结果是

          $ echo $LUA_INCLUDE_DIR
          /usr/local/LuaJIT/include/luajit-2.0

          麻烦再确认下,你编译安装后的 luajit 的头文件在哪个目录

          xiaocang 这个我刚刚看issue的时候注意到了,发现路径错误了,是2.1(就如我最早echo的2.1),但是改成2.1也报同样的错误。
          `
          echo $LUAJIT_LIB
          /usr/local/lib

          echo $LUAJIT_INC
          /usr/local/include/luajit-2.1

          echo $LUA_INCLUDE_DIR
          /usr/local/include/luajit-2.1

          pwd
          /usr/local/include/luajit-2.1

          ls
          lauxlib.h luaconf.h lua.h lua.hpp luajit.h lualib.h

          `

          ./configure --prefix=/usr/local/nginx --sbin-path=/usr/local/nginx/nginx --conf-path=/usr/local/nginx/nginx.conf --pid-path=/usr/local/nginx/nginx.pid --error-log-path=/usr/local/nginx/logs/error.log --with-ld-opt="-Wl,-rpath,/usr/local/lib" --add-module=/usr/local/src/ngx_devel_kit-0.3.1 --add-module=/usr/local/src/lua-nginx-module-0.10.19

          错误依然是这样:
          adding module in /usr/local/src/lua-nginx-module-0.10.19
          checking for LuaJIT 2.x ... not found
          ./configure: error: unsupported LuaJIT version; ngx_http_lua_module requires LuaJIT 2.x.

          #define OPENRESTY_LUAJIT
          
          #define LUAJIT_VERSION		"LuaJIT 2.1.0-beta3"
          #define LUAJIT_VERSION_NUM	20100  /* Version 2.1.0 = 02.01.00. */
          #define LUAJIT_VERSION_SYM	luaJIT_version_2_1_0_beta3
          #define LUAJIT_COPYRIGHT	"Copyright (C) 2005-2020 Mike Pall"
          #define LUAJIT_URL		"https://luajit.org/"

            xiaocang

            export LUAJIT_LIB=/usr/local/LuaJIT/lib
            export LUAJIT_INC=/usr/local/LuaJIT/include/luajit-2.1

            这样配置并不起作用,测试了一下还是走else,走auto-discovery
            我自己手动改了config,写死了路就可以了。

            LUAJIT_INC=/usr/local/LuaJIT/include/luajit-2.1
            LUAJIT_LIB=/usr/local/LuaJIT/lib

              xiaocang
              编译成功后,启动失败。

              sudo ./nginx
              nginx: [alert] failed to load the 'resty.core' module (https://github.com/openresty/lua-resty-core); ensure you are using an OpenResty release from https://openresty.org/en/download.html (reason: module 'resty.core' not found:
                      no field package.preload['resty.core']
                      no file './resty/core.lua'
                      no file '/usr/local/LuaJIT/share/luajit-2.1.0-beta3/resty/core.lua'
                      no file '/usr/local/share/lua/5.1/resty/core.lua'
                      no file '/usr/local/share/lua/5.1/resty/core/init.lua'
                      no file '/usr/local/LuaJIT/share/lua/5.1/resty/core.lua'
                      no file '/usr/local/LuaJIT/share/lua/5.1/resty/core/init.lua'
                      no file './resty/core.so'
                      no file '/usr/local/lib/lua/5.1/resty/core.so'
                      no file '/usr/local/LuaJIT/lib/lua/5.1/resty/core.so'
                      no file '/usr/local/lib/lua/5.1/loadall.so'
                      no file './resty.so'
                      no file '/usr/local/lib/lua/5.1/resty.so'
                      no file '/usr/local/LuaJIT/lib/lua/5.1/resty.so'
                      no file '/usr/local/lib/lua/5.1/loadall.so') in /usr/local/nginx/nginx.conf:117
              Write a Reply...