cnken / substitutions4nginx

Automatically exported from code.google.com/p/substitutions4nginx
3 stars 3 forks source link

Build fails on Windows environment #18

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Hello,

I am building from native nginx sources and almost all modules as well as 
native source builds fine however substitutions4nginx fails !

What steps will reproduce the problem?

1. Checkout latest code from svn
2. Prepare a win32 build environment
3. The following build trace error issue occurs.

What is the expected output? What do you see instead?

        cl -c -O2  -W0 -nologo -MT -Zi -DFD_SETSIZE=1024 -Yungx_config.h -Fpobjs/ngx_config.pch -I src/core  -I src/event  -I src/event/modules  -I src/os/win32  -I objs/modules/substitution
s4nginx-read-only//modules  -I objs/modules/substitutions4nginx-read-only/  -I 
objs/lib/pcre-8.31  -I objs/lib/zlib-1.2.7  -I objs  -I src/http  -I 
src/http/modules  -I src/mail  -Foobjs/src
/http/modules/ngx_http_upstream_keepalive_module.obj  
src/http/modules/ngx_http_upstream_keepalive_module.c
ngx_http_upstream_keepalive_module.c
        cl -c -O2  -W0 -nologo -MT -Zi -DFD_SETSIZE=1024 -Yungx_config.h -Fpobjs/ngx_config.pch -I src/core  -I src/event  -I src/event/modules  -I src/os/win32  -I objs/modules/substitutions4nginx-read-only//modules  -I objs/modules/substitutions4nginx-read-only/  -I objs/lib/pcre-8.31  -I objs/lib/zlib-1.2.7  -I objs  -I src/http  -I src/http/modules  -I src/mail  -Foobjs/addon/substitutions4nginx-read-only/ngx_http_subs_filter_module.obj  objs/modules/substitutions4nginx-read-only//ngx_http_subs_filter_module.c
ngx_http_subs_filter_module.c

objs/modules/substitutions4nginx-read-only//ngx_http_subs_filter_module.c(1233) 
: error C2275: 'ngx_str_t' : illegal use of this type as an expression
        c:\Users\Administrator\nginx\release-1.3.4\src\core\ngx_string.h(19) : see declaration of 'ngx_str_t'
objs/modules/substitutions4nginx-read-only//ngx_http_subs_filter_module.c(1233) 
: error C2146: syntax error : missing ';' before identifier 'err'
objs/modules/substitutions4nginx-read-only//ngx_http_subs_filter_module.c(1233) 
: error C2065: 'err' : undeclared identifier
objs/modules/substitutions4nginx-read-only//ngx_http_subs_filter_module.c(1234) 
: error C2275: 'u_char' : illegal use of this type as an expression
        C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\include\winsock2.h(103) : see declaration of 'u_char'
objs/modules/substitutions4nginx-read-only//ngx_http_subs_filter_module.c(1234) 
: error C2146: syntax error : missing ';' before identifier 'errstr'
objs/modules/substitutions4nginx-read-only//ngx_http_subs_filter_module.c(1234) 
: error C2065: 'errstr' : undeclared identifier
objs/modules/substitutions4nginx-read-only//ngx_http_subs_filter_module.c(1234) 
: error C2109: subscript requires array or pointer type
objs/modules/substitutions4nginx-read-only//ngx_http_subs_filter_module.c(1236) 
: error C2065: 'err' : undeclared identifier
objs/modules/substitutions4nginx-read-only//ngx_http_subs_filter_module.c(1236) 
: error C2224: left of '.len' must have struct/union type
objs/modules/substitutions4nginx-read-only//ngx_http_subs_filter_module.c(1237) 
: error C2065: 'err' : undeclared identifier
objs/modules/substitutions4nginx-read-only//ngx_http_subs_filter_module.c(1237) 
: error C2224: left of '.data' must have struct/union type
objs/modules/substitutions4nginx-read-only//ngx_http_subs_filter_module.c(1237) 
: error C2065: 'errstr' : undeclared identifier
objs/modules/substitutions4nginx-read-only//ngx_http_subs_filter_module.c(1243) 
: error C2275: 'ngx_regex_compile_t' : illegal use of this type as an expression
        c:\Users\Administrator\nginx\release-1.3.4\src\core\ngx_regex.h(40) : see declaration of 'ngx_regex_compile_t'
objs/modules/substitutions4nginx-read-only//ngx_http_subs_filter_module.c(1243) 
: error C2146: syntax error : missing ';' before identifier 'rc'
objs/modules/substitutions4nginx-read-only//ngx_http_subs_filter_module.c(1243) 
: error C2065: 'rc' : undeclared identifier
objs/modules/substitutions4nginx-read-only//ngx_http_subs_filter_module.c(1245) 
: error C2065: 'rc' : undeclared identifier
objs/modules/substitutions4nginx-read-only//ngx_http_subs_filter_module.c(1245) 
: error C2224: left of '.pattern' must have struct/union type
objs/modules/substitutions4nginx-read-only//ngx_http_subs_filter_module.c(1246) 
: error C2065: 'rc' : undeclared identifier
objs/modules/substitutions4nginx-read-only//ngx_http_subs_filter_module.c(1246) 
: error C2224: left of '.pool' must have struct/union type
objs/modules/substitutions4nginx-read-only//ngx_http_subs_filter_module.c(1247) 
: error C2065: 'rc' : undeclared identifier
objs/modules/substitutions4nginx-read-only//ngx_http_subs_filter_module.c(1247) 
: error C2224: left of '.err' must have struct/union type
objs/modules/substitutions4nginx-read-only//ngx_http_subs_filter_module.c(1247) 
: error C2065: 'err' : undeclared identifier
objs/modules/substitutions4nginx-read-only//ngx_http_subs_filter_module.c(1248) 
: error C2065: 'rc' : undeclared identifier
objs/modules/substitutions4nginx-read-only//ngx_http_subs_filter_module.c(1248) 
: error C2224: left of '.options' must have struct/union type
objs/modules/substitutions4nginx-read-only//ngx_http_subs_filter_module.c(1250) 
: error C2065: 'rc' : undeclared identifier
objs/modules/substitutions4nginx-read-only//ngx_http_subs_filter_module.c(1251) 
: error C2065: 'rc' : undeclared identifier
objs/modules/substitutions4nginx-read-only//ngx_http_subs_filter_module.c(1251) 
: error C2224: left of '.err' must have struct/union type
objs/modules/substitutions4nginx-read-only//ngx_http_subs_filter_module.c(1255) 
: error C2065: 'rc' : undeclared identifier
objs/modules/substitutions4nginx-read-only//ngx_http_subs_filter_module.c(1255) 
: error C2224: left of '.regex' must have struct/union type
objs/modules/substitutions4nginx-read-only//ngx_http_subs_filter_module.c(1262) 
: error C2065: 'err' : undeclared identifier
NMAKE : fatal error U1077: '"c:\Program Files (x86)\Microsoft Visual Studio 
10.0\VC\BIN\cl.EXE"' : return code '0x2'
Stop.

What version of the product are you using? On what operating system?

MINGW, MS Visual Studio C#/C++, NGINX-1.3.4

Original issue reported on code.google.com by ultimate...@gmail.com on 14 Aug 2012 at 5:08

GoogleCodeExporter commented 9 years ago
I'm just refactoring this module, can you try the latest code from github? 
https://github.com/yaoweibin/ngx_http_substitutions_filter_module

Original comment by yaoweibin@gmail.com on 14 Aug 2012 at 3:53

GoogleCodeExporter commented 9 years ago
Thanks for pointing out your new module, however the issue still persists there.

I opened an issue there on github.

Thanks!

Original comment by ultimate...@gmail.com on 15 Aug 2012 at 2:01

GoogleCodeExporter commented 9 years ago
原因:由于c的编译器要求将变量的声名放在一个函数块的头�
��,而c++没有这样的要求造成的。
把声名的三个变量放到函数的开头就可以了,
ngx_str_t         err;
u_char            errstr[NGX_MAX_CONF_ERRSTR];
ngx_regex_compile_t   rc;

放到这个函数的头部就行 即
static ngx_int_t
ngx_http_subs_filter_regex_compile(sub_pair_t *pair,
    ngx_http_script_compile_t *sc, ngx_conf_t *cf)
{
ngx_str_t         err;
u_char            errstr[NGX_MAX_CONF_ERRSTR];
ngx_regex_compile_t   rc;

Original comment by zengf...@gmail.com on 7 Sep 2012 at 5:55

GoogleCodeExporter commented 9 years ago
MINGW, MS Visual Studio 2005 C#/C++, NGINX-1.2.4

objs/module/ngx_http_substitutions_filter_module/ngx_http_subs_filter_module.c(8
97) : error C2220: 警告被视为错误 - 没有生成“object”文件
objs/module/ngx_http_substitutions_filter_module/ngx_http_subs_filter_module.c(8
97) : warning C4244: “=”: 
从“off_t”转换到“size_t”,可能丢失数据

Original comment by sos801...@gmail.com on 23 Oct 2012 at 3:53