Re: c++ error when trying to build releng/14.2 on 'main' host

From: Andriy Gapon <avg_at_FreeBSD.org>
Date: Wed, 09 Apr 2025 11:54:38 UTC
On 09/04/2025 2:21 pm, Andriy Gapon wrote:
> On 09/04/2025 1:30 pm, Dimitry Andric wrote:
>> Are you skipping any toolchain bootstrap steps? I tried building releng/14.2 
>> under 15-CURRENT, and it works just fine.
> 
> AFAIK, no.
> This is 'make buildworld' after blowing away /usr/obj.
> 
>> That said, from your original message it looks like it's a -Werror warning, so 
>> you could try using WITHOUT_WERROR?
> I can try that for sure.
> 
> Thisn is definitely something unexpected as I've recently built stable/14 on the 
> same host without any issues.
> 

Just in case, a fuller error message from a -j1 build:

===> lib/libdevdctl (all)
In file included from /usr/src/releng142/lib/libdevdctl/exception.cc:42:
In file included from 
/usr/obj/usr/src/releng142/amd64.amd64/tmp/usr/include/c++/v1/sstream:278:
In file included from 
/usr/obj/usr/src/releng142/amd64.amd64/tmp/usr/include/c++/v1/istream:170:
In file included from 
/usr/obj/usr/src/releng142/amd64.amd64/tmp/usr/include/c++/v1/ostream:181:
In file included from 
/usr/obj/usr/src/releng142/amd64.amd64/tmp/usr/include/c++/v1/__system_error/error_code.h:18:
In file included from 
/usr/obj/usr/src/releng142/amd64.amd64/tmp/usr/include/c++/v1/__system_error/error_category.h:15:
In file included from 
/usr/obj/usr/src/releng142/amd64.amd64/tmp/usr/include/c++/v1/string:625:
In file included from 
/usr/obj/usr/src/releng142/amd64.amd64/tmp/usr/include/c++/v1/string_view:939:
In file included from 
/usr/obj/usr/src/releng142/amd64.amd64/tmp/usr/include/c++/v1/algorithm:1810:
In file included from 
/usr/obj/usr/src/releng142/amd64.amd64/tmp/usr/include/c++/v1/__algorithm/for_each.h:16:
In file included from 
/usr/obj/usr/src/releng142/amd64.amd64/tmp/usr/include/c++/v1/__ranges/movable_box.h:23:
In file included from 
/usr/obj/usr/src/releng142/amd64.amd64/tmp/usr/include/c++/v1/optional:1293:
In file included from 
/usr/obj/usr/src/releng142/amd64.amd64/tmp/usr/include/c++/v1/iterator:683:
In file included from 
/usr/obj/usr/src/releng142/amd64.amd64/tmp/usr/include/c++/v1/__iterator/common_iterator.h:31:
/usr/obj/usr/src/releng142/amd64.amd64/tmp/usr/include/c++/v1/variant:908:9: 
error: '__exclude_from_explicit_instantiation__' attribute ignored on local 
class member [-Werror,-Wignored-attributes]
   908 |         _LIBCPP_HIDE_FROM_ABI void operator()(true_type) const { 
__this->__emplace<_Ip>(std::forward<_Arg>(__arg)); }
       |         ^
/usr/obj/usr/src/releng142/amd64.amd64/tmp/usr/include/c++/v1/__config:859:22: 
note: expanded from macro '_LIBCPP_HIDE_FROM_ABI'
   859 |       _LIBCPP_HIDDEN _LIBCPP_EXCLUDE_FROM_EXPLICIT_INSTANTIATION 
                                                \
       |                      ^
/usr/obj/usr/src/releng142/amd64.amd64/tmp/usr/include/c++/v1/__config:785:72: 
note: expanded from macro '_LIBCPP_EXCLUDE_FROM_EXPLICIT_INSTANTIATION'
   785 | #    define _LIBCPP_EXCLUDE_FROM_EXPLICIT_INSTANTIATION 
__attribute__((__exclude_from_explicit_instantiation__))


Host clang:
$ clang --version
FreeBSD clang version 19.1.4 (https://github.com/llvm/llvm-project.git 
llvmorg-19.1.4-0-gaadaa00de76e)
Target: x86_64-unknown-freebsd15.0
Thread model: posix
InstalledDir: /usr/bin
Build config: +assertions

Oh, and probably something that I should have mentioned (and recalled myself) 
from the start.  This is a build for a disk-constrained system, so it have these 
in its src.conf:

WITHOUT_CLANG=yes
WITH_LLVM_TARGET_X86=yes                # to undo effect of WITHOUT_CLANG

I am not sure where i picked up those, but I suspect that this kind of muckery 
with the toolchain can result in problems.

-- 
Andriy Gapon