Re: www/nginx-full failed with src/cxx_supportlib/IOTools/IOUtils.cpp:288:3: error: use of undeclared identifier 'random_shuffle'
Date: Sat, 29 Jul 2023 08:27:44 UTC
On 29 Jul 2023, at 10:09, KIRIYAMA Kazuhiko <kiri@truefc.org> wrote: > > > On Fri, 28 Jul 2023 17:37:42 +0900, > Dimitry Andric wrote: >> >> [1 <text/plain; us-ascii (quoted-printable)>] >> On 28 Jul 2023, at 03:45, KIRIYAMA Kazuhiko <kiri@truefc.org> wrote: >>> www/nginx-full failed with >>> "src/cxx_supportlib/IOTools/IOUtils.cpp:288:3: error: use of >>> undeclared identifier 'random_shuffle'" : >> >> std::random_shuffle has been removed from C++17, so either the code must be adjusted to use std::shuffle, or the port has to be compiled with C++14 or lower. Typically, you can add a line: >> >> USE_CXXSTD= c++14 >> >> to the port's Makefile, if the program respects CXXFLAGS. > > Unfortunatelly faild module (passenger) was in rake system > and CXXFLAGS must has been passed with EXTRA_PRE_CXXFLAGS : > > diff -urN /usr/ports/www/nginx/Makefile nginx/Makefile > --- /usr/ports/www/nginx/Makefile 2023-07-15 21:00:03.000000000 +0900 > +++ nginx/Makefile 2023-07-29 16:53:49.048687000 +0900 > @@ -240,6 +240,10 @@ > CFLAGS+= -DNDEBUG > .endif > > +.if ${PORT_OPTIONS:MPASSENGER} > +CONFIGURE_ENV+= EXTRA_PRE_CXXFLAGS="-std=c++14" > +.endif > + > # Fix build failure on clang >= 12 > .if ${PORT_OPTIONS:MHTTP_PERL} && ${OSVERSION} >= 1301000 > CFLAGS+= -Wno-compound-token-split-by-macro > > But this prefer to be done when CXX over c++14 so may be > changed like this : > > .if ${PORT_OPTIONS:MPASSENGER} && ${OSVERSION} >= xxxxxxx > CONFIGURE_ENV+= EXTRA_PRE_CXXFLAGS="-std=c++14" > .endif > > What should be take xxxxxxx number ? 1400091 (this is also documented on https://docs.freebsd.org/en/books/porters-handbook/versions/#versions-14), but in this case there is no real need to check the clang version or the operating system version. There is no harm in always compiling C++ code that was made for an earlier standard with -std=c++14. It also works for gcc. -Dimitry