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

Aaron Bohannon aaron678 at gmail.com
Tue Jan 31 14:30:07 CST 2017


Thanks.  Using the latest Swift snapshot, I was able to get `swift build`
to work on my code -- although I also had to hack the build script for the
AudioKit framework so that I could recompile it with the latest Swift
snapshot, too.

On Tue, Jan 31, 2017 at 11:47 AM, Ankit Aggarwal <ankit_aggarwal at apple.com>
wrote:

> Hi,
>
> Yep the ordering was fixed in this PR: https://github.com/apple/
> swift-package-manager/pull/715
> SwiftPM will offer build settings in future to handle this properly.
>
> On Tue, Jan 31, 2017 at 11:05 PM, Aaron Bohannon via swift-users <
> swift-users at swift.org> wrote:
>
>> 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-M
>> on-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
>>
>>
>> _______________________________________________
>> swift-users mailing list
>> swift-users at swift.org
>> https://lists.swift.org/mailman/listinfo/swift-users
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-users/attachments/20170131/028ba82c/attachment.html>


More information about the swift-users mailing list