Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error when compiling a static library using Swift "unknown option character `X' in: -Xlinker" [duplicate]

Tags:

ios

swift

ios8

Seeing this error when adding a swift file for compilation into a static library. using XCode 6.0 (6A215l)

Full libtool error: Libtool DerivedData/SwiftTest/Build/Products/Debug-iphonesimulator/libstatic.a normal i386 cd /Users/al/dev/ios/SwiftTest2 export IPHONEOS_DEPLOYMENT_TARGET=8.0 export PATH="/Applications/Xcode6-Beta.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Applications/Xcode6-Beta.app/Contents/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin" /Applications/Xcode6-Beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool -static -arch_only i386 -syslibroot /Applications/Xcode6-Beta.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator8.0.sdk -L/Users/al/dev/ios/SwiftTest2/DerivedData/SwiftTest/Build/Products/Debug-iphonesimulator -filelist /Users/al/dev/ios/SwiftTest2/DerivedData/SwiftTest/Build/Intermediates/SwiftTest.build/Debug-iphonesimulator/static.build/Objects-normal/i386/static.LinkFileList -ObjC -L/Applications/Xcode6-Beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator -Xlinker -rpath -Xlinker /Applications/Xcode6-Beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator -Xlinker -force_load -Xlinker /Applications/Xcode6-Beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/arc/libarclite_iphonesimulator.a -Xlinker -sectalign -Xlinker __SWIFT -Xlinker __ast -Xlinker 4 -Xlinker -sectcreate -Xlinker __SWIFT -Xlinker __ast -Xlinker /Users/al/dev/ios/SwiftTest2/DerivedData/SwiftTest/Build/Intermediates/SwiftTest.build/Debug-iphonesimulator/static.build/Objects-normal/i386/static.swiftmodule -o /Users/al/dev/ios/SwiftTest2/DerivedData/SwiftTest/Build/Products/Debug-iphonesimulator/libstatic.a

I've create a sample project here, the error happens in a completly fresh project: https://github.com/amleszk/SwiftTest/tree/cd94ca21d817fed336b1a3bfc774a13608e0d1ca

To reproduce checkout the project and build the SwiftTest target, which has a dependency on the static library. Any help appreciated

like image 703
amleszk Avatar asked Jun 03 '14 17:06

amleszk


1 Answers

Update: It seems like the official release of Xcode 6 still has that same issue.

From the xcode 6 beta 2 release notes:

It is not possible to build static libraries which contain Swift code in this release

like image 143
femot Avatar answered Nov 18 '22 23:11

femot