On Thu, Oct 12, 2023 at 12:19 AM Nathan Hartman wrote:
> On Wed, Oct 11, 2023 at 3:21 PM Tomek CEDRO wrote:
> > Hello world,
> > I have encountered a basic esp32:nsh build error in nuttx-12.3.0-RC0
> > related to xtensa g++ 8.4.0 compiler:
> > xtensa-esp32-elf-g++: error: unrecognized command line option
> > '-std=gnu++20'; did you mean '-std=gnu++2a'?
>
> This was changed in d6453cfc3cd4771a5221528cab3056660be4b1e3 (PR # 8244).
>
> See mail thread:
> https://lists.apache.org/thread/rkq99os8ql28bv1w8fy5mdqwl3h2vp6m
>
> The workaround is to set Kconfig CXX_STANDARD to gnu++2a instead of gnu++20.

Thank you Nathan :-)

I am following the mailing list and github PRs so I know this was
recent change to make better compatibility with C++ and this is fine
to have this support. But this should not happen at the cost of
standard build setup and/or enforcing specific compilers / versions to
everyone by default (see inviolables). This probably also impacts
other platforms/architectures, especially the older ones. I am sure
this can be fixed easily.

I am sorry for giving my first -1 as I know there are many new
features and improvements in the RC, but I am afraid if we don't fix
that compiler problem now then there will be no incentive to do this
in future.


> It would be nice if the build system could automatically detect the
> compiler version and set this value accordingly and automatically,
> without a Kconfig. IIRC there are programs in tools that determine
> compiler options based on the compiler and version. (Can't remember
> details off the top of my head at the moment.)

Yes that would be perfect!

Quick search shows that people do this in many ways by calling
compiler with a list of flags and checking return status for each flag
to see if it is supported.

Current C++ standards supported by GCC and CLANG are listed here:
https://gcc.gnu.org/projects/cxx-status.html
https://clang.llvm.org/cxx_status.html

Quote from GCC:
C++20 Support in GCC
GCC has experimental support for the latest revision of the C++
standard, which was published in 2020. The status of C++20 library
features is described in the library documentation.
C++20 features are available since GCC 8. To enable C++20 support, add
the command-line parameter -std=c++20 (use -std=c++2a in GCC 9 and
earlier) to your g++ command line. Or, to enable GNU extensions in
addition to C++20 features, add -std=gnu++20.

Maybe a simple check can be added to a Makefile?

Maybe a C++ support could be added as option that is disabled by
default (+compiler check)?


> > REMARKS:
> > 1. flock is a new system build dependency.
>
> I think documentation needs to be updated? I think not all systems
> have flock. Is it a Linux-only thing? (Non-BSD?)

Not a big deal I guess :-) As compared to 12.2.1 in order to build
12.3.0-RC0 I had to install additional "flock" application. It comes
from Linux and it is available on FreeBSD. On macOS (BSD) it is not
part of the base system too and it can be installed with brew. It
seems to be fairly old commit that fixes parallel build (which I also
use). Just a notice :-)

https://github.com/apache/nuttx-apps/blob/91a682f11bba1a537bd095cef45f17db57c9e7b9/Make.defs#L157
https://github.com/apache/nuttx-apps/commit/f774e8ee7202a61bcf64a93b2f3ddfd240288cf1

Thank you :-)
Tomek

-- 
CeDeROM, SQ7MHZ, http://www.tomek.cedro.info

Reply via email to