Welcome! Log In Create A New Profile

Advanced

nginx 1.0.11 + upload module compile error.

March 03, 2012 01:00PM
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.
Subject Author Posted

nginx 1.0.11 + upload module compile error.

didip March 03, 2012 01:00PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 62
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready