nginx_tcp_proxy_module icon indicating copy to clipboard operation
nginx_tcp_proxy_module copied to clipboard

Patch and compile failed on nginx 1.9.5

Open ghost opened this issue 10 years ago • 3 comments

When patch with tcp.patch on nginx 1.9.5, the patch is not working at all

patching file src/core/ngx_log.c Hunk #1 FAILED at 66. 1 out of 1 hunk FAILED -- saving rejects to file src/core/ngx_log.c.rej patching file src/core/ngx_log.h Hunk #1 FAILED at 29. Hunk #2 FAILED at 37. 2 out of 2 hunks FAILED -- saving rejects to file src/core/ngx_log.h.rej patching file src/event/ngx_event_connect.h Hunk #1 FAILED at 32. Hunk #2 FAILED at 43. 2 out of 2 hunks FAILED -- saving rejects to file src/event/ngx_event_connect.h.rej

if I ignore the error and keep complie, the following error shown:

In file included from src/core/ngx_core.h:58:0, from /home/ronlam/Desktop/build/modules/nginx_tcp_proxy_module-master/ngx_tcp_session.c:3: /home/ronlam/Desktop/build/modules/nginx_tcp_proxy_module-master/ngx_tcp_session.c: In function ‘ngx_tcp_send’: /home/ronlam/Desktop/build/modules/nginx_tcp_proxy_module-master/ngx_tcp_session.c:351:20: error: ‘NGX_LOG_DEBUG_TCP’ undeclared (first use in this function) ngx_log_debug1(NGX_LOG_DEBUG_TCP, wev->log, 0, "nginx tcp send:%d", n); ^ src/core/ngx_log.h:93:28: note: in definition of macro ‘ngx_log_debug’ if ((log)->log_level & level)
^ /home/ronlam/Desktop/build/modules/nginx_tcp_proxy_module-master/ngx_tcp_session.c:351:5: note: in expansion of macro ‘ngx_log_debug1’ ngx_log_debug1(NGX_LOG_DEBUG_TCP, wev->log, 0, "nginx tcp send:%d", n); ^ /home/ronlam/Desktop/build/modules/nginx_tcp_proxy_module-master/ngx_tcp_session.c:351:20: note: each undeclared identifier is reported only once for each function it appears in ngx_log_debug1(NGX_LOG_DEBUG_TCP, wev->log, 0, "nginx tcp send:%d", n); ^ src/core/ngx_log.h:93:28: note: in definition of macro ‘ngx_log_debug’ if ((log)->log_level & level)
^ /home/ronlam/Desktop/build/modules/nginx_tcp_proxy_module-master/ngx_tcp_session.c:351:5: note: in expansion of macro ‘ngx_log_debug1’ ngx_log_debug1(NGX_LOG_DEBUG_TCP, wev->log, 0, "nginx tcp send:%d", n); ^ /home/ronlam/Desktop/build/modules/nginx_tcp_proxy_module-master/ngx_tcp_session.c: In function ‘ngx_tcp_finalize_session’: /home/ronlam/Desktop/build/modules/nginx_tcp_proxy_module-master/ngx_tcp_session.c:410:20: error: ‘NGX_LOG_DEBUG_TCP’ undeclared (first use in this function) ngx_log_debug1(NGX_LOG_DEBUG_TCP, c->log, 0, ^ src/core/ngx_log.h:93:28: note: in definition of macro ‘ngx_log_debug’ if ((log)->log_level & level)
^ /home/ronlam/Desktop/build/modules/nginx_tcp_proxy_module-master/ngx_tcp_session.c:410:5: note: in expansion of macro ‘ngx_log_debug1’ ngx_log_debug1(NGX_LOG_DEBUG_TCP, c->log, 0, ^ /home/ronlam/Desktop/build/modules/nginx_tcp_proxy_module-master/ngx_tcp_session.c: In function ‘ngx_tcp_close_connection’: /home/ronlam/Desktop/build/modules/nginx_tcp_proxy_module-master/ngx_tcp_session.c:431:20: error: ‘NGX_LOG_DEBUG_TCP’ undeclared (first use in this function) ngx_log_debug1(NGX_LOG_DEBUG_TCP, c->log, 0, ^ src/core/ngx_log.h:93:28: note: in definition of macro ‘ngx_log_debug’ if ((log)->log_level & level)
^ /home/ronlam/Desktop/build/modules/nginx_tcp_proxy_module-master/ngx_tcp_session.c:431:5: note: in expansion of macro ‘ngx_log_debug1’ ngx_log_debug1(NGX_LOG_DEBUG_TCP, c->log, 0, ^ /home/ronlam/Desktop/build/modules/nginx_tcp_proxy_module-master/ngx_tcp_session.c: In function ‘ngx_tcp_cleanup_add’: /home/ronlam/Desktop/build/modules/nginx_tcp_proxy_module-master/ngx_tcp_session.c:519:20: error: ‘NGX_LOG_DEBUG_TCP’ undeclared (first use in this function) ngx_log_debug1(NGX_LOG_DEBUG_TCP, s->connection->log, 0, ^ src/core/ngx_log.h:93:28: note: in definition of macro ‘ngx_log_debug’ if ((log)->log_level & level)
^ /home/ronlam/Desktop/build/modules/nginx_tcp_proxy_module-master/ngx_tcp_session.c:519:5: note: in expansion of macro ‘ngx_log_debug1’ ngx_log_debug1(NGX_LOG_DEBUG_TCP, s->connection->log, 0, ^ make[1]: *** [objs/addon/nginx_tcp_proxy_module-master/ngx_tcp_session.o] Error 1

Source code of nginx_tcp_proxy_module is fetch from newest master. I don't think the patch is patching the right line of code.

ghost avatar Oct 21 '15 01:10 ghost

The issue is a bit dated but just a note for posterity sake -- the functionality of this module is available via the official nginx stream module which has been available since nginx-1.9.0.

lonetwin avatar Nov 19 '15 06:11 lonetwin

brew install nginx-full --with-tcp-proxy-module
==> Installing nginx-full from homebrew/nginx
==> Downloading http://nginx.org/download/nginx-1.10.0.tar.gz
Already downloaded: /Library/Caches/Homebrew/nginx-full-1.10.0.tar.gz
==> Downloading https://raw.githubusercontent.com/yaoweibin/nginx_tcp_proxy_module/v0.4.5/tcp.patch
######################################################################## 100.0%
==> Patching
==> Applying tcp.patch
patching file src/core/ngx_log.c
Hunk #1 FAILED at 66.
1 out of 1 hunk FAILED -- saving rejects to file src/core/ngx_log.c.rej
patching file src/core/ngx_log.h
Hunk #1 FAILED at 29.
Hunk #2 FAILED at 37.
2 out of 2 hunks FAILED -- saving rejects to file src/core/ngx_log.h.rej
patching file src/event/ngx_event_connect.h
Hunk #1 succeeded at 33 (offset 1 line).
Hunk #2 succeeded at 45 with fuzz 2 (offset 2 lines).
Error: Failure while executing: /usr/bin/patch -g 0 -f -p1 -i /private/tmp/nginx-full--patch-20160519-8613-1y224up/tcp.patch

denisgrib avatar May 19 '16 20:05 denisgrib

latest version fix the problem

medzeus2 avatar Aug 21 '16 01:08 medzeus2