swiftlang / swift

The Swift Programming Language
https://swift.org
Apache License 2.0
67.61k stars 10.37k forks source link

[SR-11800] swift-api-digester doesn't work with Catalyst #54210

Open dmcyk opened 5 years ago

dmcyk commented 5 years ago
Previous ID SR-11800
Radar rdar://problem/57348893
Original Reporter @dmcyk
Type Bug
Environment macOS 10.15 Catalina Tried two OSS toolchains, development from November 17, 2019, and Swift 5.1.2 release toolchain.
Additional Detail from JIRA | | | |------------------|-----------------| |Votes | 0 | |Component/s | Source Tooling | |Labels | Bug | |Assignee | None | |Priority | Medium | md5: 4932617e19fdc7b165ae36c8b64eed65

Issue Description:

Running:

`xcrun swift-api-checker.py --module UIKit --target iosmac --action=dump --output uikit.json`

Errors with:

<unknown>:0: warning: using sysroot for 'MacOSX' but targeting 'iPhone'
/Applications/Xcode_11.2.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_11.2.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_11.2.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_11.2.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_11.2.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_11.2.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>
         ^
/Library/Developer/Toolchains/swift-5.1.2-RELEASE.xctoolchain/usr/lib/swift/iphonesimulator/CoreGraphics.swiftmodule/x86_64.swiftinterface:4:19: error: could not build Objective-C module 'CoreGraphics'
@_exported import CoreGraphics
                  ^
/Library/Developer/Toolchains/swift-5.1.2-RELEASE.xctoolchain/usr/lib/swift/iphonesimulator/Foundation.swiftmodule/x86_64.swiftinterface:5:8: error: failed to load module 'CoreGraphics'
import CoreGraphics
       ^
/Library/Developer/Toolchains/swift-5.1.2-RELEASE.xctoolchain/usr/lib/swift/iphonesimulator/UIKit.swiftmodule/x86_64.swiftinterface:4:8: error: failed to load module 'Foundation'
import Foundation
       ^
<unknown>:0: error: failed to load module 'UIKit'
/Applications/Xcode_11.2.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_11.2.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_11.2.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_11.2.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_11.2.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_11.2.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>
         ^
/Library/Developer/Toolchains/swift-5.1.2-RELEASE.xctoolchain/usr/lib/swift/iphonesimulator/CoreGraphics.swiftmodule/x86_64.swiftinterface:4:19: error: could not build Objective-C module 'CoreGraphics'
@_exported import CoreGraphics
                  ^
/Library/Developer/Toolchains/swift-5.1.2-RELEASE.xctoolchain/usr/lib/swift/iphonesimulator/Foundation.swiftmodule/x86_64.swiftinterface:5:8: error: failed to load module 'CoreGraphics'
import CoreGraphics
       ^
Failed to load module: UIKit
Command '['/Library/Developer/Toolchains/swift-5.1.2-RELEASE.xctoolchain/usr/bin/swift-api-digester', '-sdk', '/Applications/Xcode_11.2.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk', '-target', 'x86_64-apple-ios13.0-macabi', '-dump-sdk', '-module-cache-path', '/tmp/ModuleCache', '-swift-version', '5', '-abort-on-module-fail', '-iframework', '/Applications/Xcode_11.2.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/iOSSupport/System/Library/Frameworks', '-module', 'UIKit', '-o', 'uikit.json']' returned non-zero exit status 1

`/Library/Developer/Toolchains/swift-5.1.2-RELEASE.xctoolchain/usr/lib/swift/iphonesimulator`

Seems like compiler tries to import Swift libraries meant for the iOS simulator.

dmcyk commented 5 years ago

cc @nkcsgexi

beccadax commented 4 years ago

@swift-ci create