p0pr0ck5 / lua-resty-waf

High-performance WAF built on the OpenResty stack
GNU General Public License v3.0
1.28k stars 305 forks source link

about rex_pcre issus #293

Closed yingshang closed 7 years ago

yingshang commented 7 years ago

this is my dockerfile

from centos:7
RUN yum install  -y readline-devel pcre-devel openssl-devel gcc wget lua-devel
RUN cd /opt && wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.41.tar.gz && tar zxvf pcre-8.41.tar.gz 
RUN cd /opt && wget https://openresty.org/download/openresty-1.11.2.5.tar.gz && openresty-1.11.2.5.tar.gz &&  cd openresty-1.11.2.5 && ./configure --with-pcre=/opt/pcre-8.41  --with-pcre-jit && make && make install 

when i start nginx,the is error [root@localhost openresty-1.11.2.5]# nginx nginx: [error] init_by_lua error: /usr/local/openresty/site/lualib/resty/waf/translate.lua:5: module 'rex_pcre' not found: no field package.preload['rex_pcre'] no file '/usr/local/openresty/site/lualib/rex_pcre.ljbc' no file '/usr/local/openresty/site/lualib/rex_pcre/init.ljbc' no file '/usr/local/openresty/lualib/rex_pcre.ljbc' no file '/usr/local/openresty/lualib/rex_pcre/init.ljbc' no file '/usr/local/openresty/site/lualib/rex_pcre.lua' no file '/usr/local/openresty/site/lualib/rex_pcre/init.lua' no file '/usr/local/openresty/lualib/rex_pcre.lua' no file '/usr/local/openresty/lualib/rex_pcre/init.lua' no file './rex_pcre.lua' no file '/usr/local/openresty/luajit/share/luajit-2.1.0-beta3/rex_pcre.lua' no file '/usr/local/share/lua/5.1/rex_pcre.lua' no file '/usr/local/share/lua/5.1/rex_pcre/init.lua' no file '/usr/local/openresty/luajit/share/lua/5.1/rex_pcre.lua' no file '/usr/local/openresty/luajit/share/lua/5.1/rex_pcre/init.lua' no file '/usr/local/openresty/site/lualib/rex_pcre.so' no file '/usr/local/openresty/lualib/rex_pcre.so' no file './rex_pcre.so' no file '/usr/local/lib/lua/5.1/rex_pcre.so' no file '/usr/local/openresty/luajit/lib/lua/5.1/rex_pcre.so' no file '/usr/local/lib/lua/5.1/loadall.so' stack traceback: [C]: in function 'require' /usr/local/openresty/site/lualib/resty/waf/translate.lua:5: in main chunk [C]: in function 'require' /usr/local/openresty/site/lualib/resty/waf.lua:14: in main chunk [C]: in function 'require' init_by_lua:6: in main chunk

and i found your solve,https://github.com/p0pr0ck5/lua-resty-waf/blob/master/.travis.yml#L33 but i can't solve it.

`[root@localhost openresty-1.11.2.5]# luarocks install lrexlib-pcre 2.7.2-1 PCRE_LIBDIR=/lib/x86_64-linux-gnu Installing https://luarocks.org/lrexlib-pcre-2.7.2-1.src.rock... Using https://luarocks.org/lrexlib-pcre-2.7.2-1.src.rock... switching to 'build' mode

Error: Could not find library file for PCRE No file libpcre.a in /lib/x86_64-linux-gnu No file libpcre.so in /lib/x86_64-linux-gnu No file matching libpcre.so.* in /lib/x86_64-linux-gnu You may have to install PCRE in your system and/or pass PCRE_DIR or PCRE_LIBDIR to the luarocks command. Example: luarocks install lrexlib-pcre PCRE_DIR=/usr/local [root@localhost openresty-1.11.2.5]# luarocks install lrexlib-pcre Installing https://luarocks.org/lrexlib-pcre-2.8.0-1.src.rock... Using https://luarocks.org/lrexlib-pcre-2.8.0-1.src.rock... switching to 'build' mode gcc -O2 -fPIC -I/usr/include -c src/common.c -o src/common.o -DVERSION="2.8.0" -DLUA_COMPAT_5_2 -I/usr/include gcc -O2 -fPIC -I/usr/include -c src/pcre/lpcre.c -o src/pcre/lpcre.o -DVERSION="2.8.0" -DLUA_COMPAT_5_2 -I/usr/include gcc -O2 -fPIC -I/usr/include -c src/pcre/lpcre_f.c -o src/pcre/lpcre_f.o -DVERSION="2.8.0" -DLUA_COMPAT_5_2 -I/usr/include gcc -shared -o rex_pcre.so -L/usr/lib64/lua/5.1 src/common.o src/pcre/lpcre.o src/pcre/lpcre_f.o -L/usr/lib64 -Wl,-rpath,/usr/lib64: -lpcre Warning: /usr/lib64/lua/5.1/rex_pcre.so is not tracked by this installation of LuaRocks. Moving it to /usr/lib64/lua/5.1/rex_pcre.so~ Updating manifest for /usr/lib64/luarocks/rocks lrexlib-pcre 2.8.0-1 is now built and installed in /usr (license: MIT/X11)

i try only install lrexlib-pcre,the is success,but useless for the issus. [root@localhost openresty-1.11.2.5]# luarocks install lrexlib-pcre Installing https://luarocks.org/lrexlib-pcre-2.8.0-1.src.rock... Using https://luarocks.org/lrexlib-pcre-2.8.0-1.src.rock... switching to 'build' mode gcc -O2 -fPIC -I/usr/include -c src/common.c -o src/common.o -DVERSION="2.8.0" -DLUA_COMPAT_5_2 -I/usr/include gcc -O2 -fPIC -I/usr/include -c src/pcre/lpcre.c -o src/pcre/lpcre.o -DVERSION="2.8.0" -DLUA_COMPAT_5_2 -I/usr/include gcc -O2 -fPIC -I/usr/include -c src/pcre/lpcre_f.c -o src/pcre/lpcre_f.o -DVERSION="2.8.0" -DLUA_COMPAT_5_2 -I/usr/include gcc -shared -o rex_pcre.so -L/usr/lib64/lua/5.1 src/common.o src/pcre/lpcre.o src/pcre/lpcre_f.o -L/usr/lib64 -Wl,-rpath,/usr/lib64: -lpcre Warning: /usr/lib64/lua/5.1/rex_pcre.so is not tracked by this installation of LuaRocks. Moving it to /usr/lib64/lua/5.1/rex_pcre.so~ Updating manifest for /usr/lib64/luarocks/rocks lrexlib-pcre 2.8.0-1 is now built and installed in /usr (license: MIT/X11)

` so what can i do? Look forward to your reply,thanks.

yingshang commented 7 years ago

i found the solve,Please disregard. according to the error. file './rex_pcre.so' no file '/usr/local/lib/lua/5.1/rex_pcre.so' no file so i copy the so file. cp /usr/lib64/lua/5.1/rex_pcre.so /usr/local/openresty/lualib/rex_pcre.so