My Xcode target links against hdf5 library (using the Link Binary with Libraries build phase). libhdf5 is installed using MacPorts, thus /opt/local/lib contains both the dynamic (.dylib) and static (.a) versions of the library.
The text output from the build shows that there is, as expected, a -lhdf5
in the linking step of the build. gcc seems to take the dynamic linked library over the static, however. Is there any way to force gcc (via a compiler switch or via Xcode) to statically link with libhdf5.a?
The only solution I've found is to copy libhdf5.a to the project (or other) directory and link against that copy, thus avoiding having dynamic and static versions in the same location.