It is tempting to just link to the included open-source libraries that are included with macOS. But that really isn't reliable, as you have discovered. Apple builds these libraries for its own use only.
Hmmm, that’s missing a key subtlety. In general, you should feel free to use libraries (regardless of whether they originated with open source) whose headers and stub libraries appear in the macOS SDK. While there are some exceptions — more on this below — there are tonnes of such libraries in the macOS SDK that are fully supported. For example, it makes no sense at all to ship with your own copy of libxml2.
Most of the problems here stem from the distant past, in an era before the advent of formal SDKs, where folks used the libraries as they appeared in
/usr/include/
and
/usr/lib/
on their running systems. Occasionally Apple would add headers to
/usr/include/
without properly considering the long-term binary compatibility impact of that decision. This is exactly what happened with OpenSSL.
In recent years Apple has been much more careful about what’s in the macOS SDK [1], and any remaining libraries in the SDK, except where deprecated, should be considered supported API.
Share and Enjoy
—
Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware
let myEmail = "eskimo" + "1" + "@apple.com"
[1] Hey, we finally managed to remove the kernel’s MAC framework headers, and thus resolve the issue described in QA1574.