Learned a New Unix Command
Now and then one tries to compile something and gets hit with something along the lines of:
ld: warning in /usr/local/lib/libSomethingOrOther.dylib, file is not of required architecture
Until now I had always found this to necessitate blindly flipping architecture switches in Xcode ("Uh, this time I'll try allowing PPc, but not 32 bit?") until linking succeeded. Today, however, I learned that the file command can quickly and painlessly tell you what architectures are included in a library file. It's super simple:
Niobium-II:~ $ cd /usr/local/lib
Niobium-II:lib $ file libCLHEP.dylib
libCLHEP.dylib: Mach-O dynamically linked shared library i386
Niobium-II:lib $ file libfuse.dylib
libfuse.dylib: Mach-O universal binary with 4 architectures
libfuse.dylib (for architecture i386): Mach-O dynamically linked shared library i386
libfuse.dylib (for architecture ppc7400): Mach-O dynamically linked shared library ppc
libfuse.dylib (for architecture x86_64): Mach-O 64-bit dynamically linked shared library x86_64
libfuse.dylib (for architecture ppc64): Mach-O 64-bit dynamically linked shared library ppc64
Niobium-II:lib $ file valgrind/x86-darwin/vgpreload_core.so
valgrind/x86-darwin/vgpreload_core.so: Mach-O dynamically linked shared library i386
Niobium-II:lib $ file valgrind/amd64-darwin/vgpreload_core.so
valgrind/amd64-darwin/vgpreload_core.so: Mach-O 64-bit dynamically linked shared library x86_64
Aside: This topic has come up for me this time because I'm trying (and now succeeding) in linking a program with ZOOM Minimization, which looks like an awesome minimization library. I'm a little concerned that the project looks dead; all of it's pages are old and badly buried, and the documentation and distribution tarball are in a state of disarray. If this is the case it would be rather too bad, as it looks so far like a top-notch approach to handling minimization in a modern, C++ way.