title: Compiling a C program with a specific architecture
body: <p>I was recently fighting some problems trying to compile an open source library on my Mac that depended on another library and got some errors about incompatible library architectures. Can somebody explain the concept behind compiling a C program for a specific architecture? I have seen the <code>-arch</code> compiler flag before and have seen values passed to it such as <code>ppc</code>, <code>i386</code> and <code>x86_64</code> which I assume maps to the CPU "language", but my understanding stops there. If one program uses a particular architecture, do all libraries that it loads need to be on the same architecture as well? How can I tell what architecture a given program/process is running under?</p>