Welcome! Log In Create A New Profile

Advanced

Re: Dynamic Modules - Support CXXFLAGS

Maxim Dounin
March 04, 2020 11:32AM
Hello!

On Fri, Feb 28, 2020 at 10:14:31AM +0100, Patrik Mada wrote:

> Dear NGINX developers,
>
> we are using C++ dynamic modules in our NGINX based servers,
> while multiple Debian distributions have to be supported.
> On older Debian distributions it is impossible to use more
> recent C++ standard, due to build defaulting to system provided
> clang package.
>
> Our developers stood before decision to either create wrappers
> around modern C++ libraries which would be compliant with older
> standards or write the entire logic using obsolete featureless
> language.
> Neither of these approaches is sustainable in terms of
> developers' productivity and long term maintenance.
>
> Would it be possible to consider a change in dynamic modules'
> build system, so that C++ flags may be provided?
> We propose a low intrusive changes concerning 3 files. The
> changes are backwards compatible: if CXX is not provided by an
> user, the build uses CC instead (as well as CFLAGS instead of
> CXXFLAGS).
>
> Would you be so kind and share your opinion on those? Please
> find attachment provided bellow (the patch was created using
> Quilt).

The most serious problem I see with this approach is that nginx
does not try to use C++ itself, and hence it will always fail to
properly detect and use separate C++ compiler and/or provide
reasonable C++ compiler flags. And, given that CXX might be set
to something completely different from CC, it does not look like a
problem which is easy to solve.

Further, as far as I see from your patch, it simply does not
try provide any flags at all, except those set explicitly with
CXXFLAGS. While this might work in your particular case, this
looks wrong, and certainly not in line with how things are handled
now, with CFLAGS set based on compiler unless explicitly
specified.

A better approach might be to either provide reasonable CFLAGS
(and/or --with-cc-opt) for a particular system, which will make it
compile your C++ code with the same compiler and compiler flags as
used to compile nginx itself. Or, if it is not possible for some
reason, to provide a config.make script to provide instructions on
how to compile your code independently.

--
Maxim Dounin
http://mdounin.ru/
_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel
Subject Author Views Posted

Dynamic Modules - Support CXXFLAGS Attachments

Patrik Mada 113 February 28, 2020 04:16AM

Re: Dynamic Modules - Support CXXFLAGS

Maxim Dounin 27 March 04, 2020 11:32AM



Sorry, you do not have permission to post/reply in this forum.

Online Users

Guests: 91
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