pdns
pdns copied to clipboard
Compile yahttp with C++11 support.
Short description
Reduce compiler noise related to boost yahttp compilation by trying to compile yahttp with Cpp11 support. This noise also renders impossible a run with -fanalyzer
because it goes crazy with memory allocation due to boost warning.
Addition: It's compiling under gcc12 before and after the change.
Checklist
I have:
- [x] read the CONTRIBUTING.md document
- [x] compiled this code
- [x] tested this code (will do it monday)
- [ ] included documentation (including possible behaviour changes)
- [x] documented the code
- [ ] added or modified regression test(s)
- [ ] added or modified unit test(s)
My version of gcc:
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-pc-linux-gnu/12.1.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: /build/gcc/src/gcc/configure --enable-languages=c,c++,ada,fortran,go,lto,objc,obj-c++ --enable-bootstrap --prefix=/usr --libdir=/usr/lib --libexecdir=/usr/lib --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=https://bugs.archlinux.org/ --with-linker-hash-style=gnu --with-system-zlib --enable-__cxa_atexit --enable-cet=auto --enable-checking=release --enable-clocale=gnu --enable-default-pie --enable-default-ssp --enable-gnu-indirect-function --enable-gnu-unique-object --enable-linker-build-id --enable-lto --enable-multilib --enable-plugin --enable-shared --enable-threads=posix --disable-libssp --disable-libstdcxx-pch --disable-werror --with-build-config=bootstrap-lto --enable-link-serialization=1
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 12.1.0 (GCC)
And the configure build I would run: (with or without -O3
or with or without -fanalyzer
)
./configure --with-modules="" --disable-lua-records CFLAGS="-fsanitize=address" LDDFLAGS="-fsanitize=address" CXXFLAGS="-O3 -Wextra -Wall -W -Wall -std=c++17 -fsanitize=address" --enable-ubsan --enable-malloc-trace --enable-lsan --enable-asan --enable-coverage
Exemple of the compiler noise I get with GCC12:
make[4]: Entering directory '/home/darnuria/programmation/pdns/ext/yahttp/yahttp'
CXX reqresp.lo
CXX router.lo
In file included from /usr/include/string.h:535,
from /usr/include/c++/12.1.0/cstring:42,
from /usr/include/boost/assert/source_location.hpp:17,
from /usr/include/boost/exception/exception.hpp:9,
from /usr/include/boost/throw_exception.hpp:21,
from /usr/include/boost/function/detail/prologue.hpp:15,
from /usr/include/boost/function.hpp:30,
from reqresp.hpp:7,
from yahttp.hpp:19,
from reqresp.cpp:1:
In function 'void* memcpy(void*, const void*, size_t)',
inlined from 'void boost::function3<R, T1, T2, T3>::move_assign(boost::function3<R, T1, T2, T3>&) [with R = long unsigned int; T0 = const YaHTTP::HTTPBase*; T1 = std::basic_ostream<char>&; T2 = bool]' at /usr/include/boost/function/function_template.hpp:1008:24,
inlined from 'void boost::function3<R, T1, T2, T3>::swap(boost::function3<R, T1, T2, T3>&) [with R = long unsigned int; T0 = const YaHTTP::HTTPBase*; T1 = std::basic_ostream<char>&; T2 = bool]' at /usr/include/boost/function/function_template.hpp:862:22,
inlined from 'typename boost::enable_if_<(! boost::is_integral<Functor>::value), boost::function<R(T0, T1, T2)>&>::type boost::function<R(T0, T1, T2)>::operator=(Functor) [with Functor = YaHTTP::HTTPBase::SendBodyRender; R = long unsigned int; T0 = const YaHTTP::HTTPBase*; T1 = std::basic_ostream<char>&; T2 = bool]' at /usr/include/boost/function/function_template.hpp:1147:22,
inlined from 'virtual void YaHTTP::HTTPBase::initialize()' at reqresp.hpp:106:33:
/usr/include/bits/string_fortified.h:29:33: warning: '*(unsigned char (*)[24])((char*)&<unnamed> + offsetof(boost::self_type, boost::function<long unsigned int(const YaHTTP::HTTPBase*, std::basic_ostream<char, std::char_traits<char> >&, bool)>::<unnamed>.boost::function3<long unsigned int, const YaHTTP::HTTPBase*, std::basic_ostream<char, std::char_traits<char> >&, bool>::<unnamed>.boost::function_base::functor))' is used uninitialized [-Wuninitialized]
29 | return __builtin___memcpy_chk (__dest, __src, __len,
| ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
30 | __glibc_objsize0 (__dest));
| ~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/boost/function/detail/maybe_include.hpp:36,
from /usr/include/boost/function/detail/function_iterate.hpp:14,
from /usr/include/boost/preprocessor/iteration/detail/iter/limits/forward1_256.hpp:29,
from /usr/include/boost/preprocessor/iteration/detail/iter/forward1.hpp:1343,
from /usr/include/boost/function.hpp:70:
With the changes I only get:
make[4]: Entering directory '/home/darnuria/programmation/pdns/ext/yahttp/yahttp'
CXX reqresp.lo
CXX router.lo
CXXLD libyahttp.la
make[4]: Leaving directory '/home/darnuria/programmation/pdns/ext/yahttp/yahttp'
Related #11234.
Warning to the reviewer, my config build generate A LOT of warning and may go out of memory. Do not use with make -jX
I have 32Go and got OOM'ed I may make some Issue about fanalyzer
complaining.
@zeha
Related #11234.
(added in PR description) on 9c9e6a1dc3929201e8205a4814407f0352c368e9
It's compiling under gcc12 before and after the change.
Auth builds fail with errors like these:
In file included from common_startup.cc:26:
In file included from ./ws-auth.hh:29:
./webserver.hh:27:10: fatal error: 'yahttp/yahttp.hpp' file not found
#include <yahttp/yahttp.hpp>
^~~~~~~~~~~~~~~~~~~
1 error generated.
make[3]: *** [Makefile:3381: common_startup.o] Error 1
Also I spotted a mismatch on commas in the configure.ac files.
Also I spotted a mismatch on commas in the configure.ac files.
My bad thanks for your sharp eye review.
I Will make a all module build
I Will make a all module build
Cool, thanks.
I was wondering how you tested this, because your initial message shows a ./configure
line for auth, yet auth doesn't build. Maybe there's some autoconf thing going on?
I did:
I edited the ./configure
iotuibs to reduce checks -fanalyzer
was doing only reporting on boost things
make clean
autoreconf -vi
/configure --with-modules="" --disable-lua-records CFLAGS="-fsanitize=address -DHAVE_CXX11" LDDFLAGS="-fsanitize=address" CXXFLAGS="-O3 -Wextra -Wall -fsanitize=address" --enable-ubsan --enable-malloc-trace --enable-lsan --enable-asan --enable-coverage
Ended well with this summary output:
configure: =====================
configure:
configure: Configured with: '--with-modules=' '--disable-lua-records' 'CFLAGS=-fsanitize=address -DHAVE_CXX11' 'LDDFLAGS=-fsanitize=address' 'CXXFLAGS=-O3 -Wextra -Wall -fsanitize=address' '--enable-ubsan' '--enable-malloc-trace' '--enable-lsan' '--enable-asan' '--enable-coverage' 'PKG_CONFIG_PATH=/home/darnuria/local/lib/pkgconfig/'
configure:
configure: CC: gcc
configure: CXX: g++ -std=c++17
configure: LD: /usr/sbin/ld -m elf_x86_64
configure: CFLAGS: -fsanitize=undefined -fsanitize=leak -fsanitize=address -fPIE -DPIE -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 --param ssp-buffer-size=4 -fstack-protector -g -O2 -Wall -Wextra -Wshadow -Wno-unused-parameter -Wmissing-declarations -Wredundant-decls -fsanitize=address -DHAVE_CXX11
configure: CPPFLAGS:
configure: CXXFLAGS: -fsanitize=undefined -fsanitize=leak -fsanitize=address -fPIE -DPIE -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 --param ssp-buffer-size=4 -fstack-protector -g -O2 -Wall -Wextra -Wshadow -Wno-unused-parameter -Wmissing-declarations -Wredundant-decls -O3 -Wextra -Wall -fsanitize=address -U_FORTIFY_SOURCE -g -O0 -fprofile-arcs -ftest-coverage
configure: LDFLAGS: -Wl,-z -Wl,relro -Wl,-z -Wl,now
configure: LIBS:
configure: BOOST_CPPFLAGS:
configure:
configure: Extras enabled
configure: --------------
configure: Tools: no
configure: ixfrdist: no
configure:
configure: Server Features enabled
configure: -----------------------
configure: Built-in modules:
configure: Dynamic modules: pipe
configure:
configure: OpenSSL ecdsa: yes
configure: ed25519: yes
configure: ed448: yes
configure: SQLite3: no
configure: Lua: luajit
configure: systemd: yes
configure:
launched make -j4
make all-recursive
make[1]: Entering directory '/home/darnuria/programmation/pdns'
Making all in ext
make[2]: Entering directory '/home/darnuria/programmation/pdns/ext'
Making all in ipcrypt
make[3]: Entering directory '/home/darnuria/programmation/pdns/ext/ipcrypt'
CC ipcrypt.lo
CCLD libipcrypt.la
make[3]: Leaving directory '/home/darnuria/programmation/pdns/ext/ipcrypt'
Making all in json11
make[3]: Entering directory '/home/darnuria/programmation/pdns/ext/json11'
CXX json11.lo
CXXLD libjson11.la
make[3]: Leaving directory '/home/darnuria/programmation/pdns/ext/json11'
Making all in yahttp
make[3]: Entering directory '/home/darnuria/programmation/pdns/ext/yahttp'
Making all in yahttp
make[4]: Entering directory '/home/darnuria/programmation/pdns/ext/yahttp/yahttp'
CXX reqresp.lo
CXX router.lo
CXXLD libyahttp.la
make[4]: Leaving directory '/home/darnuria/programmation/pdns/ext/yahttp/yahttp'
make[4]: Entering directory '/home/darnuria/programmation/pdns/ext/yahttp'
make[4]: Nothing to be done for 'all-am'.
make[4]: Leaving directory '/home/darnuria/programmation/pdns/ext/yahttp'
make[3]: Leaving directory '/home/darnuria/programmation/pdns/ext/yahttp'
make[3]: Entering directory '/home/darnuria/programmation/pdns/ext'
make[3]: Nothing to be done for 'all-am'.
make[3]: Leaving directory '/home/darnuria/programmation/pdns/ext'
make[2]: Leaving directory '/home/darnuria/programmation/pdns/ext'
Making all in modules
make[2]: Entering directory '/home/darnuria/programmation/pdns/modules'
Making all in pipebackend
make[3]: Entering directory '/home/darnuria/programmation/pdns/modules/pipebackend'
CXX coprocess.lo
CXX pipebackend.lo
CXXLD libpipebackend.la
make[3]: Leaving directory '/home/darnuria/programmation/pdns/modules/pipebackend'
make[3]: Entering directory '/home/darnuria/programmation/pdns/modules'
make[3]: Nothing to be done for 'all-am'.
make[3]: Leaving directory '/home/darnuria/programmation/pdns/modules'
make[2]: Leaving directory '/home/darnuria/programmation/pdns/modules'
Making all in pdns
make[2]: Entering directory '/home/darnuria/programmation/pdns/pdns'
./incfiles api-swagger.yaml api-swagger.json > apidocfiles.h
make all-am
make[3]: Entering directory '/home/darnuria/programmation/pdns/pdns'
CXX arguments.o
CXX dnslabeltext.o
CXX dnsname.o
CXX dynloader.o
CXX dynmessenger.o
CXX logger.o
CXX misc.o
CXX qtype.o
CXX statbag.o
CXX unix_utility.o
CXX auth-caches.o
CXX auth-packetcache.o
CXX auth-querycache.o
CXX auth-zonecache.o
CXX backends/gsql/gsqlbackend.o
CXX base32.o
CXX base64.o
CC bindlexer.o
CXX bindparser.o
CXX credentials.o
CXX dbdnsseckeeper.o
bindparser.cc:273:5: warning: redundant redeclaration of ‘int yyparse()’ in same scope [-Wredundant-decls]
273 | int yyparse (void);
| ^~~~~~~
bindparser.yy:22:13: note: previous declaration of ‘int yyparse()’
22 | int yyparse(void);
| ^~~~~~~
bindparser.cc: In function ‘int yyparse()’:
bindparser.cc:1620:18: warning: ‘void free(void*)’ called on unallocated object ‘yyssa’ [-Wfree-nonheap-object]
1620 | YYSTACK_FREE (yyss);
bindparser.cc:1119:16: note: declared here
1119 | yy_state_t yyssa[YYINITDEPTH];
| ^~~~~
CXX dns.o
CXX dns_random.o
CXX dnsbackend.o
CXX dnspacket.o
CXX dnsparser.o
CXX dnsrecords.o
CXX dnssecinfra.o
CXX dnssecsigner.o
CXX dnswriter.o
CXX dynlistener.o
CXX ednscookies.o
CXX ednsoptions.o
CXX ednssubnet.o
CXX ipcipher.o
CXX iputils.o
CXX json.o
CXX lua-auth4.o
CXX lua-base4.o
CXX nsecrecords.o
CXX opensslsigners.o
CXX pdnsutil.o
CXX rcpgenerator.o
CXX serialtweaker.o
CXX shuffle.o
CXX signingpipe.o
CXX sillyrecords.o
CXX stubresolver.o
CXX svc-records.o
CXX threadname.o
CXX tsigutils.o
CXX ueberbackend.o
CXX uuid-utils.o
CXX zonemd.o
CXX zoneparser-tng.o
CXX sodiumsigners.o
CXX dns_random_urandom.o
CXX zone2sql.o
CXX zone2json.o
CXX auth-carbon.o
CXX axfr-retriever.o
CXX common_startup.o
CXX communicator.o
CXX dnsproxy.o
In file included from ws-auth.hh:29,
from common_startup.cc:26:
webserver.hh:27:10: fatal error: yahttp/yahttp.hpp: No such file or directory
27 | #include <yahttp/yahttp.hpp>
| ^~~~~~~~~~~~~~~~~~~
compilation terminated.
make[3]: *** [Makefile:3383: common_startup.o] Error 1
make[3]: *** Waiting for unfinished jobs....
make[3]: Leaving directory '/home/darnuria/programmation/pdns/pdns'
make[2]: *** [Makefile:2834: all] Error 2
make[2]: Leaving directory '/home/darnuria/programmation/pdns/pdns'
make[1]: *** [Makefile:597: all-recursive] Error 1
make[1]: Leaving directory '/home/darnuria/programmation/pdns'
make: *** [Makefile:529: all] Error 2
Had the same faillure but yahttp
was compiled without issue in the logs.
See next comment ~~Ok fixed it. It was auto-tool wizardry... Doc ASC_SUBST~~
~~It compile well for me, it's important to run:~~
autoconf xi
make clean
# Don't think the options change that much will try tomorrow without my custom options
/configure --with-modules="" --disable-lua-records CFLAGS="-fsanitize=address" LDDFLAGS="-fsanitize=address" CXXFLAGS="-O3 -Wextra -Wall -fsanitize=address" --enable-ubsan --enable-malloc-trace --enable-lsan --enable-asan --enable-coverage
make -j4
```~~
Definitively not was I was expecting make V=1 -j4
:
make[4]: Entering directory '/home/darnuria/programmation/pdns/ext/yahttp/yahttp'
depbase=`echo reqresp.lo | sed 's|[^/]*$|.deps/&|;s|\.lo$||'`;\
/bin/sh ../../../libtool --tag=CXX --mode=compile g++ -std=c++17 -DHAVE_CONFIG_H -I. -I../../.. -I../../.. -I../../.. -pthread -fsanitize=undefined -fsanitize=leak -fsanitize=address -fPIE -DPIE -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 --param ssp-buffer-size=4 -fstack-protector -g -O2 -Wall -Wextra -Wshadow -Wno-unused-parameter -Wmissing-declarations -Wredundant-decls -O3 -Wextra -Wall -fsanitize=address -U_FORTIFY_SOURCE -g -O0 -fprofile-arcs -ftest-coverage -MT reqresp.lo -MD -MP -MF $depbase.Tpo -c -o reqresp.lo reqresp.cpp &&\
mv -f $depbase.Tpo $depbase.Plo
depbase=`echo router.lo | sed 's|[^/]*$|.deps/&|;s|\.lo$||'`;\
/bin/sh ../../../libtool --tag=CXX --mode=compile g++ -std=c++17 -DHAVE_CONFIG_H -I. -I../../.. -I../../.. -I../../.. -pthread -fsanitize=undefined -fsanitize=leak -fsanitize=address -fPIE -DPIE -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 --param ssp-buffer-size=4 -fstack-protector -g -O2 -Wall -Wextra -Wshadow -Wno-unused-parameter -Wmissing-declarations -Wredundant-decls -O3 -Wextra -Wall -fsanitize=address -U_FORTIFY_SOURCE -g -O0 -fprofile-arcs -ftest-coverage -MT router.lo -MD -MP -MF $depbase.Tpo -c -o router.lo router.cpp &&\
mv -f $depbase.Tpo $depbase.Plo
libtool: compile: g++ -std=c++17 -DHAVE_CONFIG_H -I. -I../../.. -I../../.. -I../../.. -pthread -fsanitize=undefined -fsanitize=leak -fsanitize=address -DPIE -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 --param ssp-buffer-size=4 -fstack-protector -g -O2 -Wall -Wextra -Wshadow -Wno-unused-parameter -Wmissing-declarations -Wredundant-decls -O3 -Wextra -Wall -fsanitize=address -U_FORTIFY_SOURCE -g -O0 -fprofile-arcs -ftest-coverage -MT reqresp.lo -MD -MP -MF .deps/reqresp.Tpo -c reqresp.cpp -fPIC -DPIC -o .libs/reqresp.o
libtool: compile: g++ -std=c++17 -DHAVE_CONFIG_H -I. -I../../.. -I../../.. -I../../.. -pthread -fsanitize=undefined -fsanitize=leak -fsanitize=address -DPIE -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 --param ssp-buffer-size=4 -fstack-protector -g -O2 -Wall -Wextra -Wshadow -Wno-unused-parameter -Wmissing-declarations -Wredundant-decls -O3 -Wextra -Wall -fsanitize=address -U_FORTIFY_SOURCE -g -O0 -fprofile-arcs -ftest-coverage -MT router.lo -MD -MP -MF .deps/router.Tpo -c router.cpp -fPIC -DPIC -o .libs/router.o
/bin/sh ../../../libtool --tag=CXX --mode=link g++ -std=c++17 -fsanitize=undefined -fsanitize=leak -fsanitize=address -fPIE -DPIE -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 --param ssp-buffer-size=4 -fstack-protector -g -O2 -Wall -Wextra -Wshadow -Wno-unused-parameter -Wmissing-declarations -Wredundant-decls -O3 -Wextra -Wall -fsanitize=address -U_FORTIFY_SOURCE -g -O0 -fprofile-arcs -ftest-coverage -Wl,-z -Wl,relro -Wl,-z -Wl,now -o libyahttp.la reqresp.lo router.lo
libtool: link: ar cr .libs/libyahttp.a .libs/reqresp.o .libs/router.o
libtool: link: ranlib .libs/libyahttp.a
libtool: link: ( cd ".libs" && rm -f "libyahttp.la" && ln -s "../libyahttp.la" "libyahttp.la" )
make[4]: Leaving directory '/home/darnuria/programmation/pdns/ext/yahttp/yahttp'
Ok got it right by passing as configure args -DHAVE_CXX11
.
Maybe a bit redundant but I will remove redundant use of DHAVE_CXX11
later it's late now.
./configure --with-modules="" --disable-lua-records CFLAGS="-fsanitize=address -DHAVE_CXX11" YAHTTP_CFLAGS="-DHAVE_CXX11" LDDFLAGS="-fsanitize=address" CXXFLAGS="-DHAVE_CXX11 -fsanitize=address" --enable-ubsan --enable-malloc-trace --enable-lsan --enable-asan --enable-coverage
Making all in yahttp
make[3]: Entering directory '/home/darnuria/programmation/pdns/ext/yahttp'
Making all in yahttp
make[4]: Entering directory '/home/darnuria/programmation/pdns/ext/yahttp/yahttp'
depbase=`echo reqresp.lo | sed 's|[^/]*$|.deps/&|;s|\.lo$||'`;\
/bin/sh ../../../libtool --tag=CXX --mode=compile g++ -std=c++17 -DHAVE_CONFIG_H -I. -I../../.. -I../../.. -I../../.. -pthread -fsanitize=undefined -fsanitize=leak -fsanitize=address -fPIE -DPIE -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 --param ssp-buffer-size=4 -fstack-protector -g -O2 -Wall -Wextra -Wshadow -Wno-unused-parameter -Wmissing-declarations -Wredundant-decls -O3 -DHAVE_CXX11 -Wextra -Wall -fsanitize=address -U_FORTIFY_SOURCE -g -O0 -fprofile-arcs -ftest-coverage -MT reqresp.lo -MD -MP -MF $depbase.Tpo -c -o reqresp.lo reqresp.cpp &&\
mv -f $depbase.Tpo $depbase.Plo
depbase=`echo router.lo | sed 's|[^/]*$|.deps/&|;s|\.lo$||'`;\
/bin/sh ../../../libtool --tag=CXX --mode=compile g++ -std=c++17 -DHAVE_CONFIG_H -I. -I../../.. -I../../.. -I../../.. -pthread -fsanitize=undefined -fsanitize=leak -fsanitize=address -fPIE -DPIE -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 --param ssp-buffer-size=4 -fstack-protector -g -O2 -Wall -Wextra -Wshadow -Wno-unused-parameter -Wmissing-declarations -Wredundant-decls -O3 -DHAVE_CXX11 -Wextra -Wall -fsanitize=address -U_FORTIFY_SOURCE -g -O0 -fprofile-arcs -ftest-coverage -MT router.lo -MD -MP -MF $depbase.Tpo -c -o router.lo router.cpp &&\
mv -f $depbase.Tpo $depbase.Plo
libtool: compile: g++ -std=c++17 -DHAVE_CONFIG_H -I. -I../../.. -I../../.. -I../../.. -pthread -fsanitize=undefined -fsanitize=leak -fsanitize=address -DPIE -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 --param ssp-buffer-size=4 -fstack-protector -g -O2 -Wall -Wextra -Wshadow -Wno-unused-parameter -Wmissing-declarations -Wredundant-decls -O3 -DHAVE_CXX11 -Wextra -Wall -fsanitize=address -U_FORTIFY_SOURCE -g -O0 -fprofile-arcs -ftest-coverage -MT router.lo -MD -MP -MF .deps/router.Tpo -c router.cpp -fPIC -DPIC -o .libs/router.o
libtool: compile: g++ -std=c++17 -DHAVE_CONFIG_H -I. -I../../.. -I../../.. -I../../.. -pthread -fsanitize=undefined -fsanitize=leak -fsanitize=address -DPIE -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 --param ssp-buffer-size=4 -fstack-protector -g -O2 -Wall -Wextra -Wshadow -Wno-unused-parameter -Wmissing-declarations -Wredundant-decls -O3 -DHAVE_CXX11 -Wextra -Wall -fsanitize=address -U_FORTIFY_SOURCE -g -O0 -fprofile-arcs -ftest-coverage -MT reqresp.lo -MD -MP -MF .deps/reqresp.Tpo -c reqresp.cpp -fPIC -DPIC -o .libs/reqresp.o
/bin/sh ../../../libtool --tag=CXX --mode=link g++ -std=c++17 -fsanitize=undefined -fsanitize=leak -fsanitize=address -fPIE -DPIE -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 --param ssp-buffer-size=4 -fstack-protector -g -O2 -Wall -Wextra -Wshadow -Wno-unused-parameter -Wmissing-declarations -Wredundant-decls -O3 -DHAVE_CXX11 -Wextra -Wall -fsanitize=address -U_FORTIFY_SOURCE -g -O0 -fprofile-arcs -ftest-coverage -Wl,-z -Wl,relro -Wl,-z -Wl,now -o libyahttp.la reqresp.lo router.lo
libtool: link: ar cr .libs/libyahttp.a .libs/reqresp.o .libs/router.o
libtool: link: ranlib .libs/libyahttp.a
libtool: link: ( cd ".libs" && rm -f "libyahttp.la" && ln -s "../libyahttp.la" "libyahttp.la" )
make[4]: Leaving directory '/home/darnuria/programmation/pdns/ext/yahttp/yahttp'
make[4]: Entering directory '/home/darnuria/programmation/pdns/ext/yahttp'
make[4]: Nothing to be done for 'all-am'.
make[4]: Leaving directory '/home/darnuria/programmation/pdns/ext/yahttp'
make[3]: Leaving directory '/home/darnuria/programmation/pdns/ext/yahttp'
Compillation ended well, so it was the wrong place to call yahttp
makefile with this arg by default.
I just took a look at the yahttp code, and I don't think this is safe as-is. The yahttp classes change their interface when HAVE_CXX11 is defined (see reqresp.hpp for an example). To make this safe, all compilation units (!) need to see the same defines.
So, what I'm thinking: stick -DHAVE_CXX11 into CFLAGS, not just YAHTTP_CFLAGS.
I just took a look at the yahttp code, and I don't think this is safe as-is. The yahttp classes change their interface when HAVE_CXX11 is defined (see reqresp.hpp for an example). To make this safe, all compilation units (!) need to see the same defines.
Did a quick hack to check the involved types, esp. of YaHTTP::HTTPBase.renderer, and indeed:
ws-auth.cc NSt3__18functionIFmPKN6YaHTTP8HTTPBaseERNS_13basic_ostreamIcNS_11char_traitsIcEEEEbEEE
reqresp.cpp N5boost8functionIFmPKN6YaHTTP8HTTPBaseERNSt3__113basic_ostreamIcNS5_11char_traitsIcEEEEbEEE
=> Sticking this into YAHTTP_CFLAGS is wrong.
I believe the proposed syntax in configure.ac is also wrong and does nothing.
While verifying this, I've noticed make does not rebuild all objects as necessary. Make sure to run autoreconf
and make clean
after changing something. Not doing this also appears to produce binaries that fail with dubious exceptions at runtime.
This diff appears to work for auth builds. Not sure if that is the best place to stick the -D in.
diff --git a/configure.ac b/configure.ac
index 2359358f0..915d9753e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -302,7 +302,7 @@ AM_CONDITIONAL([HAVE_SYSTEMD], [ test x"$systemd" = "xy" ])
LDFLAGS="$RELRO_LDFLAGS $LDFLAGS"
CFLAGS="$PIE_CFLAGS $CFLAGS"
-CXXFLAGS="$PIE_CFLAGS $CXXFLAGS"
+CXXFLAGS="$PIE_CFLAGS $CXXFLAGS -DHAVE_CXX11"
PROGRAM_LDFLAGS="$PIE_LDFLAGS $PROGRAM_LDFLAGS"
AC_SUBST([PROGRAM_LDFLAGS])
I believe the proposed syntax in configure.ac is also wrong and does nothing.
Got into the same conclusion. Got into a wrong way of making the change due by the name of the configure.ac variable YAHTTP_CFLAGS
.
Make sure to run
autoreconf
andmake clean
Also had the same conclusion about not-fully rebuilding.
I will try tomorrow some workload with the change you suggested/command line arguments passed -DHAVE_CXX11
.
Passed the PR as draft since it's going back to draft stage. If you think it's not worthwhile, it's OK to close or move into a doc PR where the option is advertised as build option documentation with ./configure --help
.
EDIT: Thanks again for your review time.
I think I'd really like this change. Could also ask @cmouse what he thinks about dropping pre-CXX11 support from yahttp?
Would be happy to do the commit, but I am a little bit puzzled with autotools and don't know where to commit the change since my previous attempt at doing autotools magic. :laughing:
Found some time to check it was not that hard, but i am still not an autotool wizard.
I think I'd really like this change. Could also ask @cmouse what he thinks about dropping pre-CXX11 support from yahttp?
I have no problems with that.
I do not like the current solution of adding hardcoded HAVE_CXX11 to the compile flags (we also would need to do that in all three products) Much better to take https://github.com/cmouse/yahttp/pull/26. I'll look into that soon.
No problem with that, I agree since there is no issue this PR stayed open for reference, maybe moving to an issue is better?
Closing since https://github.com/cmouse/yahttp/pull/26 might land soon and it's definitively a better solution. :)