<div dir="ltr"><div dir="ltr">On Mon, Aug 16, 2021 at 12:29 PM Stuart Henderson <<a href="mailto:stu@spacehopper.org" target="_blank">stu@spacehopper.org</a>> wrote:<br></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On 2021-08-15, Alex Rousskov <<a href="mailto:rousskov@measurement-factory.com" target="_blank">rousskov@measurement-factory.com</a>> wrote:<br>
> On 8/15/21 2:51 PM, Francesco Chemolli wrote:<br>
>> Hi all,<br>
>> I'm looking into OpenBSD compatibility for trunk, and there's a<br>
>> strange behaviour at build time on OpenBSD (6.9) / clang (10.0.1)<br>
>> <br>
>> When building src/log/<a href="http://access.log.cc" rel="noreferrer" target="_blank">access.log.cc</a>, build fails with these errors:<br>
>> <br>
>> ------------------ begin quote -----------<br>
>> static_assert((is_same<value_type, typename<br>
>> allocator_type::value_type>::value),<br>
>> ^<br>
>> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br>
><br>
> Are some compiler messages missing in the above quote? It feels like the<br>
> above line is not directly related to the lines below, but perhaps I am<br>
> misinterpreting the messy output.<br>
><br>
>> I'm puzzled: I wouldn't expect this to be an OS-specific failure.<br>
><br>
> We cannot be sure it is OS-specific, but STL implementation is full of<br>
> hacks and optimizations that may be OS- or environment-specific. It is<br>
> also possible that there is a conflict between GCC and clang<br>
> installation; we have seen those before and they manifest in weird ways.<br>
><br>
> It is strange that the error below mentions "unordered_map" when it<br>
> should say "std::unordered_map" or similar.<br>
><br>
> Are you building with clang standard library or GCC standard library (I<br>
> believe -stdlib controls that, but it is not my area of expertise)? If<br>
> you are building with GCC stdlib, perhaps try building with<br>
> clang-provided stdlib?<br>
<br>
Hi, OpenBSD port maintainer here (I admit to not knowing much C++ though!).<br>
On OpenBSD, on all archs where the base system compiler is clang,<br>
it's configured to use the clang standard library (libc++) by default,<br></blockquote><div><br></div><div>Hi Stuart,</div><div>Pleased to meet you</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">>> /usr/include/c++/v1/initializer_list:99:1: note: candidate template<br>
<br>
and these are the correct headers for libc++. (Post-6.9 gcc is no longer<br>
installed in the base OS on any of the "base is clang" archs, it is<br>
present in ports but used only very rarely).<br>
<br>
I just gave it a spin, after adding a missed inclusion of sys/socket.h<br>
for SOL_SOCKET in Tcp.cc I hit the same problem with <a href="http://access.log.cc" rel="noreferrer" target="_blank">access.log.cc</a>,<br>
there is a clue on the immediately previous line, which I think is<br>
pointing at something to do with const vs non-const SBuf, is that enough<br>
of a clue?<br></blockquote><div><br></div><div>sys/socket inclusion is in PR#885, queued for landing any time soon.</div><div><br></div><div>I had patched the previous line to</div><div><br></div><div> for (auto i : TheGlobalContextStorage.storage) {<br></div><div><br></div><div>letting the compiler do the heavy lifting of type detection; but then the other issues remained.</div><div>I will try some more variations.</div><div><br></div><div>egcc (gcc 8.4.0) builds that file just fine, so it might really be libstdc++ related.</div><div><br></div><div>It fails when trying to use libcppunit, I suppose due to the fact that the system-supplied libcppunit is built with clang++</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
<br>
[...]<br>
Making all in log<br>
Making all in DB<br>
Making all in file<br>
depbase=`echo access_log.lo | sed 's|[^/]*$|.deps/&|;s|\.lo$||'`; /usr/bin/libtool --tag=CXX --mode=compile c++ -DHAVE_CONFIG_H -DDEFAULT_CONFIG_FILE=\"/etc/squid/squid.conf\" -DDEFAULT_SQUID_DATA_DIR=\"/usr/local/share/squid\" -DDEFAULT_SQUID_CONFIG_DIR=\"/etc/squid\" -I/usr/obj/ports/squid-5.1pl20210816/squid-742d042ea820b4ecac2a651a889e0c37f327618e -I/usr/obj/ports/squid-5.1pl20210816/squid-742d042ea820b4ecac2a651a889e0c37f327618e/include -I/usr/obj/ports/squid-5.1pl20210816/squid-742d042ea820b4ecac2a651a889e0c37f327618e/lib -I/usr/obj/ports/squid-5.1pl20210816/squid-742d042ea820b4ecac2a651a889e0c37f327618e/src -I../../include -I/usr/local/include -I/usr/local/include -I/usr/local/include/libxml2 -I/usr/local/include -Werror -Wextra -Wno-unused-private-field -Wpointer-arith -Wwrite-strings -Wcomments -Wshadow -Wmissing-declarations -D_REENTRANT -I/usr/local/include/libxml2 -I/usr/local/include -I/usr/local/include -I/usr/local/include -I/usr/local/include/p11-k<br>
it-1 -O2 -pipe -MT access_log.lo -MD -MP -MF $depbase.Tpo -c -o access_log.lo /usr/obj/ports/squid-5.1pl20210816/squid-742d042ea820b4ecac2a651a889e0c37f327618e/src/log/access_log.cc && mv -f $depbase.Tpo $depbase.Plo<br>
c++ -DHAVE_CONFIG_H -DDEFAULT_CONFIG_FILE="/etc/squid/squid.conf" -DDEFAULT_SQUID_DATA_DIR="/usr/local/share/squid" -DDEFAULT_SQUID_CONFIG_DIR="/etc/squid" -I/usr/obj/ports/squid-5.1pl20210816/squid-742d042ea820b4ecac2a651a889e0c37f327618e -I/usr/obj/ports/squid-5.1pl20210816/squid-742d042ea820b4ecac2a651a889e0c37f327618e/include -I/usr/obj/ports/squid-5.1pl20210816/squid-742d042ea820b4ecac2a651a889e0c37f327618e/lib -I/usr/obj/ports/squid-5.1pl20210816/squid-742d042ea820b4ecac2a651a889e0c37f327618e/src -I../../include -I/usr/local/include -I/usr/local/include -I/usr/local/include/libxml2 -I/usr/local/include -Werror -Wextra -Wno-unused-private-field -Wpointer-arith -Wwrite-strings -Wcomments -Wshadow -Wmissing-declarations -D_REENTRANT -I/usr/local/include/libxml2 -I/usr/local/include -I/usr/local/include -I/usr/local/include -I/usr/local/include/p11-kit-1 -O2 -pipe -MT access_log.lo -MD -MP -MF .deps/access_log.Tpo -c /usr/obj/ports/squid-5.1pl20210816/squid-742d042ea820b4ecac2a651a<br>
889e0c37f327618e/src/log/access_log.cc -fPIC -DPIC -o .libs/access_log.o<br>
In file included from /usr/obj/ports/squid-5.1pl20210816/squid-742d042ea820b4ecac2a651a889e0c37f327618e/src/log/access_log.cc:12:<br>
In file included from /usr/obj/ports/squid-5.1pl20210816/squid-742d042ea820b4ecac2a651a889e0c37f327618e/src/AccessLogEntry.h:19:<br>
In file included from /usr/obj/ports/squid-5.1pl20210816/squid-742d042ea820b4ecac2a651a889e0c37f327618e/src/HttpHeader.h:13:<br>
In file included from /usr/obj/ports/squid-5.1pl20210816/squid-742d042ea820b4ecac2a651a889e0c37f327618e/src/base/LookupTable.h:15:<br>
/usr/include/c++/v1/unordered_map:857:5: error: static_assert failed due to requirement 'is_same<std::__1::pair<const SBuf, unsigned long long>, std::__1::pair<SBuf, unsigned long long>>::value' "Invalid allocator::value_type"<br>
static_assert((is_same<value_type, typename allocator_type::value_type>::value),<br>
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br>
/usr/obj/ports/squid-5.1pl20210816/squid-742d042ea820b4ecac2a651a889e0c37f327618e/src/log/access_log.cc:65:26: note: in instantiation of template class 'std::__1::unordered_map<SBuf, unsigned long long, std::__1::hash<SBuf>, std::__1::equal_to<SBuf>, PoolingAllocator<std::__1::pair<SBuf, unsigned long long>>>' requested here<br>
static HeaderValueCounts TheViaCounts;<br>
^<br>
/usr/obj/ports/squid-5.1pl20210816/squid-742d042ea820b4ecac2a651a889e0c37f327618e/src/log/access_log.cc:459:25: error: type 'HeaderValueCounts' (aka 'unordered_map<SBuf, unsigned long long, hash<SBuf>, equal_to<SBuf>, PoolingAllocator<pair<SBuf, unsigned long long>>>') does not provide a subscript operator<br>
++TheForwardedCounts[key];<br>
~~~~~~~~~~~~~~~~~~^~~~<br>
/usr/obj/ports/squid-5.1pl20210816/squid-742d042ea820b4ecac2a651a889e0c37f327618e/src/log/access_log.cc:466:24: error: invalid range expression of type 'const std::__1::unordered_map<SBuf, unsigned long long, std::__1::hash<SBuf>, std::__1::equal_to<SBuf>, PoolingAllocator<std::__1::pair<SBuf, unsigned long long>>>'; no viable 'begin' function available<br>
for (const auto &i : counts)<br>
^ ~~~~~~<br>
/usr/include/c++/v1/initializer_list:99:1: note: candidate template ignored: could not match 'initializer_list' against 'unordered_map'<br>
begin(initializer_list<_Ep> __il) _NOEXCEPT<br>
^<br>
/usr/include/c++/v1/iterator:1752:1: note: candidate template ignored: could not match '_Tp [_Np]' against 'const std::__1::unordered_map<SBuf, unsigned long long, std::__1::hash<SBuf>, std::__1::equal_to<SBuf>, PoolingAllocator<std::__1::pair<SBuf, unsigned long long>>>'<br>
begin(_Tp (&__array)[_Np])<br>
^<br>
/usr/include/c++/v1/iterator:1770:1: note: candidate template ignored: substitution failure [with _Cp = const std::__1::unordered_map<SBuf, unsigned long long, std::__1::hash<SBuf>, std::__1::equal_to<SBuf>, PoolingAllocator<std::__1::pair<SBuf, unsigned long long>>>]: no member named 'begin' in 'std::__1::unordered_map<SBuf, unsigned long long, std::__1::hash<SBuf>, std::__1::equal_to<SBuf>, PoolingAllocator<std::__1::pair<SBuf, unsigned long long>>>'<br>
begin(_Cp& __c) -> decltype(__c.begin())<br>
^ ~~~~~<br>
/usr/include/c++/v1/iterator:1778:1: note: candidate template ignored: substitution failure [with _Cp = std::__1::unordered_map<SBuf, unsigned long long, std::__1::hash<SBuf>, std::__1::equal_to<SBuf>, PoolingAllocator<std::__1::pair<SBuf, unsigned long long>>>]: no member named 'begin' in 'std::__1::unordered_map<SBuf, unsigned long long, std::__1::hash<SBuf>, std::__1::equal_to<SBuf>, PoolingAllocator<std::__1::pair<SBuf, unsigned long long>>>'<br>
begin(const _Cp& __c) -> decltype(__c.begin())<br>
^ ~~~~~<br>
/usr/obj/ports/squid-5.1pl20210816/squid-742d042ea820b4ecac2a651a889e0c37f327618e/src/log/access_log.cc:488:24: error: no member named 'clear' in 'std::__1::unordered_map<SBuf, unsigned long long, std::__1::hash<SBuf>, std::__1::equal_to<SBuf>, PoolingAllocator<std::__1::pair<SBuf, unsigned long long>>>'<br>
TheForwardedCounts.clear();<br>
~~~~~~~~~~~~~~~~~~ ^<br>
4 errors generated.<br>
Error while executing c++ -DHAVE_CONFIG_H -DDEFAULT_CONFIG_FILE="/etc/squid/squid.conf" -DDEFAULT_SQUID_DATA_DIR="/usr/local/share/squid" -DDEFAULT_SQUID_CONFIG_DIR="/etc/squid" -I/usr/obj/ports/squid-5.1pl20210816/squid-742d042ea820b4ecac2a651a889e0c37f327618e -I/usr/obj/ports/squid-5.1pl20210816/squid-742d042ea820b4ecac2a651a889e0c37f327618e/include -I/usr/obj/ports/squid-5.1pl20210816/squid-742d042ea820b4ecac2a651a889e0c37f327618e/lib -I/usr/obj/ports/squid-5.1pl20210816/squid-742d042ea820b4ecac2a651a889e0c37f327618e/src -I../../include -I/usr/local/include -I/usr/local/include -I/usr/local/include/libxml2 -I/usr/local/include -Werror -Wextra -Wno-unused-private-field -Wpointer-arith -Wwrite-strings -Wcomments -Wshadow -Wmissing-declarations -D_REENTRANT -I/usr/local/include/libxml2 -I/usr/local/include -I/usr/local/include -I/usr/local/include -I/usr/local/include/p11-kit-1 -O2 -pipe -MT access_log.lo -MD -MP -MF .deps/access_log.Tpo -c /usr/obj/ports/squid-5.1pl20210816/squid-74<br>
2d042ea820b4ecac2a651a889e0c37f327618e/src/log/access_log.cc -fPIC -DPIC -o .libs/access_log.o<br>
*** Error 1 in src/log (Makefile:923 'access_log.lo')<br>
<br>
_______________________________________________<br>
squid-dev mailing list<br>
<a href="mailto:squid-dev@lists.squid-cache.org" target="_blank">squid-dev@lists.squid-cache.org</a><br>
<a href="http://lists.squid-cache.org/listinfo/squid-dev" rel="noreferrer" target="_blank">http://lists.squid-cache.org/listinfo/squid-dev</a><br>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr"> Francesco</div></div>