Cannot build static library project containing Swift code

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:
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 PATH="/Applications/"
    /Applications/ -static -arch_only i386 -syslibroot /Applications/ -L/Users/modocache/Library/Developer/Xcode/DerivedData/Rapid-bfetfasodnmpvmfcsxegitstdhad/Build/Products/Debug-iphonesimulator -filelist /Users/modocache/Library/Developer/Xcode/DerivedData/Rapid-bfetfasodnmpvmfcsxegitstdhad/Build/Intermediates/ -ObjC -L/Applications/ -Xlinker -rpath -Xlinker /Applications/ -Xlinker -force_load -Xlinker /Applications/ -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/ -o /Users/modocache/Library/Developer/Xcode/DerivedData/Rapid-bfetfasodnmpvmfcsxegitstdhad/Build/Products/Debug-iphonesimulator/libRapid.a

error: /Applications/ unknown option character `X' in: -Xlinker
Usage: /Applications/ -static [-] file [...] [-filelist listfile[,dirname]] [-arch_only arch] [-sacLT] [-no_warning_for_no_symbols]
Usage: /Applications/ -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]

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





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.


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 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!