Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 2 Dec 2021 09:02:17 -0800
From:      John Baldwin <jhb@FreeBSD.org>
To:        "Bjoern A. Zeeb" <bzeeb-lists@lists.zabbadoz.net>, Ed Maste <emaste@freebsd.org>
Cc:        FreeBSD Hackers <freebsd-hackers@freebsd.org>
Subject:   Re: Retiring WITHOUT_CXX
Message-ID:  <ab58cfdd-61f9-abfb-6848-a33c7a4f1069@FreeBSD.org>
In-Reply-To: <alpine.BSF.2.00.2111261838320.68830@ai.fobar.qr>
References:  <CAPyFy2DJcDFbSoD8awU03jPBY1YVytf%2Bxk4qpv3pW_GLkOsfWA@mail.gmail.com> <202111260909.1AQ99LY2023877@gndrsh.dnsmgr.net> <CAPyFy2Bs76J=UVotL6McqdHVNwhtYmfQq7U2xpXVKiQTpa78Lw@mail.gmail.com> <alpine.BSF.2.00.2111261838320.68830@ai.fobar.qr>

next in thread | previous in thread | raw e-mail | index | archive | help
On 11/26/21 11:06 AM, Bjoern A. Zeeb wrote:
> On Fri, 26 Nov 2021, Ed Maste wrote:
> 
>> On Fri, 26 Nov 2021 at 04:09, Rodney W. Grimes
>> <freebsd-rwg@gndrsh.dnsmgr.net> wrote:
>>>
>>> So is the feature model of FreeBSD becoming, oh it gets broken
>>> cause it is not regularly tested, so lets remove that feature.
>>
>> I don't agree with that. We have a large and growing CI infrastructure
>> to regularly test functionality and are continually adding to it over
>> time. But it's important to test and maintain what is actually used
>> and is useful. Disabling C++ support made sense when obrien@ added the
>> original knob in 2000, but it makes less sense today when parts of
>> FreeBSD are written in C++.
> 
> I used to disable it in my images but started to need devd and that is
> really the only reason its there currently
> 
> #WITHOUT_CXX=   # devd needs it
> 
> I used to have a conversation with Warner a while ago about it and the
> conclusion was the bits of C++ could be reimplemented in C if needed
> but obviously no one ever got to that.

I honestly think that's the wrong direction.  I'm currently hacking on
a libiscsi for shared bits of iscsid and ctld and right now it has some
home-grown containers (struct keys) that would be much better as a
std::vector<> of a struct with two strings.  It would also benefit from
having an actual class for the instead of the typical C inheritance I've
added.  Similarly, I've wanted to use std::unordered_map in truss to
handle the syscall counts since hash tables in C require a lot of
boilerplate code.  This is no longer 1985, or even 2003.  I'm not ready
to write a kernel in C++ with templates, but I think for userspace
utilities you can buy a fair bit of robustness with RAII, unique_ptr,
etc. and we shouldn't be crippling ourselves.

Also, have you looked at what WITHOUT_CXX actually removes?  c++ is just
a hard link to clang.  That's the big space eater, not libc++.so.1 or
libcxxrt.so.1.  For reference, on my 13.x desktop, libc.so.7 is about 3
times the size of libc++.so.1:

-r--r--r--  1 root  wheel  1986208 Aug 19 15:28 /lib/libc.so.7
-r--r--r--  1 root  wheel   112200 Aug 19 15:29 /lib/libcxxrt.so.1
-r--r--r--  1 root  wheel   846200 Aug 19 15:29 /usr/lib/libc++.so.1

-- 
John Baldwin



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?ab58cfdd-61f9-abfb-6848-a33c7a4f1069>