Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

make build error with nginx 1.14.2 #167

Open
mingzhj opened this issue Dec 6, 2018 · 3 comments
Open

make build error with nginx 1.14.2 #167

mingzhj opened this issue Dec 6, 2018 · 3 comments

Comments

@mingzhj
Copy link

mingzhj commented Dec 6, 2018

nginx_tcp_proxy_module

版本号:./configure --add-module=nginx_tcp_proxy_module-master --with-pcre=pcre-8.42 --with-openssl=openssl-1.0.2q --with-zlib=zlib-1.2.11 --with-poll_module --prefix=/opt/bohui/nginx-1.14.2/run

nginx_tcp_proxy_module-master/ngx_tcp_core_module.c

nginx_tcp_proxy_module-master/ngx_tcp_core_module.c: In function ‘ngx_tcp_core_listen’:
nginx_tcp_proxy_module-master/ngx_tcp_core_module.c:487:9: error: cannot convert to a pointer type
if (ngx_memcmp(ls[i].sockaddr + off, u.sockaddr + off, len) != 0) {
^
nginx_tcp_proxy_module-master/ngx_tcp_core_module.c:507:5: error: incompatible type for argument 2 of ‘memcpy’
ngx_memcpy(ls->sockaddr, u.sockaddr, u.socklen);
^
In file included from src/os/unix/ngx_linux_config.h:27:0,
from src/core/ngx_config.h:26,
from nginx_tcp_proxy_module-master/ngx_tcp_core_module.c:2:
/usr/include/string.h:42:14: note: expected ‘const void * restrict’ but argument is of type ‘ngx_sockaddr_t’
extern void *memcpy (void *__restrict __dest, const void *__restrict __src,
^
make[1]: *** [objs/addon/nginx_tcp_proxy_module-master/ngx_tcp_core_module.o] Error 1
make[1]: Leaving directory `/opt/bohui/nginx-1.14.2'

@lev-gc
Copy link

lev-gc commented Jan 7, 2019

Read the README.
You should execute this command first:

patch -p1 < /path/to/nginx_tcp_proxy_module/tcp.patch

@dsugisawa-mixi
Copy link
Contributor

dsugisawa-mixi commented Jan 8, 2019

have a try, use the command

cd ../nginx_tcp_proxy_module
patch -p1 < my.patch 
cd nginx-1.14.2
patch -p1 < /path/to/nginx_tcp_proxy_module/tcp_1_8.patch

my.patch

diff --git a/ngx_tcp_core_module.c b/ngx_tcp_core_module.c
index 9e3110d..f1388ba 100644
--- a/ngx_tcp_core_module.c
+++ b/ngx_tcp_core_module.c
@@ -5,6 +5,9 @@
 #include <ngx_tcp.h>
 #include <nginx.h>
 
+#ifndef NGX_CONF_MULTI
+#define NGX_CONF_MULTI 0
+#endif
 
 static void *ngx_tcp_core_create_main_conf(ngx_conf_t *cf);
 static void *ngx_tcp_core_create_srv_conf(ngx_conf_t *cf);
@@ -481,7 +484,7 @@ ngx_tcp_core_listen(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
                 break;
         }
 
-        if (ngx_memcmp(ls[i].sockaddr + off, u.sockaddr + off, len) != 0) {
+        if (ngx_memcmp(ls[i].sockaddr + off, ((char*)&u.sockaddr) + off, len) != 0) {
             continue;
         }
 
@@ -501,7 +504,7 @@ ngx_tcp_core_listen(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
 
     ngx_memzero(ls, sizeof(ngx_tcp_listen_t));
 
-    ngx_memcpy(ls->sockaddr, u.sockaddr, u.socklen);
+    ngx_memcpy(ls->sockaddr, &u.sockaddr, u.socklen);
 
     ls->socklen = u.socklen;
     ls->wildcard = u.wildcard;

@yaoweibin
Copy link
Owner

Try the latest branch, thanks @dsugisawa-mixi

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants