[swift-dev] Trying to use Swift libSyntax API. "Module compiled with Swift 4.1 cannot be imported in Swift 4.0.1"

Michael Gubik gubikmic at gmail.com
Mon Oct 16 08:06:07 CDT 2017


I'd like to try the Swift libSyntax API.

I did a fresh clone and compiled with
$ ./utils/build-script --release-debuginfo --xcode
using Xcode 9 beta 2 (9B46).

Now I'd like to try SwiftSyntax so I created a new Xcode project
(TestLibSyntax) and copied these three files to a project folder
(/Users/mmg/src/TestLibSyntax/Libraries)
~/swift-source/build/Xcode-RelWithDebInfoAssert/swift-macosx-x86_64/RelWithDebInfo/lib/swift/macosx/libswiftSwiftSyntax.dylib
~/swift-source/build/Xcode-RelWithDebInfoAssert/swift-macosx-x86_64/RelWithDebInfo/lib/swift/macosx/x86_64/SwiftSyntax.swiftmodule
~/swift-source/build/Xcode-RelWithDebInfoAssert/swift-macosx-x86_64/RelWithDebInfo/lib/swift/macosx/x86_64/SwiftSyntax.swiftdoc

Then in the Build Settings I set
SWIFT_INCLUDE_PATHS = /Users/mmg/src/TestLibSyntax/Libraries

And add a build phase to copy the .dylib to the Frameworks directory.

Upon building this project the compiler now complains that
Module compiled with Swift 4.1 cannot be imported in Swift 4.0.1:
/Users/mmg/src/TestLibSyntax/Libraries/SwiftSyntax.swiftmodule

Is there a way to tell the compiler to build everything in this example
project with Swift 4.1?

Or, how to use the SwiftSyntax swiftmodule and dylib in a regular Xcode
project?


Best,
Michael
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-dev/attachments/20171016/efd089da/attachment.html>


More information about the swift-dev mailing list