<div dir="ltr">Hi, I've written a Swift (with some C) framework the builds and runs cleanly in Xcode 8. <div>A critical feature of my project is for my framework to run on MacOS, iOS, and Linux.</div><div>I am trying to figure out how to build using the SPM so I can run on Ubuntu.</div><div>I'm not so happy with the project structure now, but at least I think I am almost there.</div><div><br></div><div>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.</div><div>Features in Swift 3.0 that I am using require at least 10.11. When I type:</div><div><br></div><div><i>swift build -Xcc -I/usr/local/include -Xswiftc -j4 -Xlinker -L/usr/local/lib -Xlinker -lpng -Xlinker -ljpeg</i></div><div><br></div><div>The build bombs with:</div><div><br></div><div>"... error: 'init(fileURLWithPath:relativeTo:)' is only available on OS X 10.11 or newer"</div>
<div><br></div><div>How do I set the correct OS version??</div><div><br></div><div>I looked at the Xcode settings and tried to pass them through, but there seems to be an argument parsing error by SPM.</div><div>I am currently trying:</div><div><br></div><div><div><i>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</i></div></div><div><br></div><div>And I get:</div><div><span class="gmail-s1"><br></span></div><div><span class="gmail-s1">error:</span><span class="gmail-s2"> unknown command: /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk</span><br></div><div><p class="gmail-p1"><span class="gmail-s2">So it seems it thinks the parameter is a command. </span></p><p class="gmail-p1"><b>How do you set the sdk and target versions through swift build to fix this problem?</b><br></p><p class="gmail-p1">Thanks, Ed</p><p class="gmail-p1"><b><br></b></p><p class="gmail-p1"><span class="gmail-s2"><b>Configuration</b>:</span></p><p class="gmail-p1">MacBook Pro (Retina, 13-inch, Early 2015)<br></p><p class="gmail-p1">Sierra 10.12 (16A323)<br></p><p class="gmail-p1">Xcode Version 8.0 (8A218a)<br></p><p class="gmail-p1"><span class="gmail-s2"><br></span></p></div><div><br></div><div><br></div><div><br></div></div>