Gotcha with Xcode and static libraries
I’m working on packaging up my Objective-C interface to the e-mail library Libetpan so that users of my framework don’t have to install Libetpan. I setup targets in Xcode to build Libetpan and then I added the built static library to my framework target. However, when building my test cases, which rely on the framework, I kept getting linker errors, something about a dylib. Hmm, that’s strange, because I put the libetpan.a static library in the Xcode project, not the dynamically linked library. After about an hour of pulling my hair out I finally figured it out. When you add a library to Xcode it adds the path of the folder the library resides in to Xcode/s list of library paths to search. If you have two of the same library, one static and the other dynamic in that folder, Xcode will always choose the .dylib over a static library. I solved the problem by deleting all of the dylibs from the folder, now my framework links properly.