Welcome! Log In Create A New Profile

Advanced

Re: Configuring nginx with g++

Maxim Dounin
November 10, 2010 08:48PM
Hello!

On Wed, Nov 10, 2010 at 06:59:44PM -0500, Decimus Phostle wrote:

> 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.

While this particular error probably should be fixed (it's as
trivial as including stdio.h into test in auto/types/sizeof) - in
general using C++ compiler to compile C code isn't going to
produce anything good. These are two different languages.

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

Just create source file with appropriate extension and include
nginx header files in an extern "C" block, then write C++ code.
See src/misc/ngx_cpp_test_module.cpp for an example (really simple
one though).

Maxim Dounin

_______________________________________________
nginx mailing list
nginx@nginx.org
http://nginx.org/mailman/listinfo/nginx
Subject Author Posted

Configuring nginx with g++

Decimus Phostle November 10, 2010 07:26PM

Re: Configuring nginx with g++

Maxim Dounin November 10, 2010 08:48PM

Re: Configuring nginx with g++

Decimus Phostle November 10, 2010 09:40PM

Re: Configuring nginx with g++

Piotr Sikora November 10, 2010 11:18PM

Re: Configuring nginx with g++

Maxim Dounin November 10, 2010 11:24PM

Re: Configuring nginx with g++

Decimus Phostle November 11, 2010 06:08PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 179
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready