Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I'm attempting to compile nginx (version 1.0.11) with gridfs support (nginx-gridfs version 0.8) on Ubuntu 11.10 (gcc version 4.6) using the nginx module here:

https://github.com/mdirolf/nginx-gridfs

The installation instructions described there are simple:

* Clone the nginx-gridfs repository (`git clone https://github.com/mdirolf/nginx-gridfs`)
* Check out the mongo-c-driver submodule (`git submodule init` then `git submodule update`)
* Download and unpack the nginx source (from `http://nginx.org/download/nginx-1.0.11.tar.gz`)
* Run `./configure` with `--add-module=/path/to/nginx-gridfs/repository`
* `make` and `sudo make install`

These steps worked fine for me last time I set up nginx-gridfs on a machine (about four months ago on Ubuntu 10.04, with gcc 4.5 and nginx version 1.0.5), but now (on a fresh Ubuntu install) I'm getting an error. The ./configure is working fine, but make fails with:

/path/to/nginx-gridfs/mongo-c-driver/src/mongo.c: In function 'mongo_count':
/path/to/nginx-gridfs/mongo-c-driver/src/mongo.c:939:5: error: missing initializer [-Werror=missing-field-initializers]
/path/to/nginx-gridfs/mongo-c-driver/src/mongo.c:939:5: error: (near initialization for 'out.dataSize') [-Werror=missing-field-initializers]
/path/to/nginx-gridfs/mongo-c-driver/src/mongo.c: In function 'mongo_simple_int_command':
/path/to/nginx-gridfs/mongo-c-driver/src/mongo.c:981:5: error: missing initializer [-Werror=missing-field-initializers]
/path/to/nginx-gridfs/mongo-c-driver/src/mongo.c:981:5: error: (near initialization for 'out.dataSize') [-Werror=missing-field-initializers]
/path/to/nginx-gridfs/mongo-c-driver/src/mongo.c: In function 'mongo_simple_str_command':
/path/to/nginx-gridfs/mongo-c-driver/src/mongo.c:1013:5: error: missing initializer [-Werror=missing-field-initializers]
/path/to/nginx-gridfs/mongo-c-driver/src/mongo.c:1013:5: error: (near initialization for 'out.dataSize') [-Werror=missing-field-initializers]
/path/to/nginx-gridfs/mongo-c-driver/src/mongo.c: In function 'mongo_cmd_get_error_helper':
/path/to/nginx-gridfs/mongo-c-driver/src/mongo.c:1055:5: error: missing initializer [-Werror=missing-field-initializers]
/path/to/nginx-gridfs/mongo-c-driver/src/mongo.c:1055:5: error: (near initialization for 'out.dataSize') [-Werror=missing-field-initializers]
/path/to/nginx-gridfs/mongo-c-driver/src/mongo.c: In function 'mongo_cmd_ismaster':
/path/to/nginx-gridfs/mongo-c-driver/src/mongo.c:1098:5: error: missing initializer [-Werror=missing-field-initializers]
/path/to/nginx-gridfs/mongo-c-driver/src/mongo.c:1098:5: error: (near initialization for 'out.dataSize') [-Werror=missing-field-initializers]
cc1: all warnings being treated as errors
make[1]: *** [objs/addon/src/mongo.o] Error 1

Any idea why this would fail?

The cc1: all warnings being treated as errors leads me to believe that I may be able to add -Wno-error to CFLAGS to tell it not treat warnings as errors to avoid this issue. But I'm worried that treat-warnings-as-errors is enabled here for a reason, and that turning it off would only make the compilation successful on the surface, but not actually work.

Anyone know what's going on here?

share|improve this question

migrated from superuser.com Dec 31 '11 at 5:26

This question came from our site for computer enthusiasts and power users.

    
Adding --with-cc-opt=-Wno-error did allow the make to complete successfully. I will report back if this results in any problems. –  Ben Lee Dec 27 '11 at 5:23
    
Having this same issue. Please do report! –  jdi Jan 2 '12 at 21:28
    
So far, no problems using the solution in my comment. –  Ben Lee Jan 3 '12 at 4:52
    
--with-cc-opt=-Wno-missing-field-initializers is a bit more specific. –  NickZoic Nov 21 '12 at 5:27
add comment

1 Answer 1

up vote 3 down vote accepted

Using your ignore warnings methods made the compilation work but I would actually get failure to connect to the database with user/password errors in use. What worked for me was a combination of building mongo from scratch to supply nginx build with newer libs: http://pastebin.com/tMsL2eC9

But this wasnt actually enough. I also had to specifically check out mongo c driver v0.3.1 in the submodule of nginx-gridfs. So that is, v0.8 of nginx gridfs. V0.3.1 mongo c driver, and the fresh mongo build being references from the env specified in that link. Then I built nginx 1.0.11 with no errors and it worked.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.