问题描述
将swift文件添加到静态库中时,看到此错误。使用XCode 6.0(6A215l)
Seeing this error when adding a swift file for compilation into a static library. using XCode 6.0 (6A215l)
完整的libtool错误:
Libtool DerivedData / SwiftTest / Build / Products / Debug- iphonesimulator / libstatic.a正常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 /建立/中间体/ SwiftTest.build /调试-iphonesimulator / static.build /对象 - 正常/ 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
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
重现结帐项目并构建SwiftTest目标,它依赖于静态库。任何帮助赞赏
To reproduce checkout the project and build the SwiftTest target, which has a dependency on the static library. Any help appreciated
推荐答案
更新:似乎Xcode 6的正式版本仍然具有相同的功能问题。
Update: It seems like the official release of Xcode 6 still has that same issue.
从xcode 6 beta 2发行说明:
From the xcode 6 beta 2 release notes:
这篇关于在使用Swift“未知选项字符`X”编译静态库时出错:-Xlinker"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!