[swift-dev] Default deployment target for swiftc

Jordan Rose jordan_rose at apple.com
Tue Nov 28 13:44:35 CST 2017


Thanks, all. Sounds like following Clang and the interpreter is the way to go. https://github.com/apple/swift/pull/13114

Jordan


> On Nov 27, 2017, at 16:44, Jordan Rose via swift-dev <swift-dev at swift.org> wrote:
> 
> Hi, all. Consider the following command, as run on a Mac with an up-to-date Xcode installed:
> 
> xcrun swiftc foo.swift
> 
> The question: should this build for the current running OS, or the oldest macOS Swift supports (10.9)? You can always specify the deployment target OS version explicitly with the -target option, but what should the default behavior be?
> 
> Some points to consider:
> - The deployment OS affects availability checks, which means that the command might succeed on one host but fail on another.
> - …but we already changed the default for the interpreter (`xcrun swift`) to be the current running OS in Swift 3.1 (Xcode 8.3, last spring).
> - Clang defaults to the current running OS (as of a few Xcodes ago, IIRC).
> 
> Given these points, I'm inclined to change swiftc to default to building for the current running OS when no target is specified, but what do other people think?
> 
> Note that this doesn't apply to projects built with either Xcode or the Swift Package Manager, both of which always explicitly provide a deployment target. Invoking swiftc directly and not providing -target means (1) you are definitely compiling for Mac (when run on a Mac), and (2) there's a good chance you don't plan to distribute what you just built, because until Swift lives in the OS, it has dependencies on your installed Swift toolchain (currently messily resolved with absolute rpaths). If you avoid this with -static-stdlib, you're giving up the ability to have dynamic libraries, because we didn't implement that properly.
> 
> Thanks for your feedback!
> Jordan
> 
> P.S. For Apple folks, this is rdar://problem/29948658 <rdar://problem/29948658>.
> 
> _______________________________________________
> swift-dev mailing list
> swift-dev at swift.org
> https://lists.swift.org/mailman/listinfo/swift-dev

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-dev/attachments/20171128/31d2351b/attachment.html>


More information about the swift-dev mailing list