Cannot build static library project containing Swift code

Originator:B.Gesiak
Number:rdar://17233107 Date Originated:10-Jun-2014 01:24 AM
Status:Closed: Intended behavior Resolved:20-Aug-2014 05:52 PM
Product:Developer Tools Product Version:
Classification: Reproducible:
 
Summary:
Building a static library containing Swift code ends up passing unknown option flags to libtool, causing a build error.

Steps to Reproduce:
1. In Xcode, create a new Cocoa Touch Static Library project.
2. Build the project. The build succeeds, producing a libRapid.a static library.
3. Add a new Swift file to the project, using the "iOS > Source > Swift File" template.
4. Build the project.

Expected Results:
The build succeeds, producing a libRapid.a static library.

Actual Results:
The build fails. Xcode displays the following error (the static library in this case is called "Rapid"):

Libtool /Users/modocache/Library/Developer/Xcode/DerivedData/Rapid-bfetfasodnmpvmfcsxegitstdhad/Build/Products/Debug-iphonesimulator/libRapid.a normal i386
    cd /Users/modocache/Desktop/Rapid
    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/modocache/Library/Developer/Xcode/DerivedData/Rapid-bfetfasodnmpvmfcsxegitstdhad/Build/Products/Debug-iphonesimulator -filelist /Users/modocache/Library/Developer/Xcode/DerivedData/Rapid-bfetfasodnmpvmfcsxegitstdhad/Build/Intermediates/Rapid.build/Debug-iphonesimulator/Rapid.build/Objects-normal/i386/Rapid.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/modocache/Library/Developer/Xcode/DerivedData/Rapid-bfetfasodnmpvmfcsxegitstdhad/Build/Intermediates/Rapid.build/Debug-iphonesimulator/Rapid.build/Objects-normal/i386/Rapid.swiftmodule -o /Users/modocache/Library/Developer/Xcode/DerivedData/Rapid-bfetfasodnmpvmfcsxegitstdhad/Build/Products/Debug-iphonesimulator/libRapid.a

error: /Applications/Xcode6-Beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool: unknown option character `X' in: -Xlinker
Usage: /Applications/Xcode6-Beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool -static [-] file [...] [-filelist listfile[,dirname]] [-arch_only arch] [-sacLT] [-no_warning_for_no_symbols]
Usage: /Applications/Xcode6-Beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool -dynamic [-] file [...] [-filelist listfile[,dirname]] [-arch_only arch] [-o output] [-install_name name] [-compatibility_version #] [-current_version #] [-seg1addr 0x#] [-segs_read_only_addr 0x#] [-segs_read_write_addr 0x#] [-seg_addr_table <filename>] [-seg_addr_table_filename <file_system_path>] [-all_load] [-noall_load]

Version:
Xcode Version 6.0 (6A215l) & OS X 10.9.3 (13D65)

Notes:


Configuration:


Attachments:

---

Apple Developer Relations:
Engineering has determined that this issue behaves as intended based on the following:

This is correct behavior.  Building static archives is not supported.

We are now closing this bug report.

If you have questions regarding the resolution of this issue, please update your bug report with that information.

Please be sure to regularly check new Apple releases for any updates that might affect this issue.

Comments

Updated with response from Apple

Apple's engineering team has determined this is intended behavior. I added their response at the bottom of the radar.

This is an awful inconvenience

By alec.stanford.larson at June 15, 2014, 12:55 a.m. (reply...)

Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!