I want to install nginx with the module ngx_mruby on centos7, but I ran into the compilation errors.
Following the steps described here, I did (in my home directory):
wget http://nginx.org/download/nginx-1.10.1.tar.gz
tar zxvf nginx-1.10.1.tar.gz
git clone git://github.com/matsumoto-r/ngx_mruby.git
cd ngx_mruby
./configure --with-ngx-src-root=/home/vagrant/nginx-1.10.1 with-ngx-config-opt="--prefix=/usr/local/nginx"
make build_mruby
make
On make
process, I got errors:
cc -c -pipe -O -W -Wall -Wpointer-arith -Wno-unused-parameter -Werror -g -I src/core -I src/event -I src/event/modules -I src/os/unix -I /home/vagrant/ngx_mruby/mruby/src -I /home/vagrant/ngx_mruby/mruby/include -I -g -I -std=gnu99 -I -O3 -I -Wall -I -Werror-implicit-function-declaration -I -Wdeclaration-after-statement -I -Wwrite-strings -I -I/home/vagrant/ngx_mruby/mruby/include -I -I/home/vagrant/ngx_mruby/mruby/build/mrbgems/mruby-pointer/include -I -I/usr/local/include -I /home/vagrant/ngx_mruby/dependence/ngx_devel_kit/objs -I objs/addon/ndk -I objs -I src/http -I src/http/modules -I /home/vagrant/ngx_mruby/dependence/ngx_devel_kit/src \
-o objs/addon/http/ngx_http_mruby_server.o \
/home/vagrant/ngx_mruby/src/http/ngx_http_mruby_server.c
In file included from src/core/ngx_core.h:51:0,
from /home/vagrant/ngx_mruby/src/http/ngx_http_mruby_module.h:12,
from /home/vagrant/ngx_mruby/src/http/ngx_http_mruby_server.c:7:
/home/vagrant/ngx_mruby/src/http/ngx_http_mruby_server.c: In function ‘ngx_mrb_add_listener’:
/home/vagrant/ngx_mruby/src/http/ngx_http_mruby_server.c:66:20: error: ‘ngx_http_listen_opt_t’ has no member named ‘sockaddr’
ngx_memcpy(&lsopt.sockaddr.sockaddr, &u.sockaddr, u.socklen);
^
src/core/ngx_string.h:102:49: note: in definition of macro ‘ngx_memcpy’
#define ngx_memcpy(dst, src, n) (void) memcpy(dst, src, n)
^
/home/vagrant/ngx_mruby/src/http/ngx_http_mruby_server.c:98:29: error: ‘ngx_http_listen_opt_t’ has no member named ‘sockaddr’
(void)ngx_sock_ntop(&lsopt.sockaddr.sockaddr, lsopt.socklen, lsopt.addr, NGX_SOCKADDR_STRLEN, 1);
^
I tried another way to install ngx_mruby:
cd ngx_mruby
./configure --enable-dynamic-module --with-ngx-src-root=/home/vagrant/nginx-1.10.1
make build_mruby
make generate_gems_config_dynamic
cd ../nginx-1.10.1
./configure --prefix=/usr/local/nginx --add-dynamic-module=/home/vagrant/nginx-1.10.1 --add-module=/home/vagrant/nginx-1.10.1/dependence/ngx_devel_kit
make
But the same errors happened at make
.
Then I googled, but it seemed that few people have the same problem.
Is it a common bug, or are there any ways to avoid this error?
Thank you.
$ cat /etc/centos-release
CentOS Linux release 7.2.1511 (Core)
$ vagrant -v
Vagrant 1.9.4