Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SR-9669] XCTest module can't be imported during compilation #52113

Open
vguerra opened this issue Jan 15, 2019 · 5 comments
Open

[SR-9669] XCTest module can't be imported during compilation #52113

vguerra opened this issue Jan 15, 2019 · 5 comments
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself

Comments

@vguerra
Copy link
Contributor

vguerra commented Jan 15, 2019

Previous ID SR-9669
Radar None
Original Reporter @vguerra
Type Bug
Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Bug
Assignee None
Priority Medium

md5: f49bf0f272dcabb426ed20b3bcc35308

Issue Description:

I did a checkout of master branch of swift repo the proceeded to check dependencies:

$> ./utils/update-checkout --clone
$>./utils/build-script --release --debug-swift

and compilation would break with following error:

/usr/local/swift/compiler/swift/stdlib/public/Darwin/XCTest/XCTest.swift:13:19: error: no such module 'XCTest'
 @_exported import XCTest // Clang module

Workarounds:

@belkadan suggested in this forum post to check the following

$> xcode-select -p
 /Library/Developer/CommandLineTools

and then :

Okay. Can one of you file a bug? And then the workaround I'd suggest would be deleting the CMakeCache.txt files out of your build directory, and then running build-script again with the DEVELOPER_DIR environment variable set to /Applications/Xcode.app (or wherever your Xcode 10.1 lives).

but doing:

$> xcode-select -s /Applications/Xcode.app/Contents/Developer

before re-running build script would as well fix the issue.

@belkadan
Copy link
Contributor

IIRC XCTest only lives inside Xcode.app, so I can only think of a few options, none of them great:

  • Don't build the XCTest overlay when using the command-line tools.

  • Try to find some Xcode installed on your system, but only use it for XCTest.

  • Try to find some Xcode installed on your system and use its SDKs.

  • Complain up front that the command line tools package isn't supported for building Swift.

I think the first option is probably best for now, if I'm correct that XCTest.framework doesn't exist inside /Library/Developer/CommandLineTools.

@vguerra
Copy link
Contributor Author

vguerra commented Jan 16, 2019

I think the first option is probably best for now, if I'm correct that XCTest.framework doesn't exist inside /Library/Developer/CommandLineTools.

That is the case, yes.

@belkadan
Copy link
Contributor

Trying to see if there's a quick fix for this. Can you let me know what xcrun -show-sdk-path -sdk macosx and xcrun -show-sdk-path -sdk iphonesimulator print on the machine with CommandLineTools xcode-select-ed?

(I can set up my own test machine with command line tools installed but if you happen to be around this is faster!)

@belkadan
Copy link
Contributor

Note that some of the regression tests depend on XCTest, so a Swift built from the command line tools won't pass all the tests with this solution. I think that's correct, though; marking those tests XFAIL or UNSUPPORTED would hide the fact that some parts of the stdlib and overlays aren't being tested. (We do this in other places for things like sanitizer support, but there the things that are being tested are the things that are missing.)

@vguerra
Copy link
Contributor Author

vguerra commented Jan 18, 2019

sorry for the delay .. I did not have my mac with me yesterday :/

here the outputs:

$> xcrun -show-sdk-path -sdk macosx
/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk
$> xcrun -show-sdk-path -sdk iphonesimulator
xcrun: error: SDK "iphonesimulator" cannot be located
xcrun: error: SDK "iphonesimulator" cannot be located
xcrun: error: unable to lookup item 'Path' in SDK 'iphonesimulator'

I do agree that marking those tests as XFAIl or UNSUPPORTED would not be ideal.

But would it be possible to hint the user that the developer dir they have selected does not include XCTest?

At first it was not obvious to me why the module was not found, I had Xcode installed and believed my setup was fine :/.

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself
Projects
None yet
Development

No branches or pull requests

2 participants