nginx 1.0.11 + upload module compile error.

didip nginx-forum at nginx.us
Sat Mar 3 18:00:01 UTC 2012


Hi all,

This is my nginx setup:

* nginx 1.0.11
* nginx-upload-module 2.2.0
(http://www.grid.net.ru/nginx/upload.en.html)

I can compile from source with --add-module flag on:

* OS X Snow Leopard (gcc version 4.2.1)
* Ubuntu 10.10 (gcc version 4.4.3)

But compilation failed on Kubuntu 11.10 (gcc version 4.6.1)

It failed because the http upload module defined a variable but the
compiler claimed it wasn't used and fails compilation.

Below is snippet inside ngx_http_upload_module.c

static ngx_int_t /* {{{ ngx_http_upload_merge_ranges */
ngx_http_upload_merge_ranges(ngx_http_upload_ctx_t *u,
ngx_http_upload_range_t *range_n) {

    int result;

    /* Some more code .... */

    // This is where it is being called.
    if(out_buf.file_pos < state_file->info.st_size) { result =
ftruncate(state_file->fd, out_buf.file_pos); }
}

If I change objs/Makefile to ignore warning, compilation works just
fine. But obviously nginx likes to compile with strict rules. Inside
objs/Makefile:

CFLAGS =  -pipe  -O -W -Wall -Wpointer-arith -Wno-unused-parameter
-Wunused-function -Wunused-variable -Wunused-value -Werror

So my questions are:

* Is this the module's fault?

* Different gcc versions works differently? (I'm a noob in C)

* Is there a way to fix it without editing objs/Makefile? I prefer to
keep nginx source code as-is. And I'm ok to change the source code of
the module because it looks abandoned anyway.

Posted at Nginx Forum: http://forum.nginx.org/read.php?2,223298,223298#msg-223298



More information about the nginx mailing list