Configuring nginx with g++

Decimus Phostle decimusphostle at gmail.com
Thu Nov 11 02:59:44 MSK 2010


Hello,

Q1) I have been trying to compile nginx using the C++ compiler as follows:

$ ./configure --with-cc=g++ --add-module=/path/to/module --prefix=/some/prefix

(Also, tried "CC=g++ ./configure ...").

Both these commands result in this error:

...
creating objs/Makefile
checking for int size ...
./configure: error: can not detect int size
$

On tail'ing the objs/autoconf.err, the error is obvious(details
below). How do I go about fixing this? And/or is this fixed in a later
release? (I am using 0.8.52). Please let me know.

Q2) The above issue was encountered while trying to write a
handler/module in C++. Is there another way I should be approaching
this?

Please let me know. Any help would be much appreciated.

Thanks,
DP


-------------------------------------------------------------------------------------------------------------
PS:

Details of int size error:


$ tail -23 objs/autoconf.err
----------------------------------------
checking for int size

objs/autotest.c: In function 'int main()':
objs/autotest.c:11: error: 'printf' was not declared in this scope
----------

#include <sys/types.h>
#include <sys/time.h>
#include <unistd.h>
#include <signal.h>
#include <sys/resource.h>
#include <inttypes.h>


int main() {
    printf("%d", sizeof(int));
    return 0;
}

----------
g++ -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -o objs/autotest objs/autotest.c
----------
$




More information about the nginx mailing list