On legacy FreeBSD systems (such as 10.1 - now end of life) you may have just upgraded pkg as normal, or had it upgraded as a side effect of trying to install some software. For example

 
$ pkg install node
Password:
Updating FreeBSD repository catalogue...
[example.com] Fetching meta.txz: 100%    944 B   0.9kB/s    00:01    
[example.com] Fetching packagesite.txz: 100%    6 MiB   5.9MB/s    00:01    
Processing entries: 100%
FreeBSD repository update completed. 26051 packages processed.
New
version of pkg detected; it needs to be installed first.

The following 1 package(s) will be affected (of 0 checked):

Installed packages to be UPGRADED:
 pkg: 1.9.3 -> 1.9.4_1

Number of packages to be upgraded: 1

2 MiB to be downloaded.

Proceed with this action? [y/N]: 

Then been hit with the following error:

/usr/local/lib/libpkg.so.3: Undefined symbol "openat"

Is there a solution other than upgrading the operating system so that the correct libraries are linked, etc? Well there is certainly a short term solution and that is to use the static version of pkg. Neatly called pkg-static. Simply use as you would pkg for example:

 
$ pkg-static install node