[swift-users] using "swift build" with code that depends on frameworks

Aaron Bohannon aaron678 at gmail.com
Tue Jan 31 11:35:41 CST 2017


I am trying to compile code for macOS that depends on the AudioKit
framework.

This can be done using `swiftc`, as long as one passes the flag `-target
x86_64-apple-macosx10.11`.

So, in theory, it should be possible to use `swift build` by passing it
these flags:

    -Xswiftc -target -Xswiftc x86_64-apple-macosx10.11

Unfortunately, `swift build` fails with this error:

    error: module file's minimum deployment target is OS X v10.11

By passing `--verbose` to `swift build`, I learned that `swift build` is
invoking `swiftc` with two copies of the `-target` flag:

    -target x86_64-apple-macosx10.11 -target x86_64-apple-macosx10.10

... and the second one is apparently overriding the first.  It seems this
issue was noted on the swift-build-dev list several months ago:
https://lists.swift.org/pipermail/swift-build-dev/
Week-of-Mon-20160919/000637.html

I am running macOS 10.11 with Xcode 8.2.1.  Has the bug been fixed in a
development version of swift?  If not, what work-around do you suggest?

Perhaps it would be simplest to recompile the AudioKit framework so that it
has a minimum deployment target of macosx10.10?  That project's scripts use
xcodebuild to compile the framework, and they do not seem to explicitly
specify a deployment target anywhere, but presumably this can be done by
adding a line to the appropriate .xcconfig file.  Does anyone know what
line would need to be added?

- Aaron
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-users/attachments/20170131/e340aea9/attachment.html>


More information about the swift-users mailing list