Re: How do I determine the ABI string used by pkg?

From: Ian Smith <smithi_at_nimnet.asn.au>
Date: Sun, 05 Mar 2023 05:09:57 UTC
On 2 March 2023 6:50:13 pm AEDT, Mel Pilgrim <list_freebsd@bluerosetech.com> wrote:
 > I need to determine the ABI string pkg uses on a given system, and
 > need to do so when there are no pkgs installed.

 # pkg -N -vv | grep ABI

gets you ABI and ALTABI; the former is the amd64 form, the latter x86:64

 > I've read through libpkg/pkg_elf.c and I can see how it's reading ELF
 > 
 > headers from well-known files.  That's all easy enough to replicate,
 > but 
 > I'm a bit stuck on how it's determining the arch string for x86.

I'm just running from a clue by bapt@ and what's on the release DVD, in which case the ALTABI form is a symlink:

 freebsd:12:x86:64 -> FreeBSD:12:amd64

and the All packages directory is

 packages/FreeBSD:12:amd64/All:
 total 2204897

 > How/When does pkg decide to use FreeBSD:13:amd64 instead of 
 > FreeBSD:13:x86:64?  Can I safely assume one or the other?

You can safely assume the former, that's the usual form.  The ALTABI form _might_ be safe but I've not tried using it.

cheers, Ian  (not subscribed to ports@)