The dependency checking in the ports Makefiles uses file(1)
to check that a file is a shared library.
It seems like your magic database which is what file
uses to determine file type is broken. You can recreate it as follows, assuming you have the FreeBSD source code installed.
First, create the total database in text format;
cat /usr/src/contrib/file/magic/Header \ /usr/src/contrib/file/magic/Localstuff \ /usr/src/contrib/file/magic/Magdir/* >magic
Then compile it;
file -C magic
Now install both in their default location. This needs to be done as root;
install -m 644 magic magic.mgc /usr/share/misc/