wandenberg / redis_nginx_adapter

Adapter to use hiredis with async connections inside a nginx module
MIT License
27 stars 12 forks source link

Install adapter with ngx_http_v2_module #5

Closed madest92 closed 6 years ago

madest92 commented 6 years ago

If nginx is compiled with ngx_http_v2_module, then an error occurs:

root@88fce8237a6c:/build/ngx_redis_adapter# cat test.c 
#include <ngx_http.h>
root@88fce8237a6c:/build/ngx_redis_adapter# gcc -c -g -O2  -I /build/nginx/src  -I /build/nginx/src/core  -I /build/nginx/src/http  -I /build/nginx/src/os/unix  -I /build/nginx/src/event  -I /build/nginx/src/http/modules  -I /build/nginx/objs -I /include  test.c 
In file included from test.c:1:0:
/build/nginx/src/http/ngx_http.h:39:25: fatal error: ngx_http_v2.h: No such file or directory
 #include <ngx_http_v2.h>
                         ^
compilation terminated.

To solve the problem, you need to add path(http/v2) to NGINX_CPPFLAGS:

NGINX_CPPFLAGS="-I $nginx_dir/src \
 -I $nginx_dir/src/core \
 -I $nginx_dir/src/http \
 -I $nginx_dir/src/http/v2 \
 -I $nginx_dir/src/os/unix \
 -I $nginx_dir/src/event \
 -I $nginx_dir/src/http/modules \
 -I $nginx_dir/objs"

Test:

root@88fce8237a6c:/build/ngx_redis_adapter# gcc -c -g -O2  -I /build/nginx/src  -I /build/nginx/src/core  -I /build/nginx/src/http -I /build/nginx/src/http/v2  -I /build/nginx/src/os/unix  -I /build/nginx/src/event  -I /build/nginx/src/http/modules  -I /build/nginx/objs -I /include  test.c; echo $?
0

P.S.: Of course I can use CPPFLAGS, but I do not like this solution :)