Hi Rich, Thanks for the feedback.
I do set the deployment target to 10.9 (using -mmacosx-version-min=10.9 for clang, and -macosx_version_min 10.9 for ld). Since the SDK marks functions for availability and deprecation, I expected the compiler to complain. But it seems you need to mark it as strict, otherwise, the compiler accepts it, and the linker links it as a weak symbol. http://clang.llvm.org/docs/AttributeReference.html#availability The problem is that a lot of 3rd-party libraries (libevent, among others) use GNU autotools, which can perform checks for clock_gettime (or getentropy, in another case) and use it if it finds it. A lot of my 3rd-party open-source libraries are breaking retro-compatibility when built with the new SDK because of this. If I could "undefine" clock_gettime for building these libraries, I think it would all be OK. Quite a number of open-source libraries are breaking because of this, it seems... https://github.com/Homebrew/homebrew-core/issues/1957 I'll keep looking into it, but introducing POSIX standard syscalls without protecting backwards compatibility is going to cause quite some havoc in multi-platform code, and call for a lot of platform-specific fixes. -- Charles Francoise Lead Mac Developer @ Lima char...@meetlima.com On Thu, Jul 21, 2016 at 3:45 PM Rich Siegel <sie...@barebones.com> wrote: > On Thursday, July 21, 2016, Charles Francoise > <char...@meetlima.com> wrote: > > >I’m trying to find a way to either build for 10.12 from > >10.11, or build from 10.12 and run for lower versions. > > There are two relevant settings: the SDK and the "Deployment > Target". There used to be multiple options for the SDK, but > lately Xcode has started putting the SDK and the OS version in > lock step, so that Xcode 7 includes only the 10.11 SDK and (I > presume) Xcode 8 includes only the 10.12 SDK. This can be > annoying sometimes, but is not a serious problem in most cases. > > The "Deployment Target" setting is more relevant here, I think. > That setting should be set to the lowest OS version which you > plan to support. (In this case, 10.9.) > > Even with all of this, you still have to code to the minimum > supported OS. If you have to run on 10.9, you can't call APIs > that don't exist there. Neither the OS nor the tool chain will > stop you from doing so. > > In the specific case, I see that clock_gettime() doesn't exist > on 10.11, which means it probably doesn't exist on prior OS > versions either, and that means that you can't call it unless > you do a runtime test to see if it's there. (The address of a > weak-linked function is NULL if the function is unavailable at runtime.) > > Good luck, > > R. > -- > Rich Siegel Bare Bones Software, Inc. > <sie...@barebones.com> <http://www.barebones.com/> > > Someday I'll look back on all this and laugh... until they > sedate me. > >
_______________________________________________ Do not post admin requests to the list. They will be ignored. Xcode-users mailing list (Xcode-users@lists.apple.com) Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/xcode-users/archive%40mail-archive.com This email sent to arch...@mail-archive.com