Swift 5.2 snapshot error

I have bug when trying to compile SwiftUI project in Xcode 11.3 on Swift 5.2 nightly snapshot:

ld: file not found: /Library/Developer/Toolchains/swift-5.2-DEVELOPMENT-SNAPSHOT-2020-01-06-a.xctoolchain/usr/lib/clang/7.0.0/lib/darwin/libclang_rt.profile_iossim.a

how can I fix this?

I have the same issue. Any updates?

Which snapshot have you used?

Swift 5.2 Development

The same issue on Trunk Development (master)

https://swift.org/builds/development/xcode/swift-DEVELOPMENT-SNAPSHOT-2020-01-24-a/swift-DEVELOPMENT-SNAPSHOT-2020-01-24-a-osx.pkg

file not found: /Library/Developer/Toolchains/swift-DEVELOPMENT-SNAPSHOT-2020-01-24-a.xctoolchain/usr/lib/clang/7.0.0/lib/darwin/libclang_rt.profile_iossim.a

Latest Xcode snapshots seem to be generally busted. I get the same error as @nonameplum when building Alamofire for iOS, and I'm getting a variety of other bizarre errors when building for Catalyst:

 <unknown>:0: warning: using sysroot for 'MacOSX' but targeting 'iPhone'
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CGDisplayConfiguration.h:12:10: note: while building module 'IOKit' imported from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CGDisplayConfiguration.h:12:
#include <IOKit/IOKitLib.h>
         ^
<module-includes>:121:9: note: in file included from <module-includes>:121:
#import "Headers/usb/IOUSBLib.h"
        ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/IOKit.framework/Headers/usb/IOUSBLib.h:27:10: note: in file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/IOKit.framework/Headers/usb/IOUSBLib.h:27:
#include <IOKit/usb/USB.h>
         ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/IOKit.framework/Headers/usb/USB.h:29:10: note: in file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/IOKit.framework/Headers/usb/USB.h:29:
#include <IOKit/usb/USBSpec.h>
         ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/IOKit.framework/Headers/usb/USBSpec.h:38:10: error: 'IOKit/usb/IOUSBHostFamily.h' file not found
#include <IOKit/usb/IOUSBHostFamily.h>
         ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/IOKit.framework/Headers/usb/USBSpec.h:38:10: note: did not find header 'usb/IOUSBHostFamily.h' in framework 'IOKit' (loaded from '/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/Library/Frameworks')
#include <IOKit/usb/IOUSBHostFamily.h>
         ^
<module-includes>:1:9: note: in file included from <module-includes>:1:
#import "Headers/CoreGraphics.h"
        ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.h:42:10: note: in file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.h:42:
#include <CoreGraphics/CGDisplayConfiguration.h>
         ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CGDisplayConfiguration.h:12:10: error: could not build module 'IOKit'
#include <IOKit/IOKitLib.h>
         ^
<unknown>:0: error: could not build Objective-C module 'CoreGraphics'

Additionally, our tests fail to build on macOS due to changes in the URLCache initializers:

#if swift(>=5.1)
    if #available(OSX 10.15, iOS 13.0, watchOS 6.0, tvOS 13.0, *) {
        let directory = FileManager.default.temporaryDirectory.appendingPathComponent(UUID().uuidString)
        cache = URLCache(memoryCapacity: capacity, diskCapacity: capacity, directory: directory)
    } else {
        cache = URLCache(memoryCapacity: capacity, diskCapacity: capacity, diskPath: UUID().uuidString)
    }
    #else
    cache = URLCache(memoryCapacity: capacity, diskCapacity: capacity, diskPath: UUID().uuidString)
#endif

This no longer builds, as it appears the new initializer has changed to public init(__memoryCapacity memoryCapacity: Int, diskCapacity: Int, directoryURL: URL?), which I'm guess is an issue with the importer.

Where should I report these bugs? Is the generation of these overlays open source?

Apple's Feedback Assistant is probably the best bet. Looks like errors are actually in the Platform SDKs.

I've submitted FB7552681, feel free to let me know if it should be duplicated in Swift's bug reporter.

I have the same issue for Swift 5.1.3. build error that it cannot find the libclang_rt.profile_iossim.a file.

I have just learned that this is being tracked in [SR-12001] Swift 5.2 toolchain ObjC Availability API crash · Issue #54436 · apple/swift · GitHub, which has a workaround. I'll paste it here in case the link breaks:

This happens because the toolchains don't include compiler-rt libraries for iOS. We're looking into this, but in the meantime you can work around the problem by copying the compiler-rt libraries from Xcode. A command like this will take care of it (adjust the toolchain path as needed):

sudo cp xcode-select -p/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/ /lib/darwin/libclang_rt. .a /Library/Developer/Toolchains/swift-DEVELOPMENT-SNAPSHOT-2019-12-03-a.xctoolchain/usr/lib/clang/7.0.0/lib/darwinc

1 Like