I was recently compiling SFML, to see whether it would be a viable replacement for SDL in Plinth, when I came across the following error:
ld: warning: in /opt/local/lib/libfreetype.dylib, file was built for unsupported file format which is not the architecture being linked (i386)
What this means is that I needed libfreetype, but the version installed by MacPorts (into /opt/local/lib, was a 32-bit version).
This is particularly odd, because I was on a 64-bit mac, and I don’t really need 32-bit libraries. Apparently, certain packages in MacPorts don’t get the memo and install only i386 binary libraries anyway.
Upon googling, I saw a lot of people encountering these errors during mac compilation, with all sorts of weird solutions. In many of these cases, the quick fix is simply to tell MacPorts to install all binary versions of the library. This takes up a bit of extra space, since you’ll get other versions of the library for other platforms that you don’t need, but it includes the 64-bit libraries that you do need.
To do this, simply tell MacPorts to install your package with the +universal
argument:
$ sudo port install freetype +universal
Voila, linking errors begone.