On amd64 (but not aarch64) the FreeBSD-clang package depends on the
32-bit version of the libgcc_s.so.1 shared library, which is provided
by FreeBSD-clibs-lib32.
For some unknown reason, pkg does not install FreeBSD-clibs-lib32 when
vmimage.subr runs 'pkg ... install <long list of packages>'.
However, the *next* time 'pkg install' runs, it realizes that it needs
the 32-bit libgcc_s.so.1 -- even though that particular library is not
needed by the particular package we're trying to install -- and goes
looking for it... and ends up picking gcc12-devel as a provider.
Later in the EC2 image building process, we run 'pkg autoremove' (which
was added during 15.0 to get rid of "bogus dependencies") and pkg
decides that gcc12-devel is an automatic port which is not depended
upon and removes it... and also removes FreeBSD-clang, since it knows
that it can't keep FreeBSD-clang without keeping the port which is
supplying the 32-bit libgcc_s.so.1 library.
It's not clear if this is one bug in pkg or multiple bugs in pkg, not
is it clear why a 64-bit clang needs a 32-bit libgcc_s.so.1, but for
now adding FreeBSD-clibs-lib32 to the "small" and "builder" flavours of
EC2 images fixes the build.
MFC after: 5 days
Sponsored by: Amazon