Modern C++ Lamentations

Jonathan M Davis newsgroup.d at jmdavisprog.com
Wed Jan 2 05:39:28 UTC 2019


On Tuesday, January 1, 2019 9:09:29 PM MST H. S. Teoh via Digitalmars-d 
wrote:
> On Tue, Jan 01, 2019 at 07:04:24PM -0700, Jonathan M Davis via
> Digitalmars-d wrote: [...]
>
> > Anyone using a package manager to install dmd is only ever going to
> > end up with the version of Phobos that goes with that dmd. It would be
> > highly abnormal for multiple versions of Phobos to be installed on a
> > system.
>
> Wait, what?  Where did you get that idea from?  Since about a half
> decade ago, Linux distros like Debian have had the possibility of
> multiple versions of the same shared library installed at the same time.
> It's pretty much impossible to manage a distro otherwise, since being
> unable to do so would mean that you cannot upgrade a shared library
> until ALL upstream code has been updated to use the new version.  Now
> granted, most of the time new library versions are ABI compatible with
> older versions, so you don't actually need to keep *every* version of
> the library around just because some executable somewhere needs them.
> And granted, splitting a library package into multiple simultaneous
> versions is only done when necessary.
>
> But the mechanisms for doing so have been in place since a long time
> ago, and any decent distro management would include setting up the
> proper mechanisms for multiple versions of Phobos to be installable
> simultaneously.  Otherwise you have the untenable situation that Phobos
> cannot be upgraded without breaking every D program currently installed
> on the system.  Of course, for this to work, the soname needs to be set
> properly and a sane versioning system (encoded in the soname) needs to
> be in place. Basically, *every* ABI incompatibility (and I do mean
> *every*, even those with no equivalent change in the source code) needs
> to be reflected by a soname change. Which is likely not being done with
> the current makefiles in git.  Which would explain your observations.
> But it is certainly *possible*, and often *necessary*, to install
> multiple versions of the same shared library simultaneously.

Sure, you could have separate packages for separate versions of Phobos, but
from what I've seen, there's always one version of dmd with one version of
Phobos, and distros don't provide multiple versions. Now, I haven't studied
every distro there is, so maybe there is a distro out there that provides
separate packages for old versions of Phobos, but in my experience, you're
lucky if the distro has any package for dmd, let alone for it to be trying
to provide a way to have multiple versions of Phobos installed.

And while yes, distros are set up in a way that you can have multiple
versions of a library if multiple packages exist for them, and sometimes
they do that, in the vast majority of cases, the solution is that all
packages for the distro are built for a specific version of a library, and
when that library is upgraded, all the packages that depend on it get
rebuilt and need to be reinstalled. That's part of why it usually works so
poorly to distribute closed source programs for Linux. Distros tend to be
put together with the idea that all of the packages on the system are built
for that system with whatever version of the libraries they're currently
using, and having multiple versions of a library is the exception rather
than the rule.

But regardless of what is typically done with libraries for stuff like C++
or python, unless distros are specifically providing packages for older
versions of Phobos, then no one installing dmd and Phobos via a package
manager is going to end up with multiple versions of Phobos installed. So,
while it may be theoretically possible to have multiple versions of Phobos
installed via a package manager, from what I've seen, that simply doesn't
happen in practice, because the packages for dmd and Phobos aren't set up
that way.

- Jonathan M Davis





More information about the Digitalmars-d mailing list