Date: Mon, 29 Jul 2024 22:14:55 -0700 From: Mark Millard <marklmi@yahoo.com> To: Dimitry Andric <dim@FreeBSD.org> Cc: Charlie Li <vishwin@freebsd.org>, freebsd-arch <freebsd-arch@freebsd.org>, FreeBSD Toolchain <freebsd-toolchain@freebsd.org> Subject: Re: FreeBSD libc++ , ports, and import std or import std.compat : what if potential ports start using them over time? Message-ID: <98D4961E-2BEF-465E-8ACE-99587A089951@yahoo.com> In-Reply-To: <03578B4A-BA6A-4F9D-BCE0-9C01A84623C5@FreeBSD.org> References: <87497F2F-8C4F-48C8-8737-979070B41C78.ref@yahoo.com> <87497F2F-8C4F-48C8-8737-979070B41C78@yahoo.com> <5ef8f532-e411-449e-9d0e-798ad9da3c3f@freebsd.org> <22A8133D-B6E6-4818-932A-5D6B03882AC4@yahoo.com> <03578B4A-BA6A-4F9D-BCE0-9C01A84623C5@FreeBSD.org>
next in thread | previous in thread | raw e-mail | index | archive | help
--Apple-Mail=_CED38DD1-2D05-4B3D-9BE6-C999AC294AE5 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii On Jul 29, 2024, at 09:18, Dimitry Andric <dim@FreeBSD.org> wrote: > On 29 Jul 2024, at 18:01, Mark Millard <marklmi@yahoo.com> wrote: >>=20 >> On Jul 29, 2024, at 07:54, Charlie Li <vishwin@freebsd.org> wrote: >>> ... >=20 >>> While you're talking about std and std.compat, I have a related = issue whilst working on the www/webkit2-gtk update. They have code that = relies on a std::pair implementation/ABI that does not work with our = base system libc++. This is because our base system uses LLVM libc++ ABI = version 1, but the needed implementation is in ABI version 2, which they = have still (even in trunk!) not declared stable. >>=20 >> FreeBSD updating its C++ ABI would be a rather major change, >> or so I would expect. Likely avoided as long as possible? >>=20 >> I wonder what property of std::pair's implementation is at >> issue for the ABI version distinction(s). >=20 > It's a bit of a historical wart that is hard to get rid of. In FreeBSD = we were "too early" and changed our standard C++ library to libc++ = before this std::pair trivial copy constructor issue was hashed out in = the standards committees. Looking, I eventually found ( __config ): # elif _LIBCPP_ABI_VERSION =3D=3D 1 . . . # if defined(__FreeBSD__) # define _LIBCPP_DEPRECATED_ABI_DISABLE_PAIR_TRIVIAL_COPY_CTOR # endif and ( __utility/pair.h ): template <class _T1, class _T2> struct _LIBCPP_TEMPLATE_VIS pair #if defined(_LIBCPP_DEPRECATED_ABI_DISABLE_PAIR_TRIVIAL_COPY_CTOR) : private __non_trivially_copyable_base<_T1, _T2> #endif { . . . So this is not a 1 vs. 2 issue: it is a FreeBSD-specific odd definition = of 1 that does not apply to other contexts with _LIBCPP_ABI_VERSION =3D=3D 1 . I'd = not noticed that in the prior references that I'd run into. (It fits with = your wording below, sort of "early 1 vs. late 1" to invent terminology.) > After it was settled in those committees, libc++ changed its = implementation to match, but this actually breaks the ABI! Sort of "FreeBSD early libc++ ABI 1" vs. "normal late libc++ ABI 1" = ABIs. > For anybody who switched to libc++ after that time, there was no = problem using the new ABI, but in FreeBSD we have been stuck with the = older interpretation ever since. >=20 > Changing the ABI involves bumping libc++.so to .2, and putting = libc++.so.1 into a 'compat' package for the sake of old binaries. I had = originally wanted to do this for FreeBSD 14 but never got to it, and for = some reason upstream is also stalled for years now in bumping their own = official ABI version to 2. If FreeBSD wants an officially stable libc++ without the forced = __non_trivially_copyable_base<_T1, _T2> then it could: ) have libc++.so use .2 for libc++ _LIBCPP_ABI_VERSION =3D=3D 1 without = _LIBCPP_DEPRECATED_ABI_DISABLE_PAIR_TRIVIAL_COPY_CTOR defined ) have the _LIBCPP_ABI_VERSION =3D=3D 1 with = _LIBCPP_DEPRECATED_ABI_DISABLE_PAIR_TRIVIAL_COPY_CTOR defined case for = libc++.so.1 put into that 'compat' package for the sake of old binaries There is no reason to need to deal with _LIBCPP_ABI_VERSION =3D=3D 2 at = all for the issue at hand. (Yes, this would mean going forward that for N>=3D 1, libc++.so.(N+1) = would be for _LIBCPP_ABI_VERSION =3D=3D N without the FreeBSD oddity.) > It would be preferable if upstream libc++ bumps its 'stable' ABI to 2 = and starts working on 3 as the then-experimental one, then all = downstream consumers can upgrade, leaving all compat crutches behind. >=20 How important is having a numerical match for = libc++.so.(_LIBCPP_ABI_VERSION) instead of the +/- 1 shifting between = the .so and the _LIBCPP_ABI_VERSION ? =3D=3D=3D Mark Millard marklmi at yahoo.com --Apple-Mail=_CED38DD1-2D05-4B3D-9BE6-C999AC294AE5 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=us-ascii <html><head><meta http-equiv=3D"content-type" content=3D"text/html; = charset=3Dus-ascii"></head><body style=3D"overflow-wrap: break-word; = -webkit-nbsp-mode: space; line-break: after-white-space;">On Jul 29, = 2024, at 09:18, Dimitry Andric <dim@FreeBSD.org> = wrote:<br><div><br class=3D"Apple-interchange-newline"><div><blockquote = type=3D"cite">On 29 Jul 2024, at 18:01, Mark Millard = <marklmi@yahoo.com> wrote:<br><blockquote type=3D"cite"><br>On Jul = 29, 2024, at 07:54, Charlie Li <vishwin@freebsd.org> = wrote:<br><blockquote = type=3D"cite">...<br></blockquote></blockquote><br><blockquote = type=3D"cite"><blockquote type=3D"cite">While you're talking about std = and std.compat, I have a related issue whilst working on the = www/webkit2-gtk update. They have code that relies on a std::pair = implementation/ABI that does not work with our base system libc++. This = is because our base system uses LLVM libc++ ABI version 1, but the = needed implementation is in ABI version 2, which they have still (even = in trunk!) not declared stable.<br></blockquote><br>FreeBSD updating its = C++ ABI would be a rather major change,<br>or so I would expect. Likely = avoided as long as possible?<br><br>I wonder what property of = std::pair's implementation is at<br>issue for the ABI version = distinction(s).<br></blockquote><br>It's a bit of a historical wart that = is hard to get rid of. In FreeBSD we were "too early" and changed our = standard C++ library to libc++ before this std::pair trivial copy = constructor issue was hashed out in the standards = committees.</blockquote><div><br></div><div>Looking, I eventually found = ( <span style=3D"color: rgb(16, 16, 16); font-family: Monaco; = font-size: 10px; background-color: rgb(255, 255, = 255);">__config</span> ):</div><div><br></div><div><p = style=3D"margin: 0px; font-stretch: normal; font-size: 10px; = line-height: normal; font-family: Monaco; font-size-adjust: none; = font-kerning: auto; font-variant-alternates: normal; = font-variant-ligatures: normal; font-variant-numeric: normal; = font-variant-east-asian: normal; font-variant-position: normal; = font-feature-settings: normal; font-optical-sizing: auto; = font-variation-settings: normal; color: rgb(16, 16, 16); = background-color: rgb(255, 255, 255);"><span = style=3D"font-variant-ligatures: no-common-ligatures"># elif = _LIBCPP_ABI_VERSION =3D=3D 1</span></p> <p style=3D"margin: 0px; font-stretch: normal; font-size: 10px; = line-height: normal; font-family: Monaco; font-size-adjust: none; = font-kerning: auto; font-variant-alternates: normal; = font-variant-ligatures: normal; font-variant-numeric: normal; = font-variant-east-asian: normal; font-variant-position: normal; = font-feature-settings: normal; font-optical-sizing: auto; = font-variation-settings: normal; color: rgb(16, 16, 16); = background-color: rgb(255, 255, 255);">. . .</p> <p style=3D"margin: 0px; font-stretch: normal; font-size: 10px; = line-height: normal; font-family: Monaco; font-size-adjust: none; = font-kerning: auto; font-variant-alternates: normal; = font-variant-ligatures: normal; font-variant-numeric: normal; = font-variant-east-asian: normal; font-variant-position: normal; = font-feature-settings: normal; font-optical-sizing: auto; = font-variation-settings: normal; color: rgb(16, 16, 16); = background-color: rgb(255, 255, 255);"><span = style=3D"font-variant-ligatures: no-common-ligatures"># if = defined(__FreeBSD__)</span></p> <p style=3D"margin: 0px; font-stretch: normal; font-size: 10px; = line-height: normal; font-family: Monaco; font-size-adjust: none; = font-kerning: auto; font-variant-alternates: normal; = font-variant-ligatures: normal; font-variant-numeric: normal; = font-variant-east-asian: normal; font-variant-position: normal; = font-feature-settings: normal; font-optical-sizing: auto; = font-variation-settings: normal; color: rgb(16, 16, 16); = background-color: rgb(255, 255, 255);"><span = style=3D"font-variant-ligatures: no-common-ligatures"># = define = _LIBCPP_DEPRECATED_ABI_DISABLE_PAIR_TRIVIAL_COPY_CTOR</span></p> <p style=3D"margin: 0px; font-stretch: normal; font-size: 10px; = line-height: normal; font-family: Monaco; font-size-adjust: none; = font-kerning: auto; font-variant-alternates: normal; = font-variant-ligatures: normal; font-variant-numeric: normal; = font-variant-east-asian: normal; font-variant-position: normal; = font-feature-settings: normal; font-optical-sizing: auto; = font-variation-settings: normal; color: rgb(16, 16, 16); = background-color: rgb(255, 255, 255);"><span = style=3D"font-variant-ligatures: no-common-ligatures"># = endif</span></p></div><div><br></div><div>and ( <span style=3D"color:= rgb(16, 16, 16); font-family: Monaco; font-size: 10px; = background-color: rgb(255, 255, = 255);">__utility/pair.h</span> ):</div><div><br></div><div><p = style=3D"margin: 0px; font-stretch: normal; font-size: 10px; = line-height: normal; font-family: Monaco; font-size-adjust: none; = font-kerning: auto; font-variant-alternates: normal; = font-variant-ligatures: normal; font-variant-numeric: normal; = font-variant-east-asian: normal; font-variant-position: normal; = font-feature-settings: normal; font-optical-sizing: auto; = font-variation-settings: normal; color: rgb(16, 16, 16); = background-color: rgb(255, 255, 255);"><span = style=3D"font-variant-ligatures: no-common-ligatures">template <class = _T1, class _T2></span></p> <p style=3D"margin: 0px; font-stretch: normal; font-size: 10px; = line-height: normal; font-family: Monaco; font-size-adjust: none; = font-kerning: auto; font-variant-alternates: normal; = font-variant-ligatures: normal; font-variant-numeric: normal; = font-variant-east-asian: normal; font-variant-position: normal; = font-feature-settings: normal; font-optical-sizing: auto; = font-variation-settings: normal; color: rgb(16, 16, 16); = background-color: rgb(255, 255, 255);"><span = style=3D"font-variant-ligatures: no-common-ligatures">struct = _LIBCPP_TEMPLATE_VIS pair</span></p> <p style=3D"margin: 0px; font-stretch: normal; font-size: 10px; = line-height: normal; font-family: Monaco; font-size-adjust: none; = font-kerning: auto; font-variant-alternates: normal; = font-variant-ligatures: normal; font-variant-numeric: normal; = font-variant-east-asian: normal; font-variant-position: normal; = font-feature-settings: normal; font-optical-sizing: auto; = font-variation-settings: normal; color: rgb(16, 16, 16); = background-color: rgb(255, 255, 255);"><span = style=3D"font-variant-ligatures: no-common-ligatures">#if = defined(_LIBCPP_DEPRECATED_ABI_DISABLE_PAIR_TRIVIAL_COPY_CTOR)</span></p> <p style=3D"margin: 0px; font-stretch: normal; font-size: 10px; = line-height: normal; font-family: Monaco; font-size-adjust: none; = font-kerning: auto; font-variant-alternates: normal; = font-variant-ligatures: normal; font-variant-numeric: normal; = font-variant-east-asian: normal; font-variant-position: normal; = font-feature-settings: normal; font-optical-sizing: auto; = font-variation-settings: normal; color: rgb(16, 16, 16); = background-color: rgb(255, 255, 255);"><span = style=3D"font-variant-ligatures: no-common-ligatures"> : = private __non_trivially_copyable_base<_T1, _T2></span></p> <p style=3D"margin: 0px; font-stretch: normal; font-size: 10px; = line-height: normal; font-family: Monaco; font-size-adjust: none; = font-kerning: auto; font-variant-alternates: normal; = font-variant-ligatures: normal; font-variant-numeric: normal; = font-variant-east-asian: normal; font-variant-position: normal; = font-feature-settings: normal; font-optical-sizing: auto; = font-variation-settings: normal; color: rgb(16, 16, 16); = background-color: rgb(255, 255, 255);"><span = style=3D"font-variant-ligatures: no-common-ligatures">#endif</span></p> <p style=3D"margin: 0px; font-stretch: normal; font-size: 10px; = line-height: normal; font-family: Monaco; font-size-adjust: none; = font-kerning: auto; font-variant-alternates: normal; = font-variant-ligatures: normal; font-variant-numeric: normal; = font-variant-east-asian: normal; font-variant-position: normal; = font-feature-settings: normal; font-optical-sizing: auto; = font-variation-settings: normal; color: rgb(16, 16, 16); = background-color: rgb(255, 255, 255);"><span = style=3D"font-variant-ligatures: = no-common-ligatures">{</span></p></div><div><span = style=3D"font-variant-ligatures: no-common-ligatures">. . = .</span></div><div><span style=3D"font-variant-ligatures: = no-common-ligatures"><br></span></div><div><span = style=3D"font-variant-ligatures: no-common-ligatures">So this is not a 1 = vs. 2 issue: it is a FreeBSD-specific odd definition of 1 = that</span></div><div><span style=3D"font-variant-ligatures: = no-common-ligatures">does not apply to other contexts = with </span><span style=3D"caret-color: rgb(16, 16, 16); color: = rgb(16, 16, 16); font-family: Monaco; font-size: 10px; background-color: = rgb(255, 255, 255);">_LIBCPP_ABI_VERSION =3D=3D 1</span> . I'd = not</div><div>noticed that in the prior references that I'd run into. = (It fits with your wording</div><div>below, sort of "early 1 vs. late 1" = to invent terminology.)</div><br><blockquote type=3D"cite">After it was = settled in those committees, libc++ changed its implementation to match, = but this actually breaks the ABI!</blockquote><div><br></div><div>Sort = of "FreeBSD early libc++ ABI 1" vs. "normal late libc++ ABI 1" = ABIs.</div><br><blockquote type=3D"cite">For anybody who switched to = libc++ after that time, there was no problem using the new ABI, but in = FreeBSD we have been stuck with the older interpretation ever = since.<br><br>Changing the ABI involves bumping libc++.so to .2, and = putting libc++.so.1 into a 'compat' package for the sake of old = binaries. I had originally wanted to do this for FreeBSD 14 but never = got to it, and for some reason upstream is also stalled for years now in = bumping their own official ABI version to = 2.<br></blockquote><div><br></div><div>If FreeBSD wants an officially = stable libc++ without the forced <span style=3D"caret-color: = rgb(16, 16, 16); color: rgb(16, 16, 16); font-family: Monaco; font-size: = 10px; background-color: rgb(255, 255, = 255);">__non_trivially_copyable_base<_T1, _T2></span> then it = could:</div><div><br></div><div>) have libc++.so use .2 for = libc++ <span style=3D"caret-color: rgb(16, 16, 16); color: rgb(16, = 16, 16); font-family: Monaco; font-size: 10px; background-color: = rgb(255, 255, 255);">_LIBCPP_ABI_VERSION =3D=3D = 1</span> without <span style=3D"caret-color: rgb(16, 16, 16); = color: rgb(16, 16, 16); font-family: Monaco; font-size: 10px; = background-color: rgb(255, 255, = 255);">_LIBCPP_DEPRECATED_ABI_DISABLE_PAIR_TRIVIAL_COPY_CTOR</span> d= efined</div><div><br></div><div>) have the <span = style=3D"caret-color: rgb(16, 16, 16); color: rgb(16, 16, 16); = font-family: Monaco; font-size: 10px; background-color: rgb(255, 255, = 255);">_LIBCPP_ABI_VERSION =3D=3D 1</span> with <span = style=3D"caret-color: rgb(16, 16, 16); color: rgb(16, 16, 16); = font-family: Monaco; font-size: 10px; background-color: rgb(255, 255, = 255);">_LIBCPP_DEPRECATED_ABI_DISABLE_PAIR_TRIVIAL_COPY_CTOR</span> d= efined case for libc++.so.1 put into that 'compat' package for the sake = of old binaries</div><div><br></div><div>There is no reason to need to = deal with <span style=3D"caret-color: rgb(16, 16, 16); color: = rgb(16, 16, 16); font-family: Monaco; font-size: 10px; background-color: = rgb(255, 255, 255);">_LIBCPP_ABI_VERSION =3D=3D</span><span = style=3D"caret-color: rgb(16, 16, 16); color: rgb(16, 16, 16); = font-family: Monaco; font-size: 10px; background-color: rgb(255, 255, = 255);"> 2</span> at all for the issue at = hand.</div><div><br></div><div>(Yes, this would mean going forward that = for N>=3D 1, libc++.so.(N+1) would be for <span = style=3D"caret-color: rgb(16, 16, 16); color: rgb(16, 16, 16); = font-family: Monaco; font-size: 10px; background-color: rgb(255, 255, = 255);">_LIBCPP_ABI_VERSION =3D=3D</span><span style=3D"caret-color: = rgb(16, 16, 16); color: rgb(16, 16, 16); font-family: Monaco; font-size: = 10px; background-color: rgb(255, 255, 255);"> N</span> without = the FreeBSD oddity.)</div><div><br></div><blockquote type=3D"cite">It = would be preferable if upstream libc++ bumps its 'stable' ABI to 2 and = starts working on 3 as the then-experimental one, then all downstream = consumers can upgrade, leaving all compat crutches = behind.<br><br></blockquote><div><br></div>How important is having a = numerical match for <span style=3D"caret-color: rgb(0, 0, 0); = color: rgb(0, 0, 0);">libc++.so.(</span><span style=3D"caret-color: = rgb(16, 16, 16); color: rgb(16, 16, 16); font-family: Monaco; font-size: = 10px; background-color: rgb(255, 255, = 255);">_LIBCPP_ABI_VERSION</span><span style=3D"caret-color: rgb(0, 0, = 0); color: rgb(0, 0, 0);">)</span> instead of the +/- 1 shifting = between the .so and the <span style=3D"caret-color: rgb(16, 16, = 16); color: rgb(16, 16, 16); font-family: Monaco; font-size: 10px; = background-color: rgb(255, 255, = 255);">_LIBCPP_ABI_VERSION</span> ?</div><div><br></div></div><br><di= v> <div dir=3D"auto" style=3D"caret-color: rgb(0, 0, 0); color: rgb(0, 0, = 0); letter-spacing: normal; text-align: start; text-indent: 0px; = text-transform: none; white-space: normal; word-spacing: 0px; = -webkit-text-stroke-width: 0px; text-decoration: none; word-wrap: = break-word; -webkit-nbsp-mode: space; line-break: = after-white-space;"><div dir=3D"auto" style=3D"caret-color: rgb(0, 0, = 0); color: rgb(0, 0, 0); letter-spacing: normal; text-align: start; = text-indent: 0px; text-transform: none; white-space: normal; = word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: = none; word-wrap: break-word; -webkit-nbsp-mode: space; line-break: = after-white-space;"><div dir=3D"auto" style=3D"color: rgb(0, 0, 0); = letter-spacing: normal; text-align: start; text-indent: 0px; = text-transform: none; white-space: normal; word-spacing: 0px; = -webkit-text-stroke-width: 0px; word-wrap: break-word; = -webkit-nbsp-mode: space; line-break: after-white-space;"><div = style=3D"word-wrap: break-word; -webkit-nbsp-mode: space; line-break: = after-white-space;"><div style=3D"color: rgb(0, 0, 0); = font-variant-caps: normal; letter-spacing: normal; text-align: start; = text-indent: 0px; text-transform: none; white-space: normal; = word-spacing: 0px; -webkit-text-stroke-width: 0px;"><div style=3D"orphans:= 2; widows: 2; margin: 0px; line-height: normal;"><font face=3D"Courier = New">=3D=3D=3D</font></div><div style=3D"orphans: 2; widows: 2; margin: = 0px; line-height: normal;"><font face=3D"Courier New">Mark = Millard</font></div><div style=3D"orphans: 2; widows: 2; margin: 0px; = line-height: normal;"><font face=3D"Courier New"><span style=3D"font-size:= 12px;">marklmi at = yahoo.com<br></span></font></div></div></div></div></div></div> </div> <br></body></html>= --Apple-Mail=_CED38DD1-2D05-4B3D-9BE6-C999AC294AE5--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?98D4961E-2BEF-465E-8ACE-99587A089951>