[swift-users] Swift Package Manager questions

Edward Connell ewconnell at gmail.com
Sun Oct 16 18:53:44 CDT 2016


Hi, I've written a Swift (with some C) framework the builds and runs
cleanly in Xcode 8.
A critical feature of my project is for my framework to run on MacOS, iOS,
and Linux.
I am trying to figure out how to build using the SPM so I can run on Ubuntu.
I'm not so happy with the project structure now, but at least I think I am
almost there.

I've hit a sticking point that I can't seem to figure out. The SPM sets the
target SDK to 10.10 by default.
Features in Swift 3.0 that I am using require at least 10.11. When I type:

*swift build -Xcc -I/usr/local/include -Xswiftc -j4 -Xlinker
-L/usr/local/lib -Xlinker -lpng -Xlinker -ljpeg*

The build bombs with:

"... error: 'init(fileURLWithPath:relativeTo:)' is only available on OS X
10.11 or newer"

How do I set the correct OS version??

I looked at the Xcode settings and tried to pass them through, but there
seems to be an argument parsing error by SPM.
I am currently trying:

*swift build -Xcc -I/usr/local/include -Xswiftc -j4 -Xswiftc -sdk
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk
-Xswiftc -target x86_64-apple-macosx10.12 -Xlinker -L/usr/local/lib
-Xlinker -lpng -Xlinker -ljpeg*

And I get:

error: unknown command:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk

So it seems it thinks the parameter is a command.

*How do you set the sdk and target versions through swift build to fix this
problem?*

Thanks, Ed


*Configuration*:

MacBook Pro (Retina, 13-inch, Early 2015)

Sierra 10.12 (16A323)

Xcode Version 8.0 (8A218a)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-users/attachments/20161016/56810903/attachment.html>


More information about the swift-users mailing list